2021-12-31 05:10:54 +00:00
|
|
|
package security
|
|
|
|
|
|
|
|
// BasicConfig is the configuration for Basic authentication
|
|
|
|
type BasicConfig struct {
|
|
|
|
// Username is the name which will need to be used for a successful authentication
|
|
|
|
Username string `yaml:"username"`
|
|
|
|
|
2022-01-09 00:26:37 +00:00
|
|
|
// PasswordBcryptHashBase64Encoded is the base64 encoded string of the Bcrypt hash of the password to use to
|
|
|
|
// authenticate using basic auth.
|
|
|
|
PasswordBcryptHashBase64Encoded string `yaml:"password-bcrypt-base64"`
|
2021-12-31 05:10:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// isValid returns whether the basic security configuration is valid or not
|
|
|
|
func (c *BasicConfig) isValid() bool {
|
2022-06-15 03:48:28 +00:00
|
|
|
return len(c.Username) > 0 && len(c.PasswordBcryptHashBase64Encoded) > 0
|
2021-12-31 05:10:54 +00:00
|
|
|
}
|