From 0ab597b430b035ec6059ececd57b55cb62ca6e14 Mon Sep 17 00:00:00 2001 From: Darko Luketic Date: Mon, 19 Dec 2022 14:58:35 +0100 Subject: [PATCH] implemented permissive --- http.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/http.go b/http.go index ea35560..7822d9d 100644 --- a/http.go +++ b/http.go @@ -36,8 +36,13 @@ func toHttpHandler(h http.Handler, parseToken oidc.ParseTokenFunc, setters ...op tokenString, err := oidc.GetTokenString(r.Header.Get, opts.TokenString) if err != nil { - onError(w, opts.ErrorHandler, http.StatusBadRequest, options.GetTokenErrorDescription, err) - return + if !opts.Permissive { + onError(w, opts.ErrorHandler, http.StatusBadRequest, options.GetTokenErrorDescription, err) + return + } else { + h.ServeHTTP(w, r) + return + } } token, err := parseToken(ctx, tokenString)