ccproxy.auth.oauth.protocol¶
ccproxy.auth.oauth.protocol
¶
OAuth protocol definitions for plugin OAuth implementations.
This module defines the protocols and interfaces that plugins must implement to provide OAuth authentication capabilities.
StandardProfileFields
¶
ProfileLoggingMixin
¶
Mixin to provide standardized profile dump logging for OAuth providers.
get_standard_profile
async
¶
Return standardized profile fields for UI display.
If credentials are not provided, attempts to load them via a
provider's load_credentials() method when available. This method
intentionally avoids network calls and relies on locally available
information or cached profile data inside provider implementations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
credentials
|
Any | None
|
Optional provider-specific credentials |
None
|
Returns:
| Type | Description |
|---|---|
StandardProfileFields | None
|
StandardProfileFields or None if unavailable |
Source code in ccproxy/auth/oauth/protocol.py
OAuthStorageProtocol
¶
Bases: Protocol
Protocol for OAuth token storage implementations.
save_tokens
async
¶
Save OAuth tokens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Provider name |
required |
access_token
|
str
|
Access token |
required |
refresh_token
|
str | None
|
Optional refresh token |
None
|
expires_in
|
int | None
|
Token expiration in seconds |
None
|
**kwargs
|
Any
|
Additional provider-specific data |
{}
|
Source code in ccproxy/auth/oauth/protocol.py
get_tokens
async
¶
delete_tokens
async
¶
Delete stored tokens for a provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Provider name |
required |
OAuthConfigProtocol
¶
OAuthProviderBase
¶
Bases: Protocol
Extended protocol for OAuth providers with additional capabilities.
requires_client_secret
property
¶
Whether this provider requires a client secret.
get_authorization_url
async
¶
handle_callback
async
¶
refresh_access_token
async
¶
revoke_token
async
¶
validate_token
async
¶
get_user_info
async
¶
get_storage
¶
Get storage implementation for this provider.
Returns:
| Type | Description |
|---|---|
OAuthStorageProtocol | None
|
Storage implementation or None if provider handles storage |
get_config
¶
Get configuration for this provider.
Returns:
| Type | Description |
|---|---|
OAuthConfigProtocol | None
|
Configuration implementation or None |