Skip to content

Commit

Permalink
fix(authn): apply fail delay only if credentials/sessions are supplied (
Browse files Browse the repository at this point in the history
#1920)

Signed-off-by: Petu Eusebiu <[email protected]>
  • Loading branch information
eusebiu-constantin-petu-dbk authored Oct 12, 2023
1 parent ab45356 commit d1fcab4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/api/authn.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,9 @@ func getRelyingPartyArgs(cfg *config.Config, provider string) (
}

func authFail(w http.ResponseWriter, r *http.Request, realm string, delay int) {
time.Sleep(time.Duration(delay) * time.Second)
if !isAuthorizationHeaderEmpty(r) || hasSessionHeader(r) {
time.Sleep(time.Duration(delay) * time.Second)
}

// don't send auth headers if request is coming from UI
if r.Header.Get(constants.SessionClientHeaderName) != constants.SessionClientHeaderValue {
Expand Down

0 comments on commit d1fcab4

Please sign in to comment.