app/vmauth: allow -auth.config without users section of unauthorized_user section is present here

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4083
This commit is contained in:
Aliaksandr Valialkin 2023-05-18 09:44:01 -07:00
parent 6aa8029f30
commit b22bcb6f0a
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -392,8 +392,8 @@ func parseAuthConfig(data []byte) (*AuthConfig, error) {
func parseAuthConfigUsers(ac *AuthConfig) (map[string]*UserInfo, error) {
uis := ac.Users
if len(uis) == 0 {
return nil, fmt.Errorf("`users` section cannot be empty in AuthConfig")
if len(uis) == 0 && ac.UnauthorizedUser == nil {
return nil, fmt.Errorf("Missing `users` or `unauthorized_user` sections")
}
byAuthToken := make(map[string]*UserInfo, len(uis))
for i := range uis {