credentials

package
v0.0.0-...-b6f9656 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainCredentialGetter

type ChainCredentialGetter []CredentialGetter

func (ChainCredentialGetter) CredentialForHost

func (c ChainCredentialGetter) CredentialForHost(host string) (*Credentials, error)

type CredentialGetter

type CredentialGetter interface {
	CredentialForHost(string) (*Credentials, error)
}

CredentialGetter defines to implement to get credentials

func MustNewKeyring

func MustNewKeyring(cfg keyring.Config) CredentialGetter

func NewKeyring

func NewKeyring(cfg keyring.Config) (CredentialGetter, error)

type Credentials

type Credentials struct {
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

Credentials defines the authentication credentials values

type EnvToken

type EnvToken struct {
	UsernameKey     string
	PasswordKey     string
	DefaultUserName string
}

EnvToken resolves github authentication using the GITHUB_TOKEN environment variable if present

func (*EnvToken) CredentialForHost

func (e *EnvToken) CredentialForHost(host string) (*Credentials, error)

type Errors

type Errors []error

func (Errors) Error

func (e Errors) Error() string

Error implements the error interface

type GitAuth

type GitAuth struct {
	Credentials CredentialGetter
}

func (*GitAuth) Name

func (a *GitAuth) Name() string

func (*GitAuth) SetAuth

func (a *GitAuth) SetAuth(r *http.Request)

func (*GitAuth) String

func (a *GitAuth) String() string

type GitCredentials

type GitCredentials struct {
	GitPath string
}

func (*GitCredentials) CredentialForHost

func (c *GitCredentials) CredentialForHost(host string) (*Credentials, error)

type Keyring

type Keyring struct {
	// contains filtered or unexported fields
}

func (Keyring) CredentialForHost

func (k Keyring) CredentialForHost(h string) (*Credentials, error)

type Netrc

type Netrc struct {
	Path string
}

Netrc implements the CredentialGetter interface, getting the credentials from a netrc formatted file. When path is empty, the default ~/.netrc path is used

func (*Netrc) CredentialForHost

func (n *Netrc) CredentialForHost(host string) (*Credentials, error)

CredentialForHost retrieves the credentials for a given host in the netrc file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL