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
Signed-off-by: Petu Eusebiu <[email protected]>
  • Loading branch information
eusebiu-constantin-petu-dbk committed Oct 10, 2023
1 parent 039648a commit 9ad2843
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 9ad2843

Please sign in to comment.