Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 55 for security (0.19 sec)

  1. tests/test_security_oauth2.py

    from dirty_equals import IsDict
    from fastapi import Depends, FastAPI, Security
    from fastapi.security import OAuth2, OAuth2PasswordRequestFormStrict
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    reusable_oauth2 = OAuth2(
        flows={
            "password": {
                "tokenUrl": "token",
                "scopes": {"read:users": "Read the users", "write:users": "Create users"},
            }
        }
    )
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  2. tests/test_security_oauth2_optional.py

    from typing import Optional
    
    from dirty_equals import IsDict
    from fastapi import Depends, FastAPI, Security
    from fastapi.security import OAuth2, OAuth2PasswordRequestFormStrict
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    reusable_oauth2 = OAuth2(
        flows={
            "password": {
                "tokenUrl": "token",
                "scopes": {"read:users": "Read the users", "write:users": "Create users"},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  3. tests/test_security_oauth2_optional_description.py

    from typing import Optional
    
    from dirty_equals import IsDict
    from fastapi import Depends, FastAPI, Security
    from fastapi.security import OAuth2, OAuth2PasswordRequestFormStrict
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    reusable_oauth2 = OAuth2(
        flows={
            "password": {
                "tokenUrl": "token",
                "scopes": {"read:users": "Read the users", "write:users": "Create users"},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.9K bytes
    - Viewed (0)
  4. docs/em/docs/advanced/security/oauth2-scopes.md

    ```Python hl_lines="155"
    {!../../../docs_src/security/tutorial005.py!}
    ```
    
    ## ๐Ÿ“ฃ โ†” *โžก ๐Ÿ› ๏ธ* & ๐Ÿ”—
    
    ๐Ÿ”œ ๐Ÿ‘ฅ ๐Ÿ“ฃ ๐Ÿ‘ˆ *โžก ๐Ÿ› ๏ธ* `/users/me/items/` ๐Ÿšš โ†” `items`.
    
    ๐Ÿ‘‰, ๐Ÿ‘ฅ ๐Ÿ—„ & โš™๏ธ `Security` โšช๏ธโžก๏ธ `fastapi`.
    
    ๐Ÿ‘† ๐Ÿ’ช โš™๏ธ `Security` ๐Ÿ“ฃ ๐Ÿ”— (๐Ÿ’– `Depends`), โœ‹๏ธ `Security` ๐Ÿ“จ ๐Ÿ”ข `scopes` โฎ๏ธ ๐Ÿ“‡ โ†” (๐ŸŽป).
    
    ๐Ÿ‘‰ ๐Ÿ’ผ, ๐Ÿ‘ฅ ๐Ÿšถโ€โ™€๏ธ ๐Ÿ”— ๐Ÿ”ข `get_current_active_user` `Security` (๐ŸŽ ๐ŸŒŒ ๐Ÿ‘ฅ ๐Ÿ”œ โฎ๏ธ `Depends`).
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 21:21:35 GMT 2024
    - 11.1K bytes
    - Viewed (0)
  5. fastapi/security/http.py

        [FastAPI docs for HTTP Basic Auth](https://fastapi.tiangolo.com/advanced/security/http-basic-auth/).
    
        ## Example
    
        ```python
        from typing import Annotated
    
        from fastapi import Depends, FastAPI
        from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
        app = FastAPI()
    
        security = HTTPBasic()
    
    
        @app.get("/users/me")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Apr 19 15:29:38 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  6. fastapi/security/oauth2.py

    from fastapi.openapi.models import OAuth2 as OAuth2Model
    from fastapi.openapi.models import OAuthFlows as OAuthFlowsModel
    from fastapi.param_functions import Form
    from fastapi.security.base import SecurityBase
    from fastapi.security.utils import get_authorization_scheme_param
    from starlette.requests import Request
    from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 21.1K bytes
    - Viewed (1)
  7. tests/test_tutorial/test_security/test_tutorial005_an.py

    from dirty_equals import IsDict, IsOneOf
    from fastapi.testclient import TestClient
    
    from docs_src.security.tutorial005_an import (
        app,
        create_access_token,
        fake_users_db,
        get_password_hash,
        verify_password,
    )
    
    client = TestClient(app)
    
    
    def get_access_token(username="johndoe", password="secret", scope=None):
        data = {"username": username, "password": password}
        if scope:
            data["scope"] = scope
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 15.4K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/security/oauth2-jwt.md

        {!> ../../../docs_src/security/tutorial004_an_py310.py!}
        ```
    
    === "Python 3.9+"
    
        ```Python hl_lines="7  48  55-56  59-60  69-75"
        {!> ../../../docs_src/security/tutorial004_an_py39.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="7  49  56-57  60-61  70-76"
        {!> ../../../docs_src/security/tutorial004_an.py!}
        ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 13K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_security/test_tutorial005_py39.py

    
    @needs_py39
    def test_verify_password():
        from docs_src.security.tutorial005_py39 import fake_users_db, verify_password
    
        assert verify_password("secret", fake_users_db["johndoe"]["hashed_password"])
    
    
    @needs_py39
    def test_get_password_hash():
        from docs_src.security.tutorial005_py39 import get_password_hash
    
        assert get_password_hash("secretalice")
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.3K bytes
    - Viewed (0)
  10. docs/ja/docs/tutorial/security/first-steps.md

    ```Python hl_lines="10"
    {!../../../docs_src/security/tutorial001.py!}
    ```
    
    ใ“ใฎไพๅญ˜้–ขไฟ‚ใฏใ€*path operation function*ใฎใƒ‘ใƒฉใƒกใƒผใ‚ฟใƒผ`token`ใซไปฃๅ…ฅใ•ใ‚Œใ‚‹`str`ใ‚’ๆไพ›ใ—ใพใ™ใ€‚
    
    **FastAPI**ใฏใ€ใ“ใฎไพๅญ˜้–ขไฟ‚ใ‚’ไฝฟ็”จใ—ใฆOpenAPIใ‚นใ‚ญใƒผใƒž (ใŠใ‚ˆใณ่‡ชๅ‹•APIใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆ) ใงใ€Œใ‚ปใ‚ญใƒฅใƒชใƒ†ใ‚ฃใ‚นใ‚ญใƒผใƒ ใ€ใ‚’ๅฎš็พฉใงใใ‚‹ใ“ใจใ‚’็Ÿฅใฃใฆใ„ใพใ™ใ€‚
    
    !!! info "ๆŠ€่ก“่ฉณ็ดฐ"
        **FastAPI**ใฏใ€`OAuth2PasswordBearer` ใ‚ฏใƒฉใ‚น (ไพๅญ˜้–ขไฟ‚ใงๅฎฃ่จ€ใ•ใ‚Œใฆใ„ใ‚‹) ใ‚’ไฝฟ็”จใ—ใฆOpenAPIใฎใ‚ปใ‚ญใƒฅใƒชใƒ†ใ‚ฃใ‚นใ‚ญใƒผใƒ ใ‚’ๅฎš็พฉใงใใ‚‹ใ“ใจใ‚’็Ÿฅใฃใฆใ„ใพใ™ใ€‚ใ“ใ‚Œใฏ`fastapi.security.oauth2.OAuth2`ใ€`fastapi.security.base.SecurityBase`ใ‚’็ถ™ๆ‰ฟใ—ใฆใ„ใ‚‹ใ‹ใ‚‰ใงใ™ใ€‚
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10.5K bytes
    - Viewed (0)
Back to top