Documentation
¶
Index ¶
Constants ¶
View Source
const ( FieldRepoURL = "repoURL" FieldRepoURLIsRegex = "repoURLIsRegex" FieldUsername = "username" FieldPassword = "password" )
Variables ¶
View Source
var DefaultProviderRegistry = MustNewProviderRegistry()
Functions ¶
func CalculateCacheTTL ¶ added in v1.9.4
CalculateCacheTTL calculates the time-to-live for a cached credential based on the credential's expiry time and a safety margin. If the expiry time is zero (unknown) or the remaining time after subtracting the margin is not positive, it returns cache.DefaultExpiration, deferring to the cache's own default TTL.
Types ¶
type Credentials ¶
type Credentials struct {
// Username identifies a principal, which combined with the value of the
// Password field, can be used for access to some repository.
Username string
// Password, when combined with the principal identified by the Username
// field, can be used for access to some repository.
Password string
// SSHPrivateKey is a private key that can be used for access to some remote
// repository. This is primarily applicable for Git repositories.
SSHPrivateKey string
}
Credentials generically represents any type of repository credential.
type Database ¶
type Database interface {
Get(
ctx context.Context,
namespace string,
credType Type,
repo string,
) (*Credentials, error)
}
Database is an interface for a Credentials store.
type FakeDB ¶
type FakeDB struct {
GetFn func(
ctx context.Context,
namespace string,
credType Type,
repo string,
) (*Credentials, error)
}
FakeDB is a mock implementation of the Database interface that is used to facilitate unit testing.
type Provider ¶
type Provider interface {
// Supports returns true if the Provider can potentially provide credentials
// for the credential request.
Supports(context.Context, Request) (bool, error)
// GetCredentials returns the credentials for the given CredentialRequest. If
// the Provider cannot provide credentials for the given CredentialRequest, it
// should return nil.
GetCredentials(context.Context, Request) (*Credentials, error)
}
Provider is an interface for providing credentials for a given type, repository URL and data values.
type ProviderPredicate ¶ added in v1.8.8
type ProviderRegistration ¶ added in v1.8.8
type ProviderRegistration = component.PredicateBasedRegistration[ Request, ProviderPredicate, Provider, struct{}, ]
type ProviderRegistry ¶ added in v1.8.8
type ProviderRegistry = component.PredicateBasedRegistry[ Request, ProviderPredicate, Provider, struct{}, ]
func MustNewProviderRegistry ¶ added in v1.8.8
func MustNewProviderRegistry( registrations ...ProviderRegistration, ) ProviderRegistry
Click to show internal directories.
Click to hide internal directories.