Rename security.go and security_test.go to config.go and config_test.go

This commit is contained in:
TwinProduction
2021-09-22 00:53:13 -04:00
parent df3a2016ff
commit 4a46a5ae9e
2 changed files with 0 additions and 0 deletions

25
security/config.go Normal file
View File

@ -0,0 +1,25 @@
package security
// Config is the security configuration for Gatus
type Config struct {
Basic *BasicConfig `yaml:"basic"`
}
// IsValid returns whether the security configuration is valid or not
func (c *Config) IsValid() bool {
return c.Basic != nil && c.Basic.IsValid()
}
// 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"`
// PasswordSha512Hash is the SHA512 hash of the password which will need to be used for a successful authentication
PasswordSha512Hash string `yaml:"password-sha512"`
}
// IsValid returns whether the basic security configuration is valid or not
func (c *BasicConfig) IsValid() bool {
return len(c.Username) > 0 && len(c.PasswordSha512Hash) == 128
}