Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for HTTPBasicCredentials (0.31 sec)

  1. docs_src/security/tutorial006_an_py39.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)]):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 361 bytes
    - Viewed (0)
  2. docs_src/security/tutorial006.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)):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 321 bytes
    - Viewed (0)
  3. docs_src/security/tutorial006_an.py

    from fastapi import Depends, FastAPI
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    @app.get("/users/me")
    def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 371 bytes
    - Viewed (0)
  4. docs_src/security/tutorial007.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(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 14:33:05 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  5. docs/en/docs/reference/security/index.md

    You can import them from `fastapi.security`:
    
    ```python
    from fastapi.security import (
        APIKeyCookie,
        APIKeyHeader,
        APIKeyQuery,
        HTTPAuthorizationCredentials,
        HTTPBasic,
        HTTPBasicCredentials,
        HTTPBearer,
        HTTPDigest,
        OAuth2,
        OAuth2AuthorizationCodeBearer,
        OAuth2PasswordBearer,
        OAuth2PasswordRequestForm,
        OAuth2PasswordRequestFormStrict,
        OpenIdConnect,
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  6. fastapi/security/__init__.py

    from .api_key import APIKeyQuery as APIKeyQuery
    from .http import HTTPAuthorizationCredentials as HTTPAuthorizationCredentials
    from .http import HTTPBasic as HTTPBasic
    from .http import HTTPBasicCredentials as HTTPBasicCredentials
    from .http import HTTPBearer as HTTPBearer
    from .http import HTTPDigest as HTTPDigest
    from .oauth2 import OAuth2 as OAuth2
    from .oauth2 import OAuth2AuthorizationCodeBearer as OAuth2AuthorizationCodeBearer
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Dec 20 18:50:00 GMT 2020
    - 881 bytes
    - Viewed (0)
  7. tests/test_security_http_basic_realm_description.py

    from base64 import b64encode
    
    from fastapi import FastAPI, Security
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    security = HTTPBasic(realm="simple", description="HTTPBasic scheme")
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPBasicCredentials = Security(security)):
        return {"username": credentials.username, "password": credentials.password}
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  8. 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}
        ```
        """
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 15:29:38 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  9. docs_src/security/tutorial007_an.py

    import secrets
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    def get_current_username(
        credentials: Annotated[HTTPBasicCredentials, Depends(security)],
    ):
        current_username_bytes = credentials.username.encode("utf8")
        correct_username_bytes = b"stanleyjobson"
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  10. docs/de/docs/reference/security/index.md

    Sie können sie von `fastapi.security` importieren:
    
    ```python
    from fastapi.security import (
        APIKeyCookie,
        APIKeyHeader,
        APIKeyQuery,
        HTTPAuthorizationCredentials,
        HTTPBasic,
        HTTPBasicCredentials,
        HTTPBearer,
        HTTPDigest,
        OAuth2,
        OAuth2AuthorizationCodeBearer,
        OAuth2PasswordBearer,
        OAuth2PasswordRequestForm,
        OAuth2PasswordRequestFormStrict,
        OpenIdConnect,
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 18:15:05 GMT 2024
    - 1.8K bytes
    - Viewed (0)
Back to top