full oidc example with autoconfiguration #222
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was able to use flask-jwt-extended with tokens issued by RedHat's Keycloak. This example retrieves OIDC
.well-known/openid-configuration
for the purpose of assembly RSAPublic key to validate signature of the token.It honestly took me few months to learn how to do this. I am hoping by adding this example to
flask-jwt_extended
others can be saved that pain.This example follows 4 basic OIDC configuration input parameters example used by places like OpenAPI https://swagger.io/docs/specification/authentication/openid-connect-discovery/ (not implemented for Python) or Kubernetes https://kubernetes.io/docs/reference/access-authn-authz/authentication/ (mostly for reference) to name few.
Below parameters are documented in code example:
I have included endpoints for anonymous, token_protected and group_protected examples. This can obviously be extended further. With identity servers such as Keycloak https://www.keycloak.org/ that can be spun up as Docker container https://hub.docker.com/r/jboss/keycloak/ or into Kubernetes Helm Charts https://github.com/helm/charts/tree/master/stable/keycloak this addition makes added features really attractive on microservice role(group)-based-access-control level.