Documentation
¶
Index ¶
- Variables
- func GetTokenStore() coreauth.Store
- func RegisterTokenStore(store coreauth.Store)
- type Authenticator
- type ClaudeAuthenticator
- type CodexAuthenticator
- type EmailRequiredError
- type FileTokenStore
- type GeminiAuthenticator
- type GeminiWebAuthenticator
- type IFlowAuthenticator
- type LoginOptions
- type Manager
- type ProjectSelectionError
- type QwenAuthenticator
Constants ¶
This section is empty.
Variables ¶
var ErrRefreshNotSupported = errors.New("cliproxy auth: refresh not supported")
Functions ¶
func GetTokenStore ¶
GetTokenStore returns the globally registered token store.
func RegisterTokenStore ¶
RegisterTokenStore sets the global token store used by the authentication helpers.
Types ¶
type Authenticator ¶
type Authenticator interface {
Provider() string
Login(ctx context.Context, cfg *config.Config, opts *LoginOptions) (*coreauth.Auth, error)
RefreshLead() *time.Duration
}
Authenticator manages login and optional refresh flows for a provider.
type ClaudeAuthenticator ¶
type ClaudeAuthenticator struct {
CallbackPort int
}
ClaudeAuthenticator implements the OAuth login flow for Anthropic Claude accounts.
func NewClaudeAuthenticator ¶
func NewClaudeAuthenticator() *ClaudeAuthenticator
NewClaudeAuthenticator constructs a Claude authenticator with default settings.
func (*ClaudeAuthenticator) Login ¶
func (a *ClaudeAuthenticator) Login(ctx context.Context, cfg *config.Config, opts *LoginOptions) (*coreauth.Auth, error)
func (*ClaudeAuthenticator) Provider ¶
func (a *ClaudeAuthenticator) Provider() string
func (*ClaudeAuthenticator) RefreshLead ¶
func (a *ClaudeAuthenticator) RefreshLead() *time.Duration
type CodexAuthenticator ¶
type CodexAuthenticator struct {
CallbackPort int
}
CodexAuthenticator implements the OAuth login flow for Codex accounts.
func NewCodexAuthenticator ¶
func NewCodexAuthenticator() *CodexAuthenticator
NewCodexAuthenticator constructs a Codex authenticator with default settings.
func (*CodexAuthenticator) Login ¶
func (a *CodexAuthenticator) Login(ctx context.Context, cfg *config.Config, opts *LoginOptions) (*coreauth.Auth, error)
func (*CodexAuthenticator) Provider ¶
func (a *CodexAuthenticator) Provider() string
func (*CodexAuthenticator) RefreshLead ¶
func (a *CodexAuthenticator) RefreshLead() *time.Duration
type EmailRequiredError ¶
type EmailRequiredError struct {
Prompt string
}
EmailRequiredError indicates that the calling context must provide an email or alias.
func (*EmailRequiredError) Error ¶
func (e *EmailRequiredError) Error() string
type FileTokenStore ¶
type FileTokenStore struct {
// contains filtered or unexported fields
}
FileTokenStore persists token records and auth metadata using the filesystem as backing storage.
func NewFileTokenStore ¶
func NewFileTokenStore() *FileTokenStore
NewFileTokenStore creates a token store that saves credentials to disk through the TokenStorage implementation embedded in the token record.
func (*FileTokenStore) Delete ¶
func (s *FileTokenStore) Delete(ctx context.Context, id string) error
Delete removes the auth file.
func (*FileTokenStore) List ¶
func (s *FileTokenStore) List(ctx context.Context) ([]*cliproxyauth.Auth, error)
List enumerates all auth JSON files under the configured directory.
func (*FileTokenStore) Save ¶
func (s *FileTokenStore) Save(ctx context.Context, auth *cliproxyauth.Auth) (string, error)
Save persists token storage and metadata to the resolved auth file path.
func (*FileTokenStore) SetBaseDir ¶
func (s *FileTokenStore) SetBaseDir(dir string)
SetBaseDir updates the default directory used for auth JSON persistence when no explicit path is provided.
type GeminiAuthenticator ¶
type GeminiAuthenticator struct{}
GeminiAuthenticator implements the login flow for Google Gemini CLI accounts.
func NewGeminiAuthenticator ¶
func NewGeminiAuthenticator() *GeminiAuthenticator
NewGeminiAuthenticator constructs a Gemini authenticator.
func (*GeminiAuthenticator) Login ¶
func (a *GeminiAuthenticator) Login(ctx context.Context, cfg *config.Config, opts *LoginOptions) (*coreauth.Auth, error)
func (*GeminiAuthenticator) Provider ¶
func (a *GeminiAuthenticator) Provider() string
func (*GeminiAuthenticator) RefreshLead ¶
func (a *GeminiAuthenticator) RefreshLead() *time.Duration
type GeminiWebAuthenticator ¶
type GeminiWebAuthenticator struct{}
GeminiWebAuthenticator provides a minimal wrapper so core components can treat Gemini Web credentials via the shared Authenticator contract.
func NewGeminiWebAuthenticator ¶
func NewGeminiWebAuthenticator() *GeminiWebAuthenticator
func (*GeminiWebAuthenticator) Login ¶
func (a *GeminiWebAuthenticator) Login(ctx context.Context, cfg *config.Config, opts *LoginOptions) (*coreauth.Auth, error)
func (*GeminiWebAuthenticator) Provider ¶
func (a *GeminiWebAuthenticator) Provider() string
func (*GeminiWebAuthenticator) RefreshLead ¶
func (a *GeminiWebAuthenticator) RefreshLead() *time.Duration
type IFlowAuthenticator ¶ added in v6.1.0
type IFlowAuthenticator struct{}
IFlowAuthenticator implements the OAuth login flow for iFlow accounts.
func NewIFlowAuthenticator ¶ added in v6.1.0
func NewIFlowAuthenticator() *IFlowAuthenticator
NewIFlowAuthenticator constructs a new authenticator instance.
func (*IFlowAuthenticator) Login ¶ added in v6.1.0
func (a *IFlowAuthenticator) Login(ctx context.Context, cfg *config.Config, opts *LoginOptions) (*coreauth.Auth, error)
Login performs the OAuth code flow using a local callback server.
func (*IFlowAuthenticator) Provider ¶ added in v6.1.0
func (a *IFlowAuthenticator) Provider() string
Provider returns the provider key for the authenticator.
func (*IFlowAuthenticator) RefreshLead ¶ added in v6.1.0
func (a *IFlowAuthenticator) RefreshLead() *time.Duration
RefreshLead indicates how soon before expiry a refresh should be attempted.
type LoginOptions ¶
type LoginOptions struct {
NoBrowser bool
ProjectID string
Metadata map[string]string
Prompt func(prompt string) (string, error)
}
LoginOptions captures generic knobs shared across authenticators. Provider-specific logic can inspect Metadata for extra parameters.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager aggregates authenticators and coordinates persistence via a token store.
func NewManager ¶
func NewManager(store coreauth.Store, authenticators ...Authenticator) *Manager
NewManager constructs a manager with the provided token store and authenticators. If store is nil, the caller must set it later using SetStore.
func (*Manager) Login ¶
func (m *Manager) Login(ctx context.Context, provider string, cfg *config.Config, opts *LoginOptions) (*coreauth.Auth, string, error)
Login executes the provider login flow and persists the resulting auth record.
func (*Manager) Register ¶
func (m *Manager) Register(a Authenticator)
Register adds or replaces an authenticator keyed by its provider identifier.
type ProjectSelectionError ¶
type ProjectSelectionError struct {
Email string
Projects []interfaces.GCPProjectProjects
}
ProjectSelectionError indicates that the user must choose a specific project ID.
func (*ProjectSelectionError) Error ¶
func (e *ProjectSelectionError) Error() string
func (*ProjectSelectionError) ProjectsDisplay ¶
func (e *ProjectSelectionError) ProjectsDisplay() []interfaces.GCPProjectProjects
ProjectsDisplay returns the projects list for caller presentation.
type QwenAuthenticator ¶
type QwenAuthenticator struct{}
QwenAuthenticator implements the device flow login for Qwen accounts.
func NewQwenAuthenticator ¶
func NewQwenAuthenticator() *QwenAuthenticator
NewQwenAuthenticator constructs a Qwen authenticator.
func (*QwenAuthenticator) Login ¶
func (a *QwenAuthenticator) Login(ctx context.Context, cfg *config.Config, opts *LoginOptions) (*coreauth.Auth, error)
func (*QwenAuthenticator) Provider ¶
func (a *QwenAuthenticator) Provider() string
func (*QwenAuthenticator) RefreshLead ¶
func (a *QwenAuthenticator) RefreshLead() *time.Duration