bb-plane-fork/apps/api/plane/utils/openapi/auth.py
sriram veeraghanta 02d0ee3e0f
chore: add copyright (#8584)
* feat: adding new copyright info on all files

* chore: adding CI
2026-01-27 13:54:22 +05:30

34 lines
1.1 KiB
Python

# Copyright (c) 2023-present Plane Software, Inc. and contributors
# SPDX-License-Identifier: AGPL-3.0-only
# See the LICENSE file for details.
"""
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
}