Browse Source

refactor: update authentication scheme handling in HTTPBase

pull/13326/head
Manish 1 month ago
parent
commit
615df05bf1
  1. 7
      fastapi/security/http.py

7
fastapi/security/http.py

@ -75,10 +75,11 @@ class HTTPBase(SecurityBase):
description: Optional[str] = None,
auto_error: bool = True,
):
self.model = HTTPBaseModel(scheme=scheme, description=description)
self.model: HTTPBaseModel = HTTPBaseModel(
scheme=scheme, description=description
)
self.scheme_name = scheme_name or self.__class__.__name__
self.auto_error = auto_error
self.scheme = scheme
async def __call__(
self, request: Request
@ -90,7 +91,7 @@ class HTTPBase(SecurityBase):
raise HTTPException(
status_code=HTTP_401_UNAUTHORIZED,
detail="Not authenticated",
headers={"WWW-Authenticate": self.scheme},
headers={"WWW-Authenticate": self.model.scheme},
)
else:

Loading…
Cancel
Save