credentials

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCredentialsDir = "/etc/zypp/credentials.d"
	GlobalCredentialsFile = "/etc/zypp/credentials.d/SCCcredentials"
	CurlrcUserFile        = ".curlrc"
)

Variables

View Source
var (
	ErrNoProxyCredentials     = errors.New("Unable to read proxy credentials")
	ErrMalformedSccCredFile   = errors.New("Cannot parse credentials file")
	ErrMissingCredentialsFile = errors.New("Credentials file is missing")
)

errors

Functions

func CreateCredentials

func CreateCredentials(login, password, systemToken, path string) error

CreateCredentials writes credentials to path

func CreateTestCredentials

func CreateTestCredentials(username, password string, fsRoot string, t *testing.T)

func CurlrcCredentialsPath

func CurlrcCredentialsPath() string

func HandleSystemToken

func HandleSystemToken(token string, fsRoot string) error

handleSystemToken stores the given token into the system credentials file unHless it's blank.

func ServiceCredentialsPath

func ServiceCredentialsPath(service string, fsRoot string) string

func SystemCredentialsPath

func SystemCredentialsPath(fsRoot string) string

Types

type Credentials

type Credentials struct {
	Filename    string `json:"file"`
	Username    string `json:"username"`
	Password    string `json:"password"`
	SystemToken string `json:"system_token"`
}

Credentials stores the SCC or service credentials

func ReadCredentials

func ReadCredentials(path string) (Credentials, error)

ReadCredentials returns the credentials from path

func ReadCurlrcCredentials

func ReadCurlrcCredentials() (Credentials, error)

ReadCurlrcCredentials reads proxy credentials from default path

func (*Credentials) HasAuthentication added in v1.20.0

func (c *Credentials) HasAuthentication() bool

Returns always true, needed to implement the Credentials interface from `pkg/`.

func (*Credentials) Login added in v1.20.0

func (c *Credentials) Login() (string, string, error)

Returns the username and password from the system, needed to implement the Credentials interface from `pkg/`.

func (*Credentials) SetLogin added in v1.20.0

func (c *Credentials) SetLogin(username, password string) error

Writes into the configuration the given username and password and updates their values of this instance. Needed to implement the Credentials interface from `pkg/`.

func (*Credentials) String

func (c *Credentials) String() string

func (*Credentials) Token added in v1.20.0

func (c *Credentials) Token() (string, error)

Returns the current system token, needed to implement the Credentials interface from `pkg/`.

func (*Credentials) UpdateToken added in v1.20.0

func (c *Credentials) UpdateToken(token string) error

Writes into the configuration the given system token and updates the value of this instance. Needed to implement the Credentials interface from `pkg/`.

Jump to

Keyboard shortcuts

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