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
|
// WithDeprecatedKeys middleware option
|
||||||
func WithDeprecatedKeys(v ...Key) Option {
|
func WithDeprecatedKeys(v ...Key) Option {
|
||||||
return func(o *JWT) {
|
return func(o *JWT) {
|
||||||
deprecatedKeys := make(map[string]Key, len(v))
|
if len(v) > 0 {
|
||||||
for _, key := range deprecatedKeys {
|
if o.DeprecatedKeys == nil {
|
||||||
deprecatedKeys[key.ID] = key
|
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