added permissive option

This commit is contained in:
Darko Luketic 2021-11-14 15:51:16 +01:00
parent 70cb4a47ab
commit 0a5b59aa0b

View File

@ -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
}
}