Documentation
¶
Overview ¶
Package auth provides functionality for managing authentication credentials.
Index ¶
- func DefaultStorePath() (string, error)
- type FileSystem
- type Manager
- func (m *Manager) All() (map[string]domain.Credential, error)
- func (m *Manager) Get(providerID string) (*domain.Credential, error)
- func (m *Manager) GetWithFallback(p domain.Provider) (*domain.Credential, error)
- func (m *Manager) Remove(providerID string) error
- func (m *Manager) Set(providerID string, cred domain.Credential) error
- type OAuthManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultStorePath ¶
DefaultStorePath returns the standard ~/.config/autocmd/auth.json path.
Types ¶
type FileSystem ¶
type FileSystem interface {
ReadFile(name string) ([]byte, error)
WriteFile(name string, data []byte, perm os.FileMode) error
MkdirAll(path string, perm os.FileMode) error
}
FileSystem abstracts filesystem operations for the auth package.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles persistent storage of authentication credentials.
func NewManager ¶
func NewManager(fs FileSystem, storePath string) *Manager
NewManager creates a new Manager with the given filesystem and storage path.
func (*Manager) All ¶
func (m *Manager) All() (map[string]domain.Credential, error)
All returns all stored credentials.
func (*Manager) Get ¶
func (m *Manager) Get(providerID string) (*domain.Credential, error)
Get returns the credential for the given provider.
func (*Manager) GetWithFallback ¶
GetWithFallback returns the credential for the given provider, prioritizing stored credentials over environment variable fallbacks.
type OAuthManager ¶
type OAuthManager struct {
// contains filtered or unexported fields
}
OAuthManager handles the RFC 8628 Device Authorization Flow.
func NewOAuthManager ¶
func NewOAuthManager(client *http.Client) *OAuthManager
NewOAuthManager creates a new OAuth manager.
func (*OAuthManager) RunDeviceFlow ¶
func (m *OAuthManager) RunDeviceFlow(ctx context.Context, cfg domain.OAuthMethod, onCode func(uri string, code string)) (string, error)
RunDeviceFlow executes the polling flow based on a logicless OAuthMethod descriptor.