diff options
author | Frederick Muriuki Muriithi | 2024-07-26 16:59:12 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-07-31 09:30:27 -0500 |
commit | 5338f5cae369a34e9a391de58cc73247adf15373 (patch) | |
tree | 5b2f67ee40c7e782bab264b70f2f68d1570a73f4 /gn_auth/auth/authentication/oauth2 | |
parent | acb696a15887e9088c0caf40ff020f28438acb59 (diff) | |
download | gn-auth-5338f5cae369a34e9a391de58cc73247adf15373.tar.gz |
Use customised JWTBearerToken class
Diffstat (limited to 'gn_auth/auth/authentication/oauth2')
-rw-r--r-- | gn_auth/auth/authentication/oauth2/resource_server.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gn_auth/auth/authentication/oauth2/resource_server.py b/gn_auth/auth/authentication/oauth2/resource_server.py index c228a07..9c885e2 100644 --- a/gn_auth/auth/authentication/oauth2/resource_server.py +++ b/gn_auth/auth/authentication/oauth2/resource_server.py @@ -5,11 +5,16 @@ from flask import current_app as app from authlib.jose import jwt, KeySet, JoseError from authlib.oauth2.rfc6750 import BearerTokenValidator as _BearerTokenValidator +from authlib.oauth2.rfc7523 import ( + JWTBearerTokenValidator as _JWTBearerTokenValidator) from authlib.integrations.flask_oauth2 import ResourceProtector -from gn_auth.auth.jwks import list_jwks, jwks_directory from gn_auth.auth.db import sqlite3 as db -from gn_auth.auth.authentication.oauth2.models.oauth2token import token_by_access_token +from gn_auth.auth.jwks import list_jwks, jwks_directory +from gn_auth.auth.authentication.oauth2.models.jwt_bearer_token import ( + JWTBearerToken) +from gn_auth.auth.authentication.oauth2.models.oauth2token import ( + token_by_access_token) class BearerTokenValidator(_BearerTokenValidator): """Extends `authlib.oauth2.rfc6750.BearerTokenValidator`""" @@ -20,6 +25,7 @@ class BearerTokenValidator(_BearerTokenValidator): class JWTBearerTokenValidator(_JWTBearerTokenValidator): """Validate a token using all the keys""" + token_cls = JWTBearerToken _local_attributes = ("jwt_refresh_frequency_hours",) def __init__(self, public_key, issuer=None, realm=None, **extra_attributes): |