implemented permissive

This commit is contained in:
Darko Luketic 2022-12-19 14:58:35 +01:00
parent fc4d078e1e
commit 0ab597b430

View File

@ -36,8 +36,13 @@ func toHttpHandler(h http.Handler, parseToken oidc.ParseTokenFunc, setters ...op
tokenString, err := oidc.GetTokenString(r.Header.Get, opts.TokenString) tokenString, err := oidc.GetTokenString(r.Header.Get, opts.TokenString)
if err != nil { if err != nil {
if !opts.Permissive {
onError(w, opts.ErrorHandler, http.StatusBadRequest, options.GetTokenErrorDescription, err) onError(w, opts.ErrorHandler, http.StatusBadRequest, options.GetTokenErrorDescription, err)
return return
} else {
h.ServeHTTP(w, r)
return
}
} }
token, err := parseToken(ctx, tokenString) token, err := parseToken(ctx, tokenString)