Home / Function/ get_current_user() — fastapi Function Reference

get_current_user() — fastapi Function Reference

Architecture documentation for the get_current_user() function in test_security_oauth2_optional.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  35ed54cf_954a_e74a_9728_a565375ab6f5["get_current_user()"]
  efcf9068_9c64_9327_7595_bfad37430bf7["test_security_oauth2_optional.py"]
  35ed54cf_954a_e74a_9728_a565375ab6f5 -->|defined in| efcf9068_9c64_9327_7595_bfad37430bf7
  style 35ed54cf_954a_e74a_9728_a565375ab6f5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_security_oauth2_optional.py lines 27–31

def get_current_user(oauth_header: Optional[str] = Security(reusable_oauth2)):
    if oauth_header is None:
        return None
    user = User(username=oauth_header)
    return user

Domain

Subdomains

Frequently Asked Questions

What does get_current_user() do?
get_current_user() is a function in the fastapi codebase, defined in tests/test_security_oauth2_optional.py.
Where is get_current_user() defined?
get_current_user() is defined in tests/test_security_oauth2_optional.py at line 27.

Analyze Your Own Codebase

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

Try Supermodel Free