Skip to content

Commit

Permalink
always return 401 when auth fails
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Oct 6, 2020
1 parent 46742f0 commit 64f9db7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions proxy/pkg/middleware/account_uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,15 @@ func AccountUUID(opts ...Option) func(next http.Handler) http.Handler {
if opt.EnableBasicAuth && ok {
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, "'", "''")))
if status != 0 {
w.WriteHeader(status)
if status == 0 {
// fake claims for the subsequent code flow
claims = &oidc.StandardClaims{
Iss: opt.OIDCIss,
}
} else {
// tell client to reauthenticate
w.WriteHeader(http.StatusUnauthorized)
return
} // fake claims for the subsequent code flow
claims = &oidc.StandardClaims{
Iss: opt.OIDCIss,
}
} else {
next.ServeHTTP(w, r)
Expand Down

0 comments on commit 64f9db7

Please sign in to comment.