From 0a5b59aa0b5ee17bddf280cb20438542a15c3064 Mon Sep 17 00:00:00 2001 From: Darko Luketic Date: Sun, 14 Nov 2021 15:51:16 +0100 Subject: [PATCH] added permissive option --- options/options.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/options/options.go b/options/options.go index 6a8add1..ca64575 100644 --- a/options/options.go +++ b/options/options.go @@ -45,6 +45,7 @@ type Options struct { TokenString [][]TokenStringOption ClaimsContextKeyName ClaimsContextKeyName ErrorHandler ErrorHandler + Permissive bool } // New takes Option setters and returns an Options pointer. @@ -262,3 +263,10 @@ func WithErrorHandler(opt ErrorHandler) Option { opts.ErrorHandler = opt } } + +// WithPermissive allows incoming requests to pass even if the client does not provide a token. +func WithPermissive(opt bool) Option { + return func(opts *Options) { + opts.Permissive = opt + } +}