API - add access token revocation
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
from authlib.integrations.sqla_oauth2 import create_revocation_endpoint
|
||||
from authlib.oauth2.rfc7636 import CodeChallenge
|
||||
from flask import Flask
|
||||
|
||||
from .grants import AuthorizationCodeGrant, RefreshTokenGrant
|
||||
from fittrackee import db
|
||||
|
||||
from .grants import AuthorizationCodeGrant, OAuth2Token, RefreshTokenGrant
|
||||
from .server import authorization_server
|
||||
|
||||
|
||||
@@ -13,3 +16,8 @@ def config_oauth(app: Flask) -> None:
|
||||
AuthorizationCodeGrant, [CodeChallenge(required=True)]
|
||||
)
|
||||
authorization_server.register_grant(RefreshTokenGrant)
|
||||
|
||||
# support revocation
|
||||
revocation_cls = create_revocation_endpoint(db.session, OAuth2Token)
|
||||
revocation_cls.CLIENT_AUTH_METHODS = ['client_secret_post']
|
||||
authorization_server.register_endpoint(revocation_cls)
|
||||
|
||||
Reference in New Issue
Block a user