Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for HTTPBasicCredentials (0.06 sec)

  1. docs_src/security/tutorial007_py39.py

    import secrets
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    def get_current_username(credentials: HTTPBasicCredentials = Depends(security)):
        current_username_bytes = credentials.username.encode("utf8")
        correct_username_bytes = b"stanleyjobson"
        is_correct_username = secrets.compare_digest(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.1K bytes
    - Viewed (0)
  2. docs_src/security/tutorial006_py39.py

    from fastapi import Depends, FastAPI
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPBasicCredentials = Depends(security)):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 321 bytes
    - Viewed (0)
  3. fastapi/security/http.py

        from typing import Annotated
    
        from fastapi import Depends, FastAPI
        from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
        app = FastAPI()
    
        security = HTTPBasic()
    
    
        @app.get("/users/me")
        def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]):
            return {"username": credentials.username, "password": credentials.password}
        ```
        """
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 13.2K bytes
    - Viewed (0)
  4. docs/es/docs/advanced/security/http-basic-auth.md

    ## Simple HTTP Basic Auth { #simple-http-basic-auth }
    
    * Importa `HTTPBasic` y `HTTPBasicCredentials`.
    * Crea un "esquema de `security`" usando `HTTPBasic`.
    * Usa ese `security` con una dependencia en tu *path operation*.
    * Devuelve un objeto de tipo `HTTPBasicCredentials`:
      * Contiene el `username` y `password` enviados.
    
    {* ../../docs_src/security/tutorial006_an_py39.py hl[4,8,12] *}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 16 16:33:45 UTC 2025
    - 5.4K bytes
    - Viewed (0)
Back to top