Documentation
¶
Index ¶
- type APIKeyAuth
- type APIKeyCheck
- type APIKeyLogin
- type AuthCheck
- type AuthContext
- type AuthEvent
- type AuthEventType
- type AuthInfoLink
- type AuthInteraction
- type AuthPrompt
- type AuthResult
- type AuthType
- type Credential
- type CredentialInfo
- type CredentialStore
- type CredentialType
- type EnvAPIKeyAuth
- type EnvironmentContext
- type Error
- type ErrorCode
- type MemoryStore
- func (store *MemoryStore) Delete(_ context.Context, provider string) error
- func (store *MemoryStore) List(_ context.Context) ([]CredentialInfo, error)
- func (store *MemoryStore) Modify(_ context.Context, provider string, modify ModifyFunc) (*Credential, error)
- func (store *MemoryStore) Read(_ context.Context, provider string) (*Credential, error)
- type ModelAuth
- type ModifyFunc
- type OAuth
- type OAuthLoginLabel
- type PromptOption
- type PromptType
- type ProviderAuth
- type ResolutionOverrides
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKeyAuth ¶
type APIKeyAuth interface {
Name() string
Resolve(context.Context, AuthContext, *Credential) (*AuthResult, error)
}
type APIKeyCheck ¶
type APIKeyCheck interface {
Check(context.Context, AuthContext, *Credential) (*AuthCheck, error)
}
type APIKeyLogin ¶
type APIKeyLogin interface {
Login(context.Context, AuthInteraction) (*Credential, error)
}
type AuthCheck ¶
type AuthCheck struct {
Source string `json:"source,omitempty"`
Type CredentialType `json:"type"`
}
type AuthContext ¶
type AuthEvent ¶
type AuthEvent struct {
Type AuthEventType
Message string
Links []AuthInfoLink
URL string
Instructions string
UserCode string
VerificationURI string
IntervalSeconds int
ExpiresInSeconds int
}
type AuthEventType ¶
type AuthEventType string
const ( EventInfo AuthEventType = "info" EventAuthURL AuthEventType = "auth_url" EventDeviceCode AuthEventType = "device_code" EventProgress AuthEventType = "progress" )
type AuthInfoLink ¶
type AuthInteraction ¶
type AuthPrompt ¶
type AuthPrompt struct {
Type PromptType
Message string
Placeholder string
Options []PromptOption
}
type AuthResult ¶
type AuthResult struct {
Auth ModelAuth `json:"auth"`
Env map[string]string `json:"env,omitempty"`
Source string `json:"source,omitempty"`
}
func ResolveProviderAuth ¶
func ResolveProviderAuth( ctx context.Context, providerID string, methods ProviderAuth, credentials CredentialStore, authContext AuthContext, overrides *ResolutionOverrides, ) (*AuthResult, error)
type Credential ¶
type Credential struct {
Type CredentialType
Key *string
Env map[string]string
Refresh string
Access string
Expires int64
Extra map[string]json.RawMessage
// contains filtered or unexported fields
}
Credential retains unknown fields because auth.json is shared with TS pi and later provider OAuth flows attach provider-specific token metadata.
func APIKeyCredential ¶
func APIKeyCredential(key string) *Credential
func APIKeyEnvCredential ¶
func APIKeyEnvCredential(env map[string]string, envOrder ...string) *Credential
func OAuthCredential ¶
func OAuthCredential(refresh, access string, expires int64) *Credential
func OAuthCredentialAccessFirst ¶
func OAuthCredentialAccessFirst(access, refresh string, expires int64) *Credential
OAuthCredentialAccessFirst preserves the property insertion order used by providers whose upstream credential literals place access before refresh.
func (*Credential) Clone ¶
func (credential *Credential) Clone() *Credential
func (Credential) MarshalJSON ¶
func (credential Credential) MarshalJSON() ([]byte, error)
func (*Credential) SetExtra ¶
func (credential *Credential) SetExtra(name string, value json.RawMessage)
func (*Credential) UnmarshalJSON ¶
func (credential *Credential) UnmarshalJSON(data []byte) error
type CredentialInfo ¶
type CredentialInfo struct {
ProviderID string
Type CredentialType
}
type CredentialStore ¶
type CredentialStore interface {
Read(context.Context, string) (*Credential, error)
List(context.Context) ([]CredentialInfo, error)
Modify(context.Context, string, ModifyFunc) (*Credential, error)
Delete(context.Context, string) error
}
CredentialStore is the upstream seam that lets applications own persistence.
type CredentialType ¶
type CredentialType string
const ( CredentialAPIKey CredentialType = "api_key" CredentialOAuth CredentialType = "oauth" )
type EnvAPIKeyAuth ¶
func (EnvAPIKeyAuth) Login ¶
func (method EnvAPIKeyAuth) Login(ctx context.Context, interaction AuthInteraction) (*Credential, error)
func (EnvAPIKeyAuth) Name ¶
func (method EnvAPIKeyAuth) Name() string
func (EnvAPIKeyAuth) Resolve ¶
func (method EnvAPIKeyAuth) Resolve( ctx context.Context, authContext AuthContext, credential *Credential, ) (*AuthResult, error)
type EnvironmentContext ¶
type EnvironmentContext struct{}
func (EnvironmentContext) FileExists ¶
func (EnvironmentContext) FileExists(_ context.Context, path string) bool
type Error ¶
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore(initial map[string]*Credential) *MemoryStore
func (*MemoryStore) Delete ¶
func (store *MemoryStore) Delete(_ context.Context, provider string) error
func (*MemoryStore) List ¶
func (store *MemoryStore) List(_ context.Context) ([]CredentialInfo, error)
func (*MemoryStore) Modify ¶
func (store *MemoryStore) Modify(_ context.Context, provider string, modify ModifyFunc) (*Credential, error)
func (*MemoryStore) Read ¶
func (store *MemoryStore) Read(_ context.Context, provider string) (*Credential, error)
type ModifyFunc ¶
type ModifyFunc func(current *Credential) (*Credential, error)
type OAuth ¶
type OAuth interface {
Name() string
Login(context.Context, AuthInteraction) (*Credential, error)
Refresh(context.Context, *Credential) (*Credential, error)
ToAuth(*Credential) (ModelAuth, error)
}
type OAuthLoginLabel ¶
type OAuthLoginLabel interface {
LoginLabel() string
}
type PromptOption ¶
type PromptType ¶
type PromptType string
const ( PromptText PromptType = "text" PromptSecret PromptType = "secret" PromptSelect PromptType = "select" PromptManualCode PromptType = "manual_code" )
type ProviderAuth ¶
type ProviderAuth struct {
APIKey APIKeyAuth
OAuth OAuth
}
Click to show internal directories.
Click to hide internal directories.