Closed Bishwas-py closed 5 months ago
core/auth contains the mechanism for auth.
core/auth
class BaseAuthMechanism: def __init__(self, permissions: list[str] = None, message_response: dict = None, *args, **kwargs): self.message_response = message_response or {"message": "Unauthorized"} self.permissions = permissions def authenticate(self, request: HttpRequest, *args, **kwargs): pass def authorize(self, request: HttpRequest, *args, **kwargs): pass def schema(self): return {} def app_schema(self): return {} def set_message_response(self, message_response: dict): self.message_response = message_response
BaseAuthMechanism can be inherited and new auth mechanism can be written.
BaseAuthMechanism
schema is for the overall OpenAPI details, and app_schema is for the specific endpoint, to apply that schema.
schema
app_schema
core/auth
contains the mechanism for auth.BaseAuthMechanism
can be inherited and new auth mechanism can be written.