authenticator

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package authenticator provides concrete Authenticator implementations for CLI login flows.

Package authenticator provides concrete Authenticator implementations for CLI login flows.

Package authenticator provides concrete Authenticator implementations for CLI login flows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClaudeAuthenticator

func NewClaudeAuthenticator() (cliauth.Authenticator, error)

NewClaudeAuthenticator creates a ClaudeAuthenticator with default settings.

func NewCodexAuthenticator

func NewCodexAuthenticator() (cliauth.Authenticator, error)

NewCodexAuthenticator creates a CodexAuthenticator with default settings.

func NewGeminiAuthenticator

func NewGeminiAuthenticator() (cliauth.Authenticator, error)

NewGeminiAuthenticator creates a GeminiAuthenticator with default settings.

Types

type AuthErrorCode

type AuthErrorCode string

AuthErrorCode identifies the category of a login-flow error.

const (
	ErrPortInUse          AuthErrorCode = "port_in_use"
	ErrServerStartFailed  AuthErrorCode = "server_start_failed"
	ErrCallbackTimeout    AuthErrorCode = "callback_timeout"
	ErrInvalidState       AuthErrorCode = "invalid_state"
	ErrCodeExchangeFailed AuthErrorCode = "code_exchange_failed"
)

type AuthenticationError

type AuthenticationError struct {
	Code    AuthErrorCode
	Wrapped error
}

AuthenticationError carries a typed error code alongside the underlying cause.

func (*AuthenticationError) Error

func (e *AuthenticationError) Error() string

func (*AuthenticationError) Unwrap

func (e *AuthenticationError) Unwrap() error

type ClaudeAuthenticator

type ClaudeAuthenticator struct {
	cliauth.AuthenticatorConfig
	// HTTPClient is the HTTP client used for token requests. If nil, http.DefaultClient is used.
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

ClaudeAuthenticator implements manager.Authenticator for the Anthropic Claude Code CLI login flow. It uses browser-based OAuth PKCE authentication against the Anthropic OAuth endpoints.

func (*ClaudeAuthenticator) GetConfig

GetConfig returns the current runtime configuration for the authenticator.

func (*ClaudeAuthenticator) Login

Login initiates the Claude Code CLI login flow and returns a new credential on success.

func (*ClaudeAuthenticator) Refresh

Refresh refreshes the credential's access token before it expires. Returns nil if no refresh token is present.

func (*ClaudeAuthenticator) RefreshLeadTime

func (a *ClaudeAuthenticator) RefreshLeadTime() *time.Duration

RefreshLeadTime returns how far in advance of token expiry to refresh Claude Code credentials.

func (*ClaudeAuthenticator) SetConfig

SetConfig applies runtime configuration to the authenticator.

type CodexAuthenticator

type CodexAuthenticator struct {
	cliauth.AuthenticatorConfig
	// contains filtered or unexported fields
}

CodexAuthenticator implements manager.Authenticator for the OpenAI Codex CLI login flow. It supports both browser-based OAuth PKCE and headless device flow authentication.

func (*CodexAuthenticator) GetConfig

GetConfig returns the current runtime configuration for the authenticator.

func (*CodexAuthenticator) Login

Login initiates the Codex CLI login flow and returns a new credential on success. It uses browser-based OAuth PKCE by default; set UseDeviceFlow for headless environments.

func (*CodexAuthenticator) Refresh

Refresh refreshes the credential's access token before it expires. Returns nil if no refresh token is present or the credential has no expiry metadata.

func (*CodexAuthenticator) RefreshLeadTime

func (a *CodexAuthenticator) RefreshLeadTime() *time.Duration

RefreshLeadTime returns how far in advance of token expiry to refresh Codex credentials. Five days gives ample runway for CLI tokens whose refresh window is typically 30 days.

func (*CodexAuthenticator) SetConfig

SetConfig applies runtime configuration to the authenticator.

type GeminiAuthenticator

type GeminiAuthenticator struct {
	cliauth.AuthenticatorConfig
	// HTTPClient is the HTTP client used for token requests. If nil, http.DefaultClient is used.
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

GeminiAuthenticator implements manager.Authenticator for the Google Gemini CLI login flow. It uses browser-based OAuth2 authentication against Google's OAuth endpoints.

func (*GeminiAuthenticator) GetConfig

GetConfig returns the current runtime configuration for the authenticator.

func (*GeminiAuthenticator) Login

Login initiates the Gemini CLI login flow and returns a new credential on success.

func (*GeminiAuthenticator) Refresh

Refresh refreshes the credential's access token before it expires. Returns nil if no refresh token is present.

func (*GeminiAuthenticator) RefreshLeadTime

func (a *GeminiAuthenticator) RefreshLeadTime() *time.Duration

RefreshLeadTime returns nil to disable provider-level background pre-refresh for Gemini.

func (*GeminiAuthenticator) SetConfig

SetConfig applies runtime configuration to the authenticator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL