MCPcopy Create free account
hub / github.com/authlib/authlib / create_revocation_endpoint

Function create_revocation_endpoint

authlib/integrations/sqla_oauth2/functions.py:63–87  ·  view source on GitHub ↗

Create a revocation endpoint class with SQLAlchemy session and token model. :param session: SQLAlchemy session :param token_model: Token model class

(session, token_model)

Source from the content-addressed store, hash-verified

61
62
63def create_revocation_endpoint(session, token_model):
64 """Create a revocation endpoint class with SQLAlchemy session
65 and token model.
66
67 :param session: SQLAlchemy session
68 :param token_model: Token model class
69 """
70 from authlib.oauth2.rfc7009 import RevocationEndpoint
71
72 query_token = create_query_token_func(session, token_model)
73
74 class _RevocationEndpoint(RevocationEndpoint):
75 def query_token(self, token, token_type_hint):
76 return query_token(token, token_type_hint)
77
78 def revoke_token(self, token, request):
79 now = int(time.time())
80 hint = request.form.get("token_type_hint")
81 token.access_token_revoked_at = now
82 if hint != "access_token":
83 token.refresh_token_revoked_at = now
84 session.add(token)
85 session.commit()
86
87 return _RevocationEndpoint
88
89
90def create_bearer_token_validator(session, token_model):

Callers 1

serverFunction · 0.90

Calls 1

create_query_token_funcFunction · 0.85

Tested by 1

serverFunction · 0.72