respect token validation mode for CSRF header
Fixes #1104 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
2da3eabc12
commit
147ad3b230
1 changed files with 6 additions and 4 deletions
|
@ -305,11 +305,13 @@ func verifyCSRFHeader(next http.Handler) http.Handler {
|
|||
return
|
||||
}
|
||||
|
||||
if tokenValidationMode != tokenValidationNoIPMatch {
|
||||
if !util.Contains(token.Audience(), util.GetIPFromRemoteAddress(r.RemoteAddr)) {
|
||||
logger.Debug(logSender, "", "error validating CSRF header IP audience")
|
||||
sendAPIResponse(w, r, errors.New("the token is not valid"), "", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue