Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 174 for cscopes (0.04 sec)

  1. tests/test_security_scopes_dont_propagate.py

    from fastapi.testclient import TestClient
    
    
    async def security1(scopes: SecurityScopes):
        return scopes.scopes
    
    
    async def security2(scopes: SecurityScopes):
        return scopes.scopes
    
    
    async def dep3(
        dep1: Annotated[list[str], Security(security1, scopes=["scope1"])],
        dep2: Annotated[list[str], Security(security2, scopes=["scope2"])],
    ):
        return {"dep1": dep1, "dep2": dep2}
    
    
    app = FastAPI()
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 973 bytes
    - Viewed (0)
  2. docs/pt/docs/advanced/security/oauth2-scopes.md

    ## Verifique os `scopes` { #verify-the-scopes }
    
    Nós verificamos agora que todos os escopos necessários, por essa dependência e todos os dependentes (incluindo as *operações de rota*) estão incluídas nos escopos fornecidos pelo token recebido, caso contrário, levantamos uma `HTTPException`.
    
    Para isso, nós utilizamos `security_scopes.scopes`, que contém uma `list` com todos esses escopos como uma `str`.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Nov 12 16:23:57 UTC 2025
    - 14.9K bytes
    - Viewed (0)
  3. docs/es/docs/advanced/security/oauth2-scopes.md

    ## Token JWT con scopes { #jwt-token-with-scopes }
    
    Ahora, modifica la *path operation* del token para devolver los scopes solicitados.
    
    Todavía estamos usando el mismo `OAuth2PasswordRequestForm`. Incluye una propiedad `scopes` con una `list` de `str`, con cada scope que recibió en el request.
    
    Y devolvemos los scopes como parte del token JWT.
    
    /// danger | Peligro
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 10:15:01 UTC 2025
    - 14.2K bytes
    - Viewed (0)
  4. docs/ru/docs/advanced/security/oauth2-scopes.md

    Для этого используем `security_scopes.scopes`, содержащий `list` со всеми этими scopes как `str`.
    
    {* ../../docs_src/security/tutorial005_an_py310.py hl[130:136] *}
    
    ## Дерево зависимостей и scopes { #dependency-tree-and-scopes }
    
    Ещё раз рассмотрим дерево зависимостей и scopes.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Sep 30 11:37:11 UTC 2025
    - 20.7K bytes
    - Viewed (0)
  5. fastapi/security/oauth2.py

            data = {}
            data["scopes"] = []
            for scope in form_data.scopes:
                data["scopes"].append(scope)
            if form_data.client_id:
                data["client_id"] = form_data.client_id
            if form_data.client_secret:
                data["client_secret"] = form_data.client_secret
            return data
        ```
    
        Note that for OAuth2 the scope `items:read` is a single scope in an opaque string.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 22K bytes
    - Viewed (0)
  6. docs_src/security/tutorial005_an_py310.py

        if user is None:
            raise credentials_exception
        for scope in security_scopes.scopes:
            if scope not in token_data.scopes:
                raise HTTPException(
                    status_code=status.HTTP_401_UNAUTHORIZED,
                    detail="Not enough permissions",
                    headers={"WWW-Authenticate": authenticate_value},
                )
        return user
    
    
    async def get_current_active_user(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 02:57:38 UTC 2025
    - 5.3K bytes
    - Viewed (0)
  7. docs_src/security/tutorial005_an_py39.py

        if user is None:
            raise credentials_exception
        for scope in security_scopes.scopes:
            if scope not in token_data.scopes:
                raise HTTPException(
                    status_code=status.HTTP_401_UNAUTHORIZED,
                    detail="Not enough permissions",
                    headers={"WWW-Authenticate": authenticate_value},
                )
        return user
    
    
    async def get_current_active_user(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 02:57:38 UTC 2025
    - 5.3K bytes
    - Viewed (0)
  8. docs_src/security/tutorial005_py39.py

        if user is None:
            raise credentials_exception
        for scope in security_scopes.scopes:
            if scope not in token_data.scopes:
                raise HTTPException(
                    status_code=status.HTTP_401_UNAUTHORIZED,
                    detail="Not enough permissions",
                    headers={"WWW-Authenticate": authenticate_value},
                )
        return user
    
    
    async def get_current_active_user(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 02:57:38 UTC 2025
    - 5.3K bytes
    - Viewed (0)
  9. docs_src/security/tutorial005_py310.py

        if user is None:
            raise credentials_exception
        for scope in security_scopes.scopes:
            if scope not in token_data.scopes:
                raise HTTPException(
                    status_code=status.HTTP_401_UNAUTHORIZED,
                    detail="Not enough permissions",
                    headers={"WWW-Authenticate": authenticate_value},
                )
        return user
    
    
    async def get_current_active_user(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 02:57:38 UTC 2025
    - 5.2K bytes
    - Viewed (0)
  10. fastapi/dependencies/models.py

        path: Optional[str] = None
        scope: Union[Literal["function", "request"], None] = None
    
        @cached_property
        def oauth_scopes(self) -> list[str]:
            scopes = self.parent_oauth_scopes.copy() if self.parent_oauth_scopes else []
            # This doesn't use a set to preserve order, just in case
            for scope in self.own_oauth_scopes or []:
                if scope not in scopes:
                    scopes.append(scope)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 7.1K bytes
    - Viewed (0)
Back to top