(
credentials: Annotated[str | None, Security(oauth2_scheme)],
security_scopes: SecurityScopes,
)
| 13 | |
| 14 | |
| 15 | def process_auth( |
| 16 | credentials: Annotated[str | None, Security(oauth2_scheme)], |
| 17 | security_scopes: SecurityScopes, |
| 18 | ): |
| 19 | # This is an incorrect way of using it, this is not checking if the scopes are |
| 20 | # provided by the token, only if the endpoint is requesting them, but the test |
| 21 | # here is just to check if FastAPI is indeed registering and passing the scopes |
| 22 | # correctly when using Security with parameterless dependencies. |
| 23 | if "a" not in security_scopes.scopes or "b" not in security_scopes.scopes: |
| 24 | raise HTTPException(detail="a or b not in scopes", status_code=401) |
| 25 | return {"token": credentials, "scopes": security_scopes.scopes} |
| 26 | |
| 27 | |
| 28 | @app.get("/get-credentials") |
nothing calls this directly
no test coverage detected
searching dependent graphs…