bb-plane-fork/apps/api/plane/utils/openapi/auth.py
sriram veeraghanta 9237f568dd
[WEB-5044] fix: ruff lint and format errors (#7868)
* fix: lint errors

* fix: file formatting

* fix: code refactor
2025-09-29 19:15:32 +05:30

30 lines
978 B
Python

"""
OpenAPI authentication extensions for drf-spectacular.
This module provides authentication extensions that automatically register
custom authentication classes with the OpenAPI schema generator.
"""
from drf_spectacular.extensions import OpenApiAuthenticationExtension
class APIKeyAuthenticationExtension(OpenApiAuthenticationExtension):
"""
OpenAPI authentication extension for
plane.api.middleware.api_authentication.APIKeyAuthentication
"""
target_class = "plane.api.middleware.api_authentication.APIKeyAuthentication"
name = "ApiKeyAuthentication"
priority = 1
def get_security_definition(self, auto_schema):
"""
Return the security definition for API key authentication.
"""
return {
"type": "apiKey",
"in": "header",
"name": "X-API-Key",
"description": "API key authentication. Provide your API key in the X-API-Key header.", # noqa: E501
}