Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
NullCreds = &nullCredentialHelper{}
)
Functions ¶
func NewCredentialCacher ¶
func NewCredentialCacher() *credentialCacher
Types ¶
type Access ¶
type Access struct {
// contains filtered or unexported fields
}
func NewAccess ¶
func NewAccess(mode AccessMode, url string) Access
func (*Access) Mode ¶
func (a *Access) Mode() AccessMode
func (*Access) Upgrade ¶
func (a *Access) Upgrade(newMode AccessMode) Access
Returns a copy of an AccessMode with the mode upgraded to newMode
type AccessMode ¶
type AccessMode string
const ( NoneAccess AccessMode = "none" BasicAccess AccessMode = "basic" PrivateAccess AccessMode = "private" NegotiateAccess AccessMode = "negotiate" EmptyAccess AccessMode = "" )
type AskPassCredentialHelper ¶
type AskPassCredentialHelper struct { // Program is the executable program's absolute or relative name. Program string }
AskPassCredentialHelper implements the CredentialHelper type for GIT_ASKPASS and 'core.askpass' configuration values.
func (*AskPassCredentialHelper) Approve ¶
func (a *AskPassCredentialHelper) Approve(_ Creds) error
Approve implements CredentialHelper.Approve, and returns nil. The ASKPASS credential helper does not implement credential approval.
func (*AskPassCredentialHelper) Fill ¶
func (a *AskPassCredentialHelper) Fill(what Creds) (Creds, error)
Fill implements fill by running the ASKPASS program and returning its output as a password encoded in the Creds type given the key "password".
It accepts the password as coming from the program's stdout, as when invoked with the given arguments (see (*AskPassCredentialHelper).args() below)./
If there was an error running the command, it is returned instead of a set of filled credentials.
The ASKPASS program is only queried if a credential was not already provided, i.e. through the git URL
func (*AskPassCredentialHelper) Reject ¶
func (a *AskPassCredentialHelper) Reject(_ Creds) error
Reject implements CredentialHelper.Reject, and returns nil. The ASKPASS credential helper does not implement credential rejection.
type CredentialHelper ¶
type CredentialHelper interface { Fill(Creds) (Creds, error) Reject(Creds) error Approve(Creds) error }
CredentialHelper is an interface used by the lfsapi Client to interact with the 'git credential' command: https://git-scm.com/docs/gitcredentials Other implementations include ASKPASS support, and an in-memory cache.
func NewCredentialHelpers ¶
func NewCredentialHelpers(helpers []CredentialHelper) CredentialHelper
NewCredentialHelpers initializes a new CredentialHelpers from the given slice of CredentialHelper instances.
type CredentialHelperContext ¶
type CredentialHelperContext struct {
// contains filtered or unexported fields
}
func NewCredentialHelperContext ¶
func NewCredentialHelperContext(gitEnv config.Environment, osEnv config.Environment) *CredentialHelperContext
func (*CredentialHelperContext) GetCredentialHelper ¶
func (ctxt *CredentialHelperContext) GetCredentialHelper(helper CredentialHelper, u *url.URL) CredentialHelperWrapper
getCredentialHelper parses a 'credsConfig' from the git and OS environments, returning the appropriate CredentialHelper to authenticate requests with.
It returns an error if any configuration was invalid, or otherwise un-useable.
type CredentialHelperWrapper ¶
type CredentialHelperWrapper struct { CredentialHelper CredentialHelper Input Creds Url *url.URL Creds Creds }
CredentialHelperWrapper is used to contain the encapsulate the information we need for credential handling during auth.
func (*CredentialHelperWrapper) FillCreds ¶
func (credWrapper *CredentialHelperWrapper) FillCreds() error
type CredentialHelpers ¶
type CredentialHelpers struct {
// contains filtered or unexported fields
}
CredentialHelpers iterates through a slice of CredentialHelper objects CredentialHelpers is a []CredentialHelper that iterates through each credential helper to fill, reject, or approve credentials. Typically, the first success returns immediately. Errors are reported to tracerx, unless all credential helpers return errors. Any erroring credential helpers are skipped for future calls.
A CredentialHelper can return a credHelperNoOp error, signaling that the CredentialHelpers should try the next one.
func (*CredentialHelpers) Approve ¶
func (s *CredentialHelpers) Approve(what Creds) error
Approve implements CredentialHelper.Approve and approves the given Creds "what" with the first successful CredentialHelper. If an error occurrs, it calls Reject() with the same Creds and returns the error immediately. This ensures a caching credential helper removes the cache, since the Erroring CredentialHelper never successfully saved it.
func (*CredentialHelpers) Fill ¶
func (s *CredentialHelpers) Fill(what Creds) (Creds, error)
Fill implements CredentialHelper.Fill by asking each CredentialHelper in order to fill the credentials.
If a fill was successful, it is returned immediately, and no other `CredentialHelper`s are consulted. If any CredentialHelper returns an error, it is reported to tracerx, and the next one is attempted. If they all error, then a collection of all the error messages is returned. Erroring credential helpers are added to the skip list, and never attempted again for the lifetime of the current Git LFS command.
func (*CredentialHelpers) Reject ¶
func (s *CredentialHelpers) Reject(what Creds) error
Reject implements CredentialHelper.Reject and rejects the given Creds "what" with the first successful attempt.
type Creds ¶
Creds represents a set of key/value pairs that are passed to 'git credential' as input.
type NetrcFinder ¶
func ParseNetrc ¶
func ParseNetrc(osEnv config.Environment) (NetrcFinder, string, error)