auth/jwt: minor gofmt fixes
hbc
5 years ago
69 | 69 | // Useful in NewParser middleware. |
70 | 70 | type ClaimsFactory func() jwt.Claims |
71 | 71 | |
72 | // MapClaimsFactory is a ClaimsFactory that returns | |
72 | // MapClaimsFactory is a ClaimsFactory that returns | |
73 | 73 | // an empty jwt.MapClaims. |
74 | 74 | func MapClaimsFactory() jwt.Claims { |
75 | return jwt.MapClaims{} | |
75 | return jwt.MapClaims{} | |
76 | 76 | } |
77 | 77 | |
78 | // StandardClaimsFactory is a ClaimsFactory that returns | |
78 | // StandardClaimsFactory is a ClaimsFactory that returns | |
79 | 79 | // an empty jwt.StandardClaims. |
80 | 80 | func StandardClaimsFactory() jwt.Claims { |
81 | return &jwt.StandardClaims{} | |
81 | return &jwt.StandardClaims{} | |
82 | 82 | } |
83 | 83 | |
84 | 84 | // NewParser creates a new JWT token parsing middleware, specifying a |
85 | 85 | // jwt.Keyfunc interface, the signing method and the claims type to be used. NewParser |
86 | // adds the resulting claims to endpoint context or returns error on invalid token. | |
86 | // adds the resulting claims to endpoint context or returns error on invalid token. | |
87 | 87 | // Particularly useful for servers. |
88 | 88 | func NewParser(keyFunc jwt.Keyfunc, method jwt.SigningMethod, newClaims ClaimsFactory) endpoint.Middleware { |
89 | 89 | return func(next endpoint.Endpoint) endpoint.Endpoint { |