Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 63 for current_user (0.19 sec)

  1. tests/test_security_oauth2_optional_description.py

    @app.post("/login")
    def login(form_data: OAuth2PasswordRequestFormStrict = Depends()):
        return form_data
    
    
    @app.get("/users/me")
    def read_users_me(current_user: Optional[User] = Depends(get_current_user)):
        if current_user is None:
            return {"msg": "Create an account first"}
        return current_user
    
    
    client = TestClient(app)
    
    
    def test_security_oauth2():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 10.9K bytes
    - Viewed (0)
  2. docs/pt/docs/tutorial/dependencies/index.md

    ```mermaid
    graph TB
    
    current_user(["current_user"])
    active_user(["active_user"])
    admin_user(["admin_user"])
    paying_user(["paying_user"])
    
    public["/items/public/"]
    private["/items/private/"]
    activate_user["/users/{user_id}/activate"]
    pro_items["/items/pro/"]
    
    current_user --> active_user
    active_user --> admin_user
    active_user --> paying_user
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 12.6K bytes
    - Viewed (0)
  3. tests/test_security_oauth2.py

    def login(form_data: "OAuth2PasswordRequestFormStrict" = Depends()):
        return form_data
    
    
    @app.get("/users/me")
    # Here we use string annotations to test them
    def read_current_user(current_user: "User" = Depends(get_current_user)):
        return current_user
    
    
    client = TestClient(app)
    
    
    def test_security_oauth2():
        response = client.get("/users/me", headers={"Authorization": "Bearer footokenbar"})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 10.7K bytes
    - Viewed (0)
  4. docs/ko/docs/tutorial/dependencies/index.md

    ```mermaid
    graph TB
    
    current_user(["current_user"])
    active_user(["active_user"])
    admin_user(["admin_user"])
    paying_user(["paying_user"])
    
    public["/items/public/"]
    private["/items/private/"]
    activate_user["/users/{user_id}/activate"]
    pro_items["/items/pro/"]
    
    current_user --> active_user
    active_user --> admin_user
    active_user --> paying_user
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 13.5K bytes
    - Viewed (0)
  5. docs/em/docs/tutorial/security/get-current-user.md

    {!> ../../docs_src/security/tutorial002.py!}
    ```
    
    ////
    
    //// tab | ๐Ÿ 3๏ธโƒฃ.1๏ธโƒฃ0๏ธโƒฃ & ๐Ÿ”›
    
    ```Python hl_lines="29"
    {!> ../../docs_src/security/tutorial002_py310.py!}
    ```
    
    ////
    
    ๐Ÿ‘€ ๐Ÿ‘ˆ ๐Ÿ‘ฅ ๐Ÿ“ฃ ๐Ÿ†Ž `current_user` Pydantic ๐Ÿท `User`.
    
    ๐Ÿ‘‰ ๐Ÿ”œ โ„น ๐Ÿ‡บ๐Ÿ‡ฒ ๐Ÿ”˜ ๐Ÿ”ข โฎ๏ธ ๐ŸŒ ๐Ÿ› ๏ธ & ๐Ÿ†Ž โœ….
    
    /// tip
    
    ๐Ÿ‘† 5๏ธโƒฃ๐Ÿ“† ๐Ÿ’ญ ๐Ÿ‘ˆ ๐Ÿ“จ ๐Ÿ’ช ๐Ÿ“ฃ โฎ๏ธ Pydantic ๐Ÿท.
    
    ๐Ÿ“ฅ **FastAPI** ๐Ÿ† ๐Ÿšซ ๐Ÿคš ๐Ÿ˜จ โ†ฉ๏ธ ๐Ÿ‘† โš™๏ธ `Depends`.
    
    ///
    
    /// check
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/security/get-current-user.md

    {!../../docs_src/security/tutorial002.py!}
    ```
    
    ## ๆณจๅ…ฅๅฝ“ๅ‰็”จๆˆท
    
    ๅœจ*่ทฏๅพ„ๆ“ไฝœ* ็š„ `Depends` ไธญไฝฟ็”จ `get_current_user`๏ผš
    
    ```Python hl_lines="31"
    {!../../docs_src/security/tutorial002.py!}
    ```
    
    ๆณจๆ„๏ผŒๆญคๅค„ๆŠŠ `current_user` ็š„็ฑปๅž‹ๅฃฐๆ˜Žไธบ Pydantic ็š„ `User` ๆจกๅž‹ใ€‚
    
    ่ฟ™ๆœ‰ๅŠฉไบŽๅœจๅ‡ฝๆ•ฐๅ†…้ƒจไฝฟ็”จไปฃ็ ่กฅๅ…จๅ’Œ็ฑปๅž‹ๆฃ€ๆŸฅใ€‚
    
    /// tip | "ๆ็คบ"
    
    ่ฟ˜่ฎฐๅพ—่ฏทๆฑ‚ไฝ“ไนŸๆ˜ฏไฝฟ็”จ Pydantic ๆจกๅž‹ๅฃฐๆ˜Ž็š„ๅงใ€‚
    
    ๆ”พๅฟƒ๏ผŒๅ› ไธบไฝฟ็”จไบ† `Depends`๏ผŒ**FastAPI** ไธไผšๆžๆททใ€‚
    
    ///
    
    /// check | "ๆฃ€ๆŸฅ"
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  7. docs/em/docs/tutorial/security/simple-oauth2.md

    ๐Ÿ‘‰ ๐Ÿ•ณ ๐Ÿ‘ˆ ๐Ÿ‘† โœ”๏ธ ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ“Ÿ, & โš’ ๐Ÿ’ญ ๐Ÿ‘† โš™๏ธ ๐Ÿ“š ๐ŸŽป ๐Ÿ”‘.
    
    โšซ๏ธ ๐ŸŒ– ๐Ÿ•ด ๐Ÿ‘œ ๐Ÿ‘ˆ ๐Ÿ‘† โœ”๏ธ ๐Ÿ’ญ โ˜‘ ๐Ÿ‘†, ๐Ÿ› ๏ธ โฎ๏ธ ๐Ÿ”ง.
    
    ๐ŸŽ‚, **FastAPI** ๐Ÿต โšซ๏ธ ๐Ÿ‘†.
    
    ///
    
    ## โ„น ๐Ÿ”—
    
    ๐Ÿ”œ ๐Ÿ‘ฅ ๐Ÿ”œ โ„น ๐Ÿ‘† ๐Ÿ”—.
    
    ๐Ÿ‘ฅ ๐Ÿ’š ๐Ÿคš `current_user` *๐Ÿ•ด* ๐Ÿšฅ ๐Ÿ‘‰ ๐Ÿ‘ฉโ€๐Ÿ’ป ๐Ÿฆ.
    
    , ๐Ÿ‘ฅ โœ ๐ŸŒ– ๐Ÿ”— `get_current_active_user` ๐Ÿ‘ˆ ๐Ÿ”„ โš™๏ธ `get_current_user` ๐Ÿ”—.
    
    ๐Ÿ‘ฏโ€โ™‚๏ธ ๐Ÿ‘‰ ๐Ÿ”— ๐Ÿ”œ ๐Ÿ“จ ๐Ÿ‡บ๐Ÿ‡ธ๐Ÿ” โŒ ๐Ÿšฅ ๐Ÿ‘ฉโ€๐Ÿ’ป ๐Ÿšซ ๐Ÿ”€, โš–๏ธ ๐Ÿšฅ ๐Ÿ”•.
    
    , ๐Ÿ‘† ๐Ÿ”—, ๐Ÿ‘ฅ ๐Ÿ”œ ๐Ÿ•ด ๐Ÿคš ๐Ÿ‘ฉโ€๐Ÿ’ป ๐Ÿšฅ ๐Ÿ‘ฉโ€๐Ÿ’ป ๐Ÿ”€, โ˜‘ ๐Ÿ”“, & ๐Ÿฆ:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 8.8K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/security/simple-oauth2.md

    For the rest, **FastAPI** handles it for you.
    
    ///
    
    ## Update the dependencies
    
    Now we are going to update our dependencies.
    
    We want to get the `current_user` *only* if this user is active.
    
    So, we create an additional dependency `get_current_active_user` that in turn uses `get_current_user` as a dependency.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 12.3K bytes
    - Viewed (0)
  9. docs/de/docs/tutorial/security/simple-oauth2.md

    Den Rest erledigt **FastAPI** fรผr Sie.
    
    ///
    
    ## Die Abhรคngigkeiten aktualisieren
    
    Jetzt werden wir unsere Abhรคngigkeiten aktualisieren.
    
    Wir mรถchten den `current_user` *nur* erhalten, wenn dieser Benutzer aktiv ist.
    
    Daher erstellen wir eine zusรคtzliche Abhรคngigkeit `get_current_active_user`, die wiederum `get_current_user` als Abhรคngigkeit verwendet.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  10. docs/de/docs/tutorial/security/get-current-user.md

    Bevorzugen Sie die `Annotated`-Version, falls mรถglich.
    
    ///
    
    ```Python hl_lines="31"
    {!> ../../docs_src/security/tutorial002.py!}
    ```
    
    ////
    
    Beachten Sie, dass wir als Typ von `current_user` das Pydantic-Modell `User` deklarieren.
    
    Das wird uns innerhalb der Funktion bei Codevervollstรคndigung und Typprรผfungen helfen.
    
    /// tip | "Tipp"
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 8.3K bytes
    - Viewed (0)
Back to top