- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 14 for make_not_authenticated_error (0.23 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
docs_src/authentication_error_status_code/tutorial001_an_py310.py
from fastapi import Depends, FastAPI, HTTPException, status from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer app = FastAPI() class HTTPBearer403(HTTPBearer): def make_not_authenticated_error(self) -> HTTPException: return HTTPException( status_code=status.HTTP_403_FORBIDDEN, detail="Not authenticated" )
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 618 bytes - Click Count (0) -
docs/en/docs/how-to/authentication-error-status-code.md
But if for some reason your clients depend on the old behavior, you can revert to it by overriding the method `make_not_authenticated_error` in your security classes. For example, you can create a subclass of `HTTPBearer` that returns a `403 Forbidden` error instead of the default `401 Unauthorized` error:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 1.2K bytes - Click Count (0) -
fastapi/security/open_id_connect_url.py
openIdConnectUrl=openIdConnectUrl, description=description ) self.scheme_name = scheme_name or self.__class__.__name__ self.auto_error = auto_error def make_not_authenticated_error(self) -> HTTPException: return HTTPException( status_code=HTTP_401_UNAUTHORIZED, detail="Not authenticated", headers={"WWW-Authenticate": "Bearer"}, )Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Mon Mar 16 10:16:48 GMT 2026 - 3.1K bytes - Click Count (0) -
docs/zh-hant/docs/how-to/authentication-error-status-code.md
但如果你的用戶端因某些原因依賴於舊行為,你可以在你的 security 類別中覆寫 `make_not_authenticated_error` 方法以恢復舊的行為。 例如,你可以建立 `HTTPBearer` 的子類別,讓它回傳 `403 Forbidden` 錯誤,而不是預設的 `401 Unauthorized` 錯誤: {* ../../docs_src/authentication_error_status_code/tutorial001_an_py310.py hl[9:13] *} /// tipCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 1.1K bytes - Click Count (0) -
docs/ko/docs/how-to/authentication-error-status-code.md
하지만 어떤 이유로든 클라이언트가 이전 동작에 의존하고 있다면, 보안 클래스에서 `make_not_authenticated_error` 메서드를 오버라이드하여 이전 동작으로 되돌릴 수 있습니다. 예를 들어, 기본값인 `401 Unauthorized` 오류 대신 `403 Forbidden` 오류를 반환하는 `HTTPBearer`의 서브클래스를 만들 수 있습니다: {* ../../docs_src/authentication_error_status_code/tutorial001_an_py310.py hl[9:13] *}Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:06:26 GMT 2026 - 1.3K bytes - Click Count (0) -
docs/zh/docs/how-to/authentication-error-status-code.md
但如果由于某些原因你的客户端依赖旧行为,你可以在你的安全类中重写方法 `make_not_authenticated_error` 来回退到旧行为。 例如,你可以创建一个 `HTTPBearer` 的子类,使其返回 `403 Forbidden` 错误,而不是默认的 `401 Unauthorized` 错误: {* ../../docs_src/authentication_error_status_code/tutorial001_an_py310.py hl[9:13] *} /// tip | 提示Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 1.1K bytes - Click Count (0) -
fastapi/security/api_key.py
name=name, description=description, ) self.scheme_name = scheme_name or self.__class__.__name__ def make_not_authenticated_error(self) -> HTTPException: """ The WWW-Authenticate header is not standardized for API Key authentication but the HTTP specification requires that an error of 401 "Unauthorized" mustCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 9.6K bytes - Click Count (1) -
fastapi/security/oauth2.py
flows=cast(OAuthFlowsModel, flows), description=description ) self.scheme_name = scheme_name or self.__class__.__name__ self.auto_error = auto_error def make_not_authenticated_error(self) -> HTTPException: """ The OAuth 2 specification doesn't define the challenge that should be used, because a `Bearer` token is not really the only option to authenticate.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Mar 24 16:32:10 GMT 2026 - 23.6K bytes - Click Count (0) -
docs/uk/docs/how-to/authentication-error-status-code.md
Але якщо з якоїсь причини ваші клієнти залежать від старої поведінки, ви можете повернутися до неї, переписавши метод `make_not_authenticated_error` у ваших класах безпеки. Наприклад, ви можете створити підклас `HTTPBearer`, який повертатиме помилку `403 Forbidden` замість типового `401 Unauthorized`:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:27:41 GMT 2026 - 1.8K bytes - Click Count (0) -
docs/de/docs/how-to/authentication-error-status-code.md
Aber falls Ihre Clients aus irgendeinem Grund vom alten Verhalten abhängen, können Sie darauf zurückgreifen, indem Sie in Ihren Sicherheitsklassen die Methode `make_not_authenticated_error` überschreiben. Sie können beispielsweise eine Unterklasse von `HTTPBearer` erstellen, die einen Fehler `403 Forbidden` zurückgibt, statt des Default-`401 Unauthorized`-Fehlers:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 17:58:09 GMT 2026 - 1.3K bytes - Click Count (0)