Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 111 for scope3 (0.05 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/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)
  3. 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)
  4. 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)
  5. tests/test_dependency_yield_scope.py

        return StreamingResponse(iter_data())
    
    
    app.include_router(
        prefix="/router-scope-function",
        router=router,
        dependencies=[Depends(raise_after_yield, scope="function")],
    )
    
    app.include_router(
        prefix="/router-scope-request",
        router=router,
        dependencies=[Depends(raise_after_yield, scope="request")],
    )
    
    client = TestClient(app)
    
    
    def test_function_scope() -> None:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 6.7K bytes
    - Viewed (0)
  6. tests/test_dependency_yield_scope_websockets.py

    
    def test_broken_scope() -> None:
        with pytest.raises(
            FastAPIError,
            match='The dependency "get_named_func_session" has a scope of "request", it cannot depend on dependencies with scope "function"',
        ):
    
            @app.websocket("/broken-scope")
            async def get_broken(
                websocket: WebSocket, sessions: BrokenSessionsDep
            ) -> Any:  # pragma: no cover
                pass
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 6K bytes
    - Viewed (0)
  7. docs/es/docs/tutorial/security/simple-oauth2.md

    ### `scope` { #scope }
    
    La especificación también indica que el cliente puede enviar otro campo del formulario llamado "`scope`".
    
    El nombre del campo del formulario es `scope` (en singular), pero en realidad es un string largo con "scopes" separados por espacios.
    
    Cada "scope" es simplemente un string (sin espacios).
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 16 16:33:45 UTC 2025
    - 10.3K bytes
    - Viewed (0)
  8. tests/test_security_oauth2_optional.py

                            },
                            "username": {"title": "Username", "type": "string"},
                            "password": {"title": "Password", "type": "string"},
                            "scope": {"title": "Scope", "type": "string", "default": ""},
                            "client_id": {
                                "title": "Client Id",
                                "anyOf": [{"type": "string"}, {"type": "null"}],
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 8.9K bytes
    - Viewed (0)
  9. fastapi/dependencies/utils.py

        )
        own_oauth_scopes: list[str] = []
        if isinstance(depends, params.Security) and depends.scopes:
            own_oauth_scopes.extend(depends.scopes)
        return get_dependant(
            path=path,
            call=depends.dependency,
            scope=depends.scope,
            own_oauth_scopes=own_oauth_scopes,
        )
    
    
    def get_flat_dependant(
        dependant: Dependant,
        *,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 37.6K bytes
    - Viewed (3)
  10. tests/test_security_oauth2.py

                            },
                            "username": {"title": "Username", "type": "string"},
                            "password": {"title": "Password", "type": "string"},
                            "scope": {"title": "Scope", "type": "string", "default": ""},
                            "client_id": {
                                "title": "Client Id",
                                "anyOf": [{"type": "string"}, {"type": "null"}],
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 9K bytes
    - Viewed (0)
Back to top