Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for HTTPBearer (0.06 sec)

  1. tests/test_webhooks_security.py

    from datetime import datetime
    from typing import Annotated
    
    from fastapi import FastAPI, Security
    from fastapi.security import HTTPBearer
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    bearer_scheme = HTTPBearer()
    
    
    class Subscription(BaseModel):
        username: str
        monthly_fee: float
        start_date: datetime
    
    
    @app.webhooks.post("new-subscription")
    def new_subscription(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 4.5K bytes
    - Viewed (0)
  2. fastapi/security/http.py

        ## Example
    
        ```python
        from typing import Annotated
    
        from fastapi import Depends, FastAPI
        from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
    
        app = FastAPI()
    
        security = HTTPBearer()
    
    
        @app.get("/users/me")
        def read_current_user(
            credentials: Annotated[HTTPAuthorizationCredentials, Depends(security)]
        ):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 13.2K bytes
    - Viewed (0)
  3. docs/ru/docs/how-to/authentication-error-status-code.md

    Но если по какой-то причине ваши клиенты зависят от старого поведения, вы можете вернуть его, переопределив метод `make_not_authenticated_error` в ваших Security-классах.
    
    Например, вы можете создать подкласс `HTTPBearer`, который будет возвращать ошибку `403 Forbidden` вместо стандартной `401 Unauthorized`:
    
    {* ../../docs_src/authentication_error_status_code/tutorial001_an_py39.py hl[9:13] *}
    
    /// tip | Совет
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Dec 11 21:25:03 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  4. docs/es/docs/how-to/authentication-error-status-code.md

    Pero si por alguna razón tus clientes dependen del comportamiento anterior, puedes volver a él sobrescribiendo el método `make_not_authenticated_error` en tus clases de seguridad.
    
    Por ejemplo, puedes crear una subclase de `HTTPBearer` que devuelva un error `403 Forbidden` en lugar del `401 Unauthorized` por defecto:
    
    {* ../../docs_src/authentication_error_status_code/tutorial001_an_py39.py hl[9:13] *}
    
    /// tip | Consejo
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 16 16:16:35 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  5. docs/de/docs/how-to/authentication-error-status-code.md

    Sie können beispielsweise eine Unterklasse von `HTTPBearer` erstellen, die einen Fehler `403 Forbidden` zurückgibt, statt des Default-`401 Unauthorized`-Fehlers:
    
    {* ../../docs_src/authentication_error_status_code/tutorial001_an_py39.py hl[9:13] *}
    
    /// tip | Tipp
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 02 17:32:56 UTC 2025
    - 1.4K bytes
    - Viewed (0)
  6. docs/pt/docs/how-to/authentication-error-status-code.md

    Mas, se por algum motivo seus clientes dependem do comportamento antigo, você pode voltar a ele sobrescrevendo o método `make_not_authenticated_error` nas suas classes de segurança.
    
    Por exemplo, você pode criar uma subclasse de `HTTPBearer` que retorne um erro `403 Forbidden` em vez do erro padrão `401 Unauthorized`:
    
    {* ../../docs_src/authentication_error_status_code/tutorial001_an_py39.py hl[9:13] *}
    
    /// tip | Dica
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 19:59:04 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  7. fastapi/openapi/models.py

        in_: APIKeyIn = Field(alias="in")
        name: str
    
    
    class HTTPBase(SecurityBase):
        type_: SecuritySchemeType = Field(default=SecuritySchemeType.http, alias="type")
        scheme: str
    
    
    class HTTPBearer(HTTPBase):
        scheme: Literal["bearer"] = "bearer"
        bearerFormat: Optional[str] = None
    
    
    class OAuthFlow(BaseModelWithConfig):
        refreshUrl: Optional[str] = None
        scopes: dict[str, str] = {}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 15.1K bytes
    - Viewed (0)
  8. docs/en/docs/release-notes.md

    ## 0.27.1
    
    * Fix `auto_error=False` handling in `HTTPBearer` security scheme. Do not `raise` when there's an incorrect `Authorization` header if `auto_error=False`. PR [#282](https://github.com/tiangolo/fastapi/pull/282).
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 19:06:15 UTC 2025
    - 586.7K bytes
    - Viewed (0)
Back to top