always return 401 when auth fails
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
@@ -93,12 +93,15 @@ func AccountUUID(opts ...Option) func(next http.Handler) http.Handler {
|
|||||||
if opt.EnableBasicAuth && ok {
|
if opt.EnableBasicAuth && ok {
|
||||||
l.Warn().Msg("basic auth enabled, use only for testing or development")
|
l.Warn().Msg("basic auth enabled, use only for testing or development")
|
||||||
account, status = getAccount(l, opt.AccountsClient, fmt.Sprintf("login eq '%s' and password eq '%s'", strings.ReplaceAll(login, "'", "''"), strings.ReplaceAll(password, "'", "''")))
|
account, status = getAccount(l, opt.AccountsClient, fmt.Sprintf("login eq '%s' and password eq '%s'", strings.ReplaceAll(login, "'", "''"), strings.ReplaceAll(password, "'", "''")))
|
||||||
if status != 0 {
|
if status == 0 {
|
||||||
w.WriteHeader(status)
|
// fake claims for the subsequent code flow
|
||||||
|
claims = &oidc.StandardClaims{
|
||||||
|
Iss: opt.OIDCIss,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// tell client to reauthenticate
|
||||||
|
w.WriteHeader(http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
} // fake claims for the subsequent code flow
|
|
||||||
claims = &oidc.StandardClaims{
|
|
||||||
Iss: opt.OIDCIss,
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
|
|||||||
Reference in New Issue
Block a user