Skip to content

ccproxy.auth.models.base

ccproxy.auth.models.base

Base models for authentication across all providers.

BaseTokenInfo

Bases: BaseModel

Base model for token information across all providers.

This abstract base provides a common interface for token operations while allowing each provider to maintain its specific implementation.

expires_at_datetime property

expires_at_datetime

Get expiration as datetime object. Must be implemented by provider-specific subclasses.

refresh_token_value property

refresh_token_value

Get refresh token if available. Default returns None, override if provider supports refresh.

access_token_value

access_token_value()

Get the actual access token string. Must be implemented by provider-specific subclasses.

Source code in ccproxy/auth/models/base.py
@computed_field
def access_token_value(self) -> str:
    """Get the actual access token string.
    Must be implemented by provider-specific subclasses.
    """
    raise NotImplementedError

is_expired

is_expired()

Check if token is expired. Uses the expires_at_datetime property for comparison.

Source code in ccproxy/auth/models/base.py
@computed_field
def is_expired(self) -> bool:
    """Check if token is expired.
    Uses the expires_at_datetime property for comparison.
    """
    now = datetime.now(UTC)
    return now >= self.expires_at_datetime

BaseProfileInfo

Bases: BaseModel

Base model for user profile information across all providers.

Provides common fields with a flexible extras dict for provider-specific data.