Documentation
¶
Index ¶
- type GitTokenStore
- func (s *GitTokenStore) AuthDir() string
- func (s *GitTokenStore) BootstrapConfig(ctx context.Context, example string) (*config.Config, error)
- func (s *GitTokenStore) ConfigPath() string
- func (s *GitTokenStore) Delete(_ context.Context, id string) error
- func (s *GitTokenStore) EnsureRepository() error
- func (s *GitTokenStore) List(_ context.Context) ([]*cliproxyauth.Auth, error)
- func (s *GitTokenStore) PersistAuthFiles(_ context.Context, message string, paths ...string) error
- func (s *GitTokenStore) PersistConfig(ctx context.Context) error
- func (s *GitTokenStore) PersistPreparedConfig(ctx context.Context, prepared []byte) (string, error)
- func (s *GitTokenStore) RefreshClaim(ctx context.Context, key string) (claimed bool, errResult error)
- func (s *GitTokenStore) RefreshComplete(ctx context.Context, key string, receipt []byte) error
- func (s *GitTokenStore) RefreshRead(ctx context.Context, key string) (receipt []byte, errResult error)
- func (s *GitTokenStore) RefreshRelease(ctx context.Context, key string) error
- func (s *GitTokenStore) Save(ctx context.Context, auth *cliproxyauth.Auth) (string, error)
- func (s *GitTokenStore) SetBaseDir(dir string)
- func (s *GitTokenStore) SetOptionalConfig(optional bool)
- type ObjectStoreConfig
- type ObjectTokenStore
- func (s *ObjectTokenStore) AuthDir() string
- func (s *ObjectTokenStore) Bootstrap(ctx context.Context, exampleConfigPath string) error
- func (s *ObjectTokenStore) BootstrapConfig(ctx context.Context, exampleConfigPath string) (*config.Config, error)
- func (s *ObjectTokenStore) ConfigPath() string
- func (s *ObjectTokenStore) Delete(ctx context.Context, id string) error
- func (s *ObjectTokenStore) List(_ context.Context) ([]*cliproxyauth.Auth, error)
- func (s *ObjectTokenStore) PersistAuthFiles(ctx context.Context, _ string, paths ...string) error
- func (s *ObjectTokenStore) PersistConfig(ctx context.Context) error
- func (s *ObjectTokenStore) RefreshClaim(ctx context.Context, key string) (bool, error)
- func (s *ObjectTokenStore) RefreshComplete(ctx context.Context, key string, receipt []byte) error
- func (s *ObjectTokenStore) RefreshRead(ctx context.Context, key string) ([]byte, error)
- func (s *ObjectTokenStore) RefreshRelease(ctx context.Context, key string) error
- func (s *ObjectTokenStore) Save(ctx context.Context, auth *cliproxyauth.Auth) (string, error)
- func (s *ObjectTokenStore) SetBaseDir(string)
- type PostgresStore
- func (s *PostgresStore) AuthDir() string
- func (s *PostgresStore) Bootstrap(ctx context.Context, exampleConfigPath string) error
- func (s *PostgresStore) BootstrapConfig(ctx context.Context, exampleConfigPath string) (*config.Config, error)
- func (s *PostgresStore) Close() error
- func (s *PostgresStore) ConfigPath() string
- func (s *PostgresStore) CooldownStateStore() cliproxyauth.CooldownStateStore
- func (s *PostgresStore) Delete(ctx context.Context, id string) error
- func (s *PostgresStore) EnsureSchema(ctx context.Context) error
- func (s *PostgresStore) List(ctx context.Context) ([]*cliproxyauth.Auth, error)
- func (s *PostgresStore) PersistAuthFiles(ctx context.Context, _ string, paths ...string) error
- func (s *PostgresStore) PersistConfig(ctx context.Context) error
- func (s *PostgresStore) RefreshClaim(ctx context.Context, key string) (bool, error)
- func (s *PostgresStore) RefreshComplete(ctx context.Context, key string, receipt []byte) error
- func (s *PostgresStore) RefreshRead(ctx context.Context, key string) ([]byte, error)
- func (s *PostgresStore) RefreshRelease(ctx context.Context, key string) error
- func (s *PostgresStore) Save(ctx context.Context, auth *cliproxyauth.Auth) (string, error)
- func (s *PostgresStore) SetBaseDir(string)
- func (s *PostgresStore) WorkDir() string
- type PostgresStoreConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitTokenStore ¶
type GitTokenStore struct {
// contains filtered or unexported fields
}
GitTokenStore persists token records and auth metadata using git as the backing storage.
func NewGitTokenStore ¶
func NewGitTokenStore(remote, username, password, branch string) *GitTokenStore
NewGitTokenStore creates a token store that saves credentials to disk through the TokenStorage implementation embedded in the token record. When branch is non-empty, clone/pull/push operations target that branch instead of the remote default.
func (*GitTokenStore) AuthDir ¶
func (s *GitTokenStore) AuthDir() string
AuthDir returns the directory used for auth persistence.
func (*GitTokenStore) BootstrapConfig ¶ added in v8.1.0
func (s *GitTokenStore) BootstrapConfig(ctx context.Context, example string) (*config.Config, error)
BootstrapConfig synchronizes the repository before preparing any automatic rewrites. A losing candidate never touches the worktree; synchronize again to get the winner instead of restoring over any user edits.
func (*GitTokenStore) ConfigPath ¶
func (s *GitTokenStore) ConfigPath() string
ConfigPath returns the managed config file path.
func (*GitTokenStore) Delete ¶
func (s *GitTokenStore) Delete(_ context.Context, id string) error
Delete removes the auth file.
func (*GitTokenStore) EnsureRepository ¶
func (s *GitTokenStore) EnsureRepository() error
EnsureRepository prepares the local git working tree by cloning or opening the repository.
func (*GitTokenStore) List ¶
func (s *GitTokenStore) List(_ context.Context) ([]*cliproxyauth.Auth, error)
List enumerates all auth JSON files under the configured directory.
func (*GitTokenStore) PersistAuthFiles ¶
PersistAuthFiles commits and pushes the provided paths to the remote repository. It no-ops when the store is not fully configured or when there are no paths.
func (*GitTokenStore) PersistConfig ¶
func (s *GitTokenStore) PersistConfig(ctx context.Context) error
PersistConfig commits and pushes a verified snapshot of the local config.
func (*GitTokenStore) PersistPreparedConfig ¶ added in v8.1.0
PersistPreparedConfig publishes the provided bytes, not the live worktree file. The returned SHA-256 is computed from the validated commit's actual blob. A nil snapshot denotes standby and does not publish anything.
func (*GitTokenStore) RefreshClaim ¶ added in v8.0.59
func (s *GitTokenStore) RefreshClaim(ctx context.Context, key string) (claimed bool, errResult error)
Refresh journals use immutable tags, not credential-branch writes. Ordinary pulls, mirror recovery, and auth saves therefore cannot erase a claim. Each claimant creates a different root commit; a non-force push can publish only one.
func (*GitTokenStore) RefreshComplete ¶ added in v8.0.59
func (*GitTokenStore) RefreshRead ¶ added in v8.0.59
func (*GitTokenStore) RefreshRelease ¶ added in v8.0.68
func (s *GitTokenStore) RefreshRelease(ctx context.Context, key string) error
func (*GitTokenStore) Save ¶
func (s *GitTokenStore) Save(ctx context.Context, auth *cliproxyauth.Auth) (string, error)
Save persists token storage and metadata to the resolved auth file path.
func (*GitTokenStore) SetBaseDir ¶
func (s *GitTokenStore) SetBaseDir(dir string)
SetBaseDir updates the default directory used for auth JSON persistence when no explicit path is provided.
func (*GitTokenStore) SetOptionalConfig ¶ added in v8.1.0
func (s *GitTokenStore) SetOptionalConfig(optional bool)
SetOptionalConfig enables standby behavior when the config cannot be decoded or does not exist. Call before using the store.
type ObjectStoreConfig ¶
type ObjectStoreConfig struct {
OptionalConfig bool
Endpoint string
Bucket string
AccessKey string
SecretKey string
Region string
Prefix string
LocalRoot string
UseSSL bool
PathStyle bool
}
ObjectStoreConfig captures configuration for the object storage-backed token store.
type ObjectTokenStore ¶
type ObjectTokenStore struct {
// contains filtered or unexported fields
}
ObjectTokenStore persists configuration and authentication metadata using an S3-compatible object storage backend. Files are mirrored to a local workspace so existing file-based flows continue to operate.
func NewObjectTokenStore ¶
func NewObjectTokenStore(cfg ObjectStoreConfig) (*ObjectTokenStore, error)
NewObjectTokenStore initializes an object storage backed token store.
func (*ObjectTokenStore) AuthDir ¶
func (s *ObjectTokenStore) AuthDir() string
AuthDir returns the local directory containing mirrored auth files.
func (*ObjectTokenStore) Bootstrap ¶
func (s *ObjectTokenStore) Bootstrap(ctx context.Context, exampleConfigPath string) error
Bootstrap ensures the target bucket exists and synchronizes data from the object storage backend.
func (*ObjectTokenStore) BootstrapConfig ¶ added in v8.1.0
func (s *ObjectTokenStore) BootstrapConfig(ctx context.Context, exampleConfigPath string) (*config.Config, error)
BootstrapConfig synchronizes the workspace and returns the winning config snapshot.
func (*ObjectTokenStore) ConfigPath ¶
func (s *ObjectTokenStore) ConfigPath() string
ConfigPath returns the managed configuration file path inside the spool directory.
func (*ObjectTokenStore) Delete ¶
func (s *ObjectTokenStore) Delete(ctx context.Context, id string) error
Delete removes an auth file locally and remotely.
func (*ObjectTokenStore) List ¶
func (s *ObjectTokenStore) List(_ context.Context) ([]*cliproxyauth.Auth, error)
List enumerates auth JSON files from the mirrored workspace.
func (*ObjectTokenStore) PersistAuthFiles ¶
PersistAuthFiles uploads the provided auth files to the object storage backend.
func (*ObjectTokenStore) PersistConfig ¶
func (s *ObjectTokenStore) PersistConfig(ctx context.Context) error
PersistConfig uploads the local configuration file to the object storage backend.
func (*ObjectTokenStore) RefreshClaim ¶ added in v8.0.59
RefreshClaim requires S3 conditional creation, not a last-writer-wins upload. Backends that ignore If-None-Match fail the capability probe before any OAuth request. A claim is never deleted or retried after an uncertain PUT response.
func (*ObjectTokenStore) RefreshComplete ¶ added in v8.0.59
func (*ObjectTokenStore) RefreshRead ¶ added in v8.0.59
func (*ObjectTokenStore) RefreshRelease ¶ added in v8.0.68
func (s *ObjectTokenStore) RefreshRelease(ctx context.Context, key string) error
RefreshRelease deletes a pending claim owned by this store using a single unretried HTTP request. Uncertain responses fail closed without retrying so a delayed or retried DELETE can never erase a successor claimant's lock.
func (*ObjectTokenStore) Save ¶
func (s *ObjectTokenStore) Save(ctx context.Context, auth *cliproxyauth.Auth) (string, error)
Save persists authentication metadata to disk and uploads it to the object storage backend.
func (*ObjectTokenStore) SetBaseDir ¶
func (s *ObjectTokenStore) SetBaseDir(string)
SetBaseDir implements the optional interface used by authenticators; it is a no-op because the object store controls its own workspace.
type PostgresStore ¶
type PostgresStore struct {
// contains filtered or unexported fields
}
PostgresStore persists configuration and authentication metadata using PostgreSQL as backend while mirroring data to a local workspace so existing file-based workflows continue to operate.
func NewPostgresStore ¶
func NewPostgresStore(ctx context.Context, cfg PostgresStoreConfig) (*PostgresStore, error)
NewPostgresStore establishes a connection to PostgreSQL and prepares the local workspace.
func (*PostgresStore) AuthDir ¶
func (s *PostgresStore) AuthDir() string
AuthDir returns the local directory containing mirrored auth files.
func (*PostgresStore) Bootstrap ¶
func (s *PostgresStore) Bootstrap(ctx context.Context, exampleConfigPath string) error
Bootstrap synchronizes configuration and auth records between PostgreSQL and the local workspace.
func (*PostgresStore) BootstrapConfig ¶ added in v8.1.0
func (s *PostgresStore) BootstrapConfig(ctx context.Context, exampleConfigPath string) (*config.Config, error)
BootstrapConfig synchronizes the workspace and returns the winning config snapshot.
func (*PostgresStore) Close ¶
func (s *PostgresStore) Close() error
Close releases the underlying database connection.
func (*PostgresStore) ConfigPath ¶
func (s *PostgresStore) ConfigPath() string
ConfigPath returns the managed configuration file path inside the spool directory.
func (*PostgresStore) CooldownStateStore ¶
func (s *PostgresStore) CooldownStateStore() cliproxyauth.CooldownStateStore
CooldownStateStore returns the PostgreSQL-backed runtime cooldown store.
func (*PostgresStore) Delete ¶
func (s *PostgresStore) Delete(ctx context.Context, id string) error
Delete removes an auth file and the corresponding database record.
func (*PostgresStore) EnsureSchema ¶
func (s *PostgresStore) EnsureSchema(ctx context.Context) error
EnsureSchema creates the required tables (and schema when provided).
func (*PostgresStore) List ¶
func (s *PostgresStore) List(ctx context.Context) ([]*cliproxyauth.Auth, error)
List enumerates all auth records stored in PostgreSQL.
func (*PostgresStore) PersistAuthFiles ¶
PersistAuthFiles stores the provided auth file changes in PostgreSQL.
func (*PostgresStore) PersistConfig ¶
func (s *PostgresStore) PersistConfig(ctx context.Context) error
PersistConfig mirrors the local configuration file to PostgreSQL.
func (*PostgresStore) RefreshClaim ¶ added in v8.0.59
RefreshClaim uses a unique database key, independent of disposable auth mirrors.
func (*PostgresStore) RefreshComplete ¶ added in v8.0.59
func (*PostgresStore) RefreshRead ¶ added in v8.0.59
func (*PostgresStore) RefreshRelease ¶ added in v8.0.68
func (s *PostgresStore) RefreshRelease(ctx context.Context, key string) error
func (*PostgresStore) Save ¶
func (s *PostgresStore) Save(ctx context.Context, auth *cliproxyauth.Auth) (string, error)
Save persists authentication metadata to disk and PostgreSQL.
func (*PostgresStore) SetBaseDir ¶
func (s *PostgresStore) SetBaseDir(string)
SetBaseDir implements the optional interface used by authenticators; it is a no-op because the Postgres-backed store controls its own workspace.
func (*PostgresStore) WorkDir ¶
func (s *PostgresStore) WorkDir() string
WorkDir exposes the root spool directory used for mirroring.