Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnauthorized = goa.NewErrorClass("unauthorized", 401) )
Functions ¶
func ForceFail ¶
func ForceFail() goa.Middleware
ForceFail is a middleware illustrating the use of validation middleware with JWT auth. It checks for the presence of a "fail" query string and fails validation if set to the value "true".
func LoadJWTPublicKeys ¶
LoadJWTPublicKeys loads PEM encoded RSA public keys used to validata and decrypt the JWT.
func NewJWTMiddleware ¶
func NewJWTMiddleware() (goa.Middleware, error)
NewJWTMiddleware creates a middleware that checks for the presence of a JWT Authorization header and validates its content. A real app would probably use goa's JWT security middleware instead.
Note: the code below assumes the example is compiled against the master branch of goa. If compiling against goa v1 the call to jwt.New needs to be:
middleware := jwt.New(keys, ForceFail(), app.NewJWTSecurity())
func NewOptionalJWTMiddleware ¶
func NewOptionalJWTMiddleware() (goa.Middleware, error)
NewOptionalJWTMiddleware creates a middleware that checks for the presence of a JWT Authorization header
Types ¶
type JWTController ¶
type JWTController struct {
*goa.Controller
// contains filtered or unexported fields
}
JWTController implements the JWT resource.
func NewJWTController ¶
func NewJWTController(service *goa.Service) (*JWTController, error)
NewJWTController creates a JWT controller.