Skip to content

ccproxy.auth.manager

ccproxy.auth.manager

Unified authentication manager interface for all providers.

AuthManager

Bases: Protocol

Unified authentication manager protocol for all providers.

This protocol defines the complete interface that all authentication managers must implement, supporting both provider-specific methods (like Claude credentials) and generic methods (like auth headers) for maximum flexibility.

get_access_token async

get_access_token()

Get valid access token.

Returns:

Type Description
str

Access token string

Raises:

Type Description
AuthenticationError

If authentication fails

Source code in ccproxy/auth/manager.py
async def get_access_token(self) -> str:
    """Get valid access token.

    Returns:
        Access token string

    Raises:
        AuthenticationError: If authentication fails
    """
    ...

get_credentials async

get_credentials()

Get valid credentials.

Note: For non-Claude providers, this may return minimal/dummy credentials or raise AuthenticationError if not supported.

Returns:

Type Description
BaseCredentials

Valid credentials

Raises:

Type Description
AuthenticationError

If authentication fails or not supported

Source code in ccproxy/auth/manager.py
async def get_credentials(self) -> BaseCredentials:
    """Get valid credentials.

    Note: For non-Claude providers, this may return minimal/dummy credentials
    or raise AuthenticationError if not supported.

    Returns:
        Valid credentials

    Raises:
        AuthenticationError: If authentication fails or not supported
    """
    ...

is_authenticated async

is_authenticated()

Check if current authentication is valid.

Returns:

Type Description
bool

True if authenticated, False otherwise

Source code in ccproxy/auth/manager.py
async def is_authenticated(self) -> bool:
    """Check if current authentication is valid.

    Returns:
        True if authenticated, False otherwise
    """
    ...

get_user_profile async

get_user_profile()

Get standardized user profile information.

Returns:

Type Description
StandardProfileFields | None

Standardized profile details when available, otherwise None

StandardProfileFields | None

for providers that do not expose profile metadata.

Source code in ccproxy/auth/manager.py
async def get_user_profile(self) -> StandardProfileFields | None:
    """Get standardized user profile information.

    Returns:
        Standardized profile details when available, otherwise ``None``
        for providers that do not expose profile metadata.
    """
    ...

validate_credentials async

validate_credentials()

Validate that credentials are available and valid.

Returns:

Type Description
bool

True if credentials are valid, False otherwise

Source code in ccproxy/auth/manager.py
async def validate_credentials(self) -> bool:
    """Validate that credentials are available and valid.

    Returns:
        True if credentials are valid, False otherwise
    """
    ...

get_provider_name

get_provider_name()

Get the provider name for logging.

Returns:

Type Description
str

Provider name string (e.g., "anthropic-claude", "openai-codex")

Source code in ccproxy/auth/manager.py
def get_provider_name(self) -> str:
    """Get the provider name for logging.

    Returns:
        Provider name string (e.g., "anthropic-claude", "openai-codex")
    """
    ...