Documentation
¶
Index ¶
- Constants
- Variables
- func CreateCredentials(login, password, systemToken, path string) error
- func CreateTestCredentials(username, password string, fsRoot string, t *testing.T)
- func CurlrcCredentialsPath() string
- func HandleSystemToken(token string, fsRoot string) error
- func ServiceCredentialsPath(service string, fsRoot string) string
- func SystemCredentialsPath(fsRoot string) string
- type Credentials
- func (c *Credentials) HasAuthentication() bool
- func (c *Credentials) Login() (string, string, error)
- func (c *Credentials) SetLogin(username, password string) error
- func (c *Credentials) String() string
- func (c *Credentials) Token() (string, error)
- func (c *Credentials) UpdateToken(token string) error
Constants ¶
const ( DefaultCredentialsDir = "/etc/zypp/credentials.d" GlobalCredentialsFile = "/etc/zypp/credentials.d/SCCcredentials" CurlrcUserFile = ".curlrc" )
Variables ¶
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 ¶
CreateCredentials writes credentials to path
func CreateTestCredentials ¶
func CurlrcCredentialsPath ¶
func CurlrcCredentialsPath() string
func HandleSystemToken ¶
handleSystemToken stores the given token into the system credentials file unHless it's blank.
func ServiceCredentialsPath ¶
func SystemCredentialsPath ¶
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/`.