diff options
author | Frederick Muriuki Muriithi | 2024-04-18 20:15:25 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-04-20 15:28:59 +0300 |
commit | cfda9d6cd15763e65fa851d964033e37f377239c (patch) | |
tree | 23e0dac4c1e7ab62a21fadac7b82a2d418373d29 /gn_auth/auth/authentication/oauth2/server.py | |
parent | d9b8b05a460535dfb09168d1958c047255ff0fa2 (diff) | |
download | gn-auth-cfda9d6cd15763e65fa851d964033e37f377239c.tar.gz |
Define and register grant for JWT tokens.
Diffstat (limited to 'gn_auth/auth/authentication/oauth2/server.py')
-rw-r--r-- | gn_auth/auth/authentication/oauth2/server.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gn_auth/auth/authentication/oauth2/server.py b/gn_auth/auth/authentication/oauth2/server.py index 0bce3d3..09a3449 100644 --- a/gn_auth/auth/authentication/oauth2/server.py +++ b/gn_auth/auth/authentication/oauth2/server.py @@ -14,6 +14,7 @@ from .models.oauth2token import OAuth2Token, save_token from .grants.password_grant import PasswordGrant from .grants.authorisation_code_grant import AuthorisationCodeGrant +from .grants.jwt_bearer_grant import JWTBearerGrant, JWTBearerTokenGenerator from .endpoints.revocation import RevocationEndpoint from .endpoints.introspection import IntrospectionEndpoint @@ -59,6 +60,11 @@ def setup_oauth2_server(app: Flask) -> None: # below server.register_grant(AuthorisationCodeGrant) + server.register_grant(JWTBearerGrant) + server.register_token_generator( + "urn:ietf:params:oauth:grant-type:jwt-bearer", + JWTBearerTokenGenerator(app.config["JWT_PRIVATE_KEY"])) + # register endpoints server.register_endpoint(RevocationEndpoint) server.register_endpoint(IntrospectionEndpoint) |