Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 137 for security (0.16 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. fastapi/openapi/utils.py

            )
            security_name = security_requirement.security_scheme.scheme_name
            security_definitions[security_name] = security_definition
            operation_security.append({security_name: security_requirement.scopes})
        return security_definitions, operation_security
    
    
    def get_openapi_operation_parameters(
        *,
        all_route_params: Sequence[ModelField],
        schema_generator: GenerateJsonSchema,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 21.8K bytes
    - Viewed (0)
  5. fastapi/dependencies/utils.py

        dependency: Callable[..., Any],
        path: str,
        name: Optional[str] = None,
        security_scopes: Optional[List[str]] = None,
    ) -> Dependant:
        security_requirement = None
        security_scopes = security_scopes or []
        if isinstance(depends, params.Security):
            dependency_scopes = depends.scopes
            security_scopes.extend(dependency_scopes)
        if isinstance(dependency, SecurityBase):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  6. docs/de/docs/tutorial/security/first-steps.md

        ```Python
        {!> ../../../docs_src/security/tutorial001_an_py39.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python
        {!> ../../../docs_src/security/tutorial001_an.py!}
        ```
    
    === "Python 3.8+ nicht annotiert"
    
        !!! tip "Tipp"
            Bevorzugen Sie die `Annotated`-Version, falls möglich.
    
        ```Python
        {!> ../../../docs_src/security/tutorial001.py!}
        ```
    
    ## Ausführen
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 18:07:08 GMT 2024
    - 10.3K bytes
    - Viewed (0)
  7. 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)
  8. docs/de/docs/advanced/security/oauth2-scopes.md

                        * Einen `security_scopes`-Parameter vom Typ `SecurityScopes`:
                            * Dieser `security_scopes`-Parameter hat ein Attribut `scopes` mit einer `list`e, die alle oben deklarierten Scopes enthält, sprich:
                                * `security_scopes.scopes` enthält `["me", "items"]` für die *Pfadoperation* `read_own_items`.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 20:26:08 GMT 2024
    - 22.8K bytes
    - Viewed (0)
  9. docs/zh/docs/advanced/security/oauth2-scopes.md

    ```Python hl_lines="153"
    {!../../../docs_src/security/tutorial005.py!}
    ```
    
    ## 在*路径操作*与依赖项中声明作用域
    
    接下来,为*路径操作*  `/users/me/items/` 声明作用域 `items`。
    
    为此,要从 `fastapi` 中导入并使用 `Security` 。
    
    `Security` 声明依赖项的方式和 `Depends` 一样,但 `Security` 还能接收作用域(字符串)列表类型的参数 `scopes`。
    
    此处使用与 `Depends` 相同的方式,把依赖项函数 `get_current_active_user` 传递给 `Security`。
    
    同时,还传递了作用域**列表**,本例中只传递了一个作用域:`items`(此处支持传递更多作用域)。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 22:43:35 GMT 2024
    - 11.8K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/security/simple-oauth2.md

    === "Python 3.10+"
    
        ```Python hl_lines="4  78"
        {!> ../../../docs_src/security/tutorial003_an_py310.py!}
        ```
    
    === "Python 3.9+"
    
        ```Python hl_lines="4  78"
        {!> ../../../docs_src/security/tutorial003_an_py39.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="4  79"
        {!> ../../../docs_src/security/tutorial003_an.py!}
        ```
    
    === "Python 3.10+ non-Annotated"
    
        !!! tip
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 12.5K bytes
    - Viewed (0)
Back to top