aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth/authentication/oauth2/resource_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'gn_auth/auth/authentication/oauth2/resource_server.py')
-rw-r--r--gn_auth/auth/authentication/oauth2/resource_server.py10
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):