init medical training project
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
"""drf-spectacular 扩展:注册自定义认证类的 OpenAPI 映射。"""
|
||||
|
||||
from drf_spectacular.extensions import OpenApiAuthenticationExtension
|
||||
|
||||
|
||||
class RedisBlacklistJWTScheme(OpenApiAuthenticationExtension):
|
||||
"""让 drf-spectacular 将 RedisBlacklistJWTAuthentication 识别为 Bearer JWT。"""
|
||||
|
||||
target_class = 'apps.user.authentication.RedisBlacklistJWTAuthentication'
|
||||
name = 'jwtAuth'
|
||||
|
||||
def get_security_definition(self, auto_schema):
|
||||
return {
|
||||
'type': 'http',
|
||||
'scheme': 'bearer',
|
||||
'bearerFormat': 'JWT',
|
||||
}
|
||||
Reference in New Issue
Block a user