Documentation
¶
Index ¶
- Constants
- Variables
- func LoadJWTPublicKeys(path string) ([]goajwt.Key, error)
- func NewJWTSecurity(keysDir string, scheme *goa.JWTSecurity) chain.SecurityChainMiddleware
- func NewJWTSecurityMiddleware(resolver goajwt.KeyResolver, scheme *goa.JWTSecurity) chain.SecurityChainMiddleware
- func NewKeyResolver(path string) (goajwt.KeyResolver, error)
- func SignToken(claims map[string]interface{}, signingMethod string, key interface{}) (string, error)
- type SigningMethods
Constants ¶
const JWTSecurityType = "JWT"
JWTSecurityType is the name of the JWT security type
Variables ¶
var AvailableSigningMethods = SigningMethods{ "RS256": jwtgo.SigningMethodRS256, "RS384": jwtgo.SigningMethodRS384, "RS512": jwtgo.SigningMethodRS512, }
AvailableSigningMethods holds the supported signing methods.
Functions ¶
func LoadJWTPublicKeys ¶
LoadJWTPublicKeys loads PEM encoded RSA public keys used to validate and decrypt the JWT.
func NewJWTSecurity ¶
func NewJWTSecurity(keysDir string, scheme *goa.JWTSecurity) chain.SecurityChainMiddleware
NewJWTSecurity creates a JWT SecurityChainMiddleware using a simple key resolver that loads the public keys from the keysDir. The key files must end in *.pub. The scheme is obtained from the generated Goadesign JWT security.
func NewJWTSecurityMiddleware ¶
func NewJWTSecurityMiddleware(resolver goajwt.KeyResolver, scheme *goa.JWTSecurity) chain.SecurityChainMiddleware
NewJWTSecurityMiddleware creates a new chain.SecurityChainMiddleware with a given KeyResolver and JWTSecurity configuration. As resolver you may pass the simple key resolver created with NewKeyResolver or you may pass a more sophisticated key-resolver. The scheme is obtained from the generated Goadesign JWT security.
func NewKeyResolver ¶
func NewKeyResolver(path string) (goajwt.KeyResolver, error)
NewKeyResolver creates a simple key resolver for the JWT middleware. It loads the public keys from a specified directory (path). The public key files MUST end in *.pub .
Types ¶
type SigningMethods ¶
type SigningMethods map[string]jwtgo.SigningMethod
SigningMethods is a map mapping from a signing method name to an actual SigningMethod