Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 58 for shapes (0.14 sec)

  1. docs_src/security/tutorial005_an.py

                raise credentials_exception
            token_scopes = payload.get("scopes", [])
            token_data = TokenData(scopes=token_scopes, username=username)
        except (JWTError, ValidationError):
            raise credentials_exception
        user = get_user(fake_users_db, username=token_data.username)
        if user is None:
            raise credentials_exception
        for scope in security_scopes.scopes:
            if scope not in token_data.scopes:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/bigger-applications.md

    Now, let's imagine your organization gave you the `app/internal/admin.py` file.
    
    It contains an `APIRouter` with some admin *path operations* that your organization shares between several projects.
    
    For this example it will be super simple. But let's say that because it is shared with other projects in the organization, we cannot modify it and add a `prefix`, `dependencies`, `tags`, etc. directly to the `APIRouter`:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  3. tests/test_security_oauth2_optional.py

    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"},
            }
        },
        auto_error=False,
    )
    
    
    class User(BaseModel):
        username: str
    
    
    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)
  4. docs/en/docs/tutorial/security/oauth2-jwt.md

    <img src="/img/tutorial/security/image10.png">
    
    !!! note
        Notice the header `Authorization`, with a value that starts with `Bearer `.
    
    ## Advanced usage with `scopes`
    
    OAuth2 has the notion of "scopes".
    
    You can use them to add a specific set of permissions to a JWT token.
    
    Then you can give this token to a user directly or a third party, to interact with your API with a set of restrictions.
    
    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)
  5. docs/zh/docs/tutorial/security/simple-oauth2.md

        但由于这种用例很常见,FastAPI 为了简便,就直接提供了对它的支持。
    
    ### 使用表单数据
    
    !!! tip "提示"
    
        `OAuth2PasswordRequestForm` 类依赖项的实例没有以空格分隔的长字符串属性 `scope`,但它支持 `scopes` 属性,由已发送的 scope 字符串列表组成。
    
        本例没有使用 `scopes`,但开发者也可以根据需要使用该属性。
    
    现在,即可使用表单字段 `username`,从(伪)数据库中获取用户数据。
    
    如果不存在指定用户,则返回错误消息,提示**用户名或密码错误**。
    
    本例使用 `HTTPException` 异常显示此错误:
    
    ```Python hl_lines="3  77-79"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 8.8K bytes
    - Viewed (0)
  6. docs/em/docs/tutorial/security/simple-oauth2.md

        ✋️ ⚫️ ⚠ ⚙️ 💼, ⚫️ 🚚 **FastAPI** 🔗, ⚒ ⚫️ ⏩.
    
    ### ⚙️ 📨 💽
    
    !!! tip
        👐 🔗 🎓 `OAuth2PasswordRequestForm` 🏆 🚫 ✔️ 🔢 `scope` ⏮️ 📏 🎻 👽 🚀, ↩️, ⚫️ 🔜 ✔️ `scopes` 🔢 ⏮️ ☑ 📇 🎻 🔠 ↔ 📨.
    
        👥 🚫 ⚙️ `scopes` 👉 🖼, ✋️ 🛠️ 📤 🚥 👆 💪 ⚫️.
    
    🔜, 🤚 👩‍💻 📊 ⚪️➡️ (❌) 💽, ⚙️ `username` ⚪️➡️ 📨 🏑.
    
    🚥 📤 🙅‍♂ ✅ 👩‍💻, 👥 📨 ❌ 💬 "❌ 🆔 ⚖️ 🔐".
    
    ❌, 👥 ⚙️ ⚠ `HTTPException`:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 8.9K bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/bigger-applications.md

        * 如果你还在一个具体的*路径操作*中声明了依赖项,**它们也会被执行**。
        * 路由器的依赖项最先执行,然后是[装饰器中的 `dependencies`](dependencies/dependencies-in-path-operation-decorators.md){.internal-link target=_blank},再然后是普通的参数依赖项。
        * 你还可以添加[具有 `scopes` 的 `Security` 依赖项](../advanced/security/oauth2-scopes.md){.internal-link target=_blank}。
    
    !!! tip
        在 `APIRouter`中具有 `dependencies` 可以用来,例如,对一整组的*路径操作*要求身份认证。即使这些依赖项并没有分别添加到每个路径操作中。
    
    !!! check
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.5K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_security/test_tutorial005_py39.py

                "securitySchemes": {
                    "OAuth2PasswordBearer": {
                        "type": "oauth2",
                        "flows": {
                            "password": {
                                "scopes": {
                                    "me": "Read information about the current user.",
                                    "items": "Read items.",
                                },
                                "tokenUrl": "token",
    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)
  9. docs/en/docs/python-types.md

    ## Pydantic models
    
    <a href="https://docs.pydantic.dev/" class="external-link" target="_blank">Pydantic</a> is a Python library to perform data validation.
    
    You declare the "shape" of the data as classes with attributes.
    
    And each attribute has a type.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 17K bytes
    - Viewed (0)
  10. docs/ja/docs/tutorial/security/oauth2-jwt.md

    開発者ツールを開くと、送信されるデータにはトークンだけが含まれており、パスワードはユーザーを認証してアクセストークンを取得する最初のリクエストでのみ送信され、その後は送信されないことがわかります。
    
    <img src="/img/tutorial/security/image10.png">
    
    !!! note "備考"
        ヘッダーの`Authorization`には、`Bearer`で始まる値があります。
    
    ## `scopes` を使った高度なユースケース
    
    OAuth2には、「スコープ」という概念があります。
    
    これらを利用して、JWTトークンに特定の権限セットを追加することができます。
    
    そして、このトークンをユーザーに直接、または第三者に与えて、制限付きでAPIを操作できます。
    
    これらの使用方法や**FastAPI**への統合方法については、**高度なユーザーガイド**で後ほど説明します。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 21:21:35 GMT 2024
    - 14.1K bytes
    - Viewed (0)
Back to top