mirror of
https://github.com/foomo/keel.git
synced 2025-10-16 12:35:34 +00:00
fix: allow multiple calls
This commit is contained in:
parent
d0f0cccd6e
commit
52981a5a9b
11
jwt/jwt.go
11
jwt/jwt.go
@ -26,11 +26,14 @@ func WithKeyFun(v jwt.Keyfunc) Option {
|
||||
// WithDeprecatedKeys middleware option
|
||||
func WithDeprecatedKeys(v ...Key) Option {
|
||||
return func(o *JWT) {
|
||||
deprecatedKeys := make(map[string]Key, len(v))
|
||||
for _, key := range deprecatedKeys {
|
||||
deprecatedKeys[key.ID] = key
|
||||
if len(v) > 0 {
|
||||
if o.DeprecatedKeys == nil {
|
||||
o.DeprecatedKeys = map[string]Key{}
|
||||
}
|
||||
for _, key := range v {
|
||||
o.DeprecatedKeys[key.ID] = key
|
||||
}
|
||||
}
|
||||
o.DeprecatedKeys = deprecatedKeys
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user