updated libs
This commit is contained in:
parent
8104009bdc
commit
f305f96195
11 changed files with 79 additions and 265 deletions
|
|
@ -152,16 +152,18 @@ func Validate(c *Config) error {
|
|||
if raft != nil && etcd != nil {
|
||||
return errors.New("only one cluster config allowed: raft or etcd")
|
||||
}
|
||||
if len(c.APIServer.BasicAuth) == 0 {
|
||||
return errors.New("missing basic auth configuration for api users")
|
||||
}
|
||||
for _, u := range c.APIServer.BasicAuth {
|
||||
if u.User == "" {
|
||||
return errors.New("basic auth username can not be empty")
|
||||
if !c.APIServer.DisableAuth {
|
||||
if len(c.APIServer.BasicAuth) == 0 {
|
||||
return errors.New("missing basic auth configuration for api users")
|
||||
}
|
||||
_, err := bcrypt.Cost([]byte(u.Hash))
|
||||
if u.Hash == "" {
|
||||
return fmt.Errorf("invalid basic auth hash for user %s: %w", u.User, err)
|
||||
for _, u := range c.APIServer.BasicAuth {
|
||||
if u.User == "" {
|
||||
return errors.New("basic auth username can not be empty")
|
||||
}
|
||||
_, err := bcrypt.Cost([]byte(u.Hash))
|
||||
if u.Hash == "" {
|
||||
return fmt.Errorf("invalid basic auth hash for user %s: %w", u.User, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
@ -239,9 +241,10 @@ type Etcd struct {
|
|||
}
|
||||
|
||||
type APIServer struct {
|
||||
Listen string `yaml:"listen"`
|
||||
TLS *TLS `yaml:"tls"`
|
||||
BasicAuth []BasicAuth `yaml:"basicAuth"`
|
||||
Listen string `yaml:"listen"`
|
||||
TLS *TLS `yaml:"tls"`
|
||||
DisableAuth bool `yaml:"disableAuth"`
|
||||
BasicAuth []BasicAuth `yaml:"basicAuth"`
|
||||
}
|
||||
|
||||
type BasicAuth struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue