credentials

package
v0.4.0-rc Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2019 License: Apache-2.0 Imports: 20 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBrowser added in v0.3.0

func FromBrowser(username string, isAuthorized chan bool, done chan bool) (string, string, error)

FromBrowser requests the credentials from the user

func FromTerminal added in v0.3.0

func FromTerminal(username string) (string, string, error)

FromTerminal is to allow this login flow to work in headless mode

Types

type CredManager

type CredManager interface {
	// StoreCredentials stores the credentials in the relevant credentials store. The Registry field of the credentials
	// struct is required for this operation
	StoreCredentials(credentials *RegistryCredentials) error

	// GetCredentials retrieves the credentials from the relevant credentials store
	GetCredentials(registry string) (*RegistryCredentials, error)

	// RemoveCredentials removes the credentials from the relevant credentials store
	RemoveCredentials(registry string) error

	// HasCredentials checks whether the credentials are currently stored in the relevant credentials store
	HasCredentials(registry string) (bool, error)
}

CredManager interface which defines the behaviour of all the credential managers.

func NewCredManager

func NewCredManager() (CredManager, error)

NewCredManager creates a new credentials manager instance

type FileCredentialsManager

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

FileCredentialsManager manages the credentials in credentials file

func NewFileCredentialsManager

func NewFileCredentialsManager() (*FileCredentialsManager, error)

NewFileCredentialsManager creates a new File based Credentials Manager

func (FileCredentialsManager) GetCredentials

func (credManager FileCredentialsManager) GetCredentials(registry string) (*RegistryCredentials, error)

GetCredentials retrieves the credentials from the credentials file

func (FileCredentialsManager) HasCredentials

func (credManager FileCredentialsManager) HasCredentials(registry string) (bool, error)

IsRegistryPresent checks if the registry credentials exists in the credentials file

func (FileCredentialsManager) RemoveCredentials

func (credManager FileCredentialsManager) RemoveCredentials(registry string) error

RemoveCredentials removes the stored credentials from the credentials file

func (FileCredentialsManager) StoreCredentials

func (credManager FileCredentialsManager) StoreCredentials(credentials *RegistryCredentials) error

StoreCredentials stores the credentials in credentials file

type KeyringCredManager

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

KeyringCredManager holds the core of the KeyringCredManager which can be used to store the registry credentials in the native keyring

func NewKeyringCredManager

func NewKeyringCredManager() (*KeyringCredManager, error)

NewKeyringCredManager creates a new native keyring based credentials manager

func (KeyringCredManager) GetCredentials

func (credManager KeyringCredManager) GetCredentials(registry string) (*RegistryCredentials, error)

GetCredentials retrieves the previous stored credentials from the keyring

func (KeyringCredManager) HasCredentials

func (credManager KeyringCredManager) HasCredentials(registry string) (bool, error)

IsRegistryPresent checks if the registry (key in the keyring) exists

func (KeyringCredManager) RemoveCredentials

func (credManager KeyringCredManager) RemoveCredentials(registry string) error

RemoveCredentials removes the stored credentials from the keyring

func (KeyringCredManager) StoreCredentials

func (credManager KeyringCredManager) StoreCredentials(credentials *RegistryCredentials) error

StoreCredentials stores the credentials in the native keyring

type RegistryCredentials

type RegistryCredentials struct {
	Registry string
	Username string
	Password string
}

RegistryCredentials holds the credentials of a registry

Jump to

Keyboard shortcuts

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