WithClaim is an Options function that adds a custom claim to the JWT.
(name string, value interface{})
| 29 | |
| 30 | // WithClaim is an Options function that adds a custom claim to the JWT. |
| 31 | func WithClaim(name string, value interface{}) Options { |
| 32 | return func(c *Claims) error { |
| 33 | if name == "" { |
| 34 | return errors.New("name cannot be empty") |
| 35 | } |
| 36 | c.Set(name, value) |
| 37 | return nil |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | // WithRootCA returns an Options function that calculates the SHA256 of the |
| 42 | // given root certificate to be used in the token claims. If this method it's |
searching dependent graphs…