.github
alerting
client
config
controller
core
docs
examples
jsonpath
metric
pattern
security
handler.go
handler_test.go
security.go
security_test.go
sha512.go
sha512_test.go
storage
util
vendor
watchdog
web
.dockerignore
.gitattributes
.gitignore
Dockerfile
LICENSE.md
Makefile
README.md
config.yaml
go.mod
go.sum
main.go
26 lines
838 B
Go
26 lines
838 B
Go
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
|
|
}
|