Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Credential ¶
type Credential struct {
User string `json:"user"` // User name
Password secretstring.SecretString `json:"password"` // Password (masked in JSON/logs)
}
Credential holds authentication information with password protection
func New ¶
func New(user string, password string) Credential
New creates a Credential with the given user and password.
func NewFromEnv ¶
func NewFromEnv(userEnv string, passwordEnv string) Credential
NewFromEnv creates a Credential from environment variables as-is
func (*Credential) IsValid ¶
func (cred *Credential) IsValid() bool
IsValid returns true if the credential has a non-empty username Note: Password validation is intentionally not included for flexibility
func (*Credential) Patch ¶
func (cred *Credential) Patch(nc *Credential) bool
Patch updates the credential with non-empty values from the given credential. It returns true if any field was updated.
func (*Credential) Retrieve ¶
func (cred *Credential) Retrieve() (*string, *string)
Retrieve returns pointers to user and password if credential is valid Returns nil pointers if credential is invalid
func (*Credential) Update ¶
func (cred *Credential) Update(user *string, password *string)
Update modifies credential fields if the provided pointers are not nil