first commit

This commit is contained in:
linkitapps
2026-09-14 23:22:10 +09:00
commit 9f9c8fb69b
4207 changed files with 1333187 additions and 0 deletions
@@ -0,0 +1,30 @@
from .endpoint import Endpoint
class TokenEndpoint(Endpoint):
"""Base class for token-based endpoints (revocation, introspection).
Subclasses must implement :meth:`authenticate_token` and
:meth:`create_endpoint_response`.
"""
#: Supported token types
SUPPORTED_TOKEN_TYPES = ("access_token", "refresh_token")
#: Allowed client authenticate methods
CLIENT_AUTH_METHODS = ["client_secret_basic"]
def authenticate_endpoint_client(self, request):
"""Authenticate client for endpoint with ``CLIENT_AUTH_METHODS``."""
client = self.server.authenticate_client(
request, self.CLIENT_AUTH_METHODS, self.ENDPOINT_NAME
)
request.client = client
return client
def authenticate_token(self, request, client):
"""Authenticate and return the token. Subclasses must implement this."""
raise NotImplementedError()
def create_endpoint_response(self, request):
"""Process the request and return response. Subclasses must implement this."""
raise NotImplementedError()