Home / Function/ process_auth() — fastapi Function Reference

process_auth() — fastapi Function Reference

Architecture documentation for the process_auth() function in test_dependency_paramless.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  47731406_45a3_cf34_1fe9_542ab76043af["process_auth()"]
  d2d88355_3702_eb8f_f242_b3e87e712831["test_dependency_paramless.py"]
  47731406_45a3_cf34_1fe9_542ab76043af -->|defined in| d2d88355_3702_eb8f_f242_b3e87e712831
  style 47731406_45a3_cf34_1fe9_542ab76043af fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_dependency_paramless.py lines 15–25

def process_auth(
    credentials: Annotated[Union[str, None], Security(oauth2_scheme)],
    security_scopes: SecurityScopes,
):
    # This is an incorrect way of using it, this is not checking if the scopes are
    # provided by the token, only if the endpoint is requesting them, but the test
    # here is just to check if FastAPI is indeed registering and passing the scopes
    # correctly when using Security with parameterless dependencies.
    if "a" not in security_scopes.scopes or "b" not in security_scopes.scopes:
        raise HTTPException(detail="a or b not in scopes", status_code=401)
    return {"token": credentials, "scopes": security_scopes.scopes}

Domain

Subdomains

Frequently Asked Questions

What does process_auth() do?
process_auth() is a function in the fastapi codebase, defined in tests/test_dependency_paramless.py.
Where is process_auth() defined?
process_auth() is defined in tests/test_dependency_paramless.py at line 15.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free