Start working on #8: Support basic authentication for the dashboard

This commit is contained in:
TwinProduction
2020-10-14 19:22:58 -04:00
parent 70c9c4b87c
commit 9220a777bb
4 changed files with 117 additions and 4 deletions

18
security/security.go Normal file
View File

@ -0,0 +1,18 @@
package security
type Config struct {
Basic *BasicConfig `yaml:"basic"`
}
func (c *Config) IsValid() bool {
return c.Basic != nil && c.Basic.IsValid()
}
type BasicConfig struct {
Username string `yaml:"username"`
PasswordSha512Hash string `yaml:"password-sha512"`
}
func (c *BasicConfig) IsValid() bool {
return len(c.Username) > 0 && len(c.PasswordSha512Hash) == 128
}