Check if auth config is provided when using access control

This commit is contained in:
Petu Eusebiu
2021-09-01 12:15:00 +03:00
committed by Ramkumar Chinchani
parent c8779d9e87
commit 62e724532a
5 changed files with 66 additions and 14 deletions
-12
View File
@@ -216,18 +216,6 @@ func getUsername(r *http.Request) string {
return pair[0]
}
func isBearerAuthEnabled(config *Config) bool {
if config.HTTP.Auth != nil &&
config.HTTP.Auth.Bearer != nil &&
config.HTTP.Auth.Bearer.Cert != "" &&
config.HTTP.Auth.Bearer.Realm != "" &&
config.HTTP.Auth.Bearer.Service != "" {
return true
}
return false
}
func authzFail(w http.ResponseWriter, realm string, delay int) {
time.Sleep(time.Duration(delay) * time.Second)
w.Header().Set("WWW-Authenticate", realm)