security

package
v0.0.0-...-a8bf646 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2019 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnauthorized is the error returned for unauthorized requests.
	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

func LoadJWTPublicKeys() ([]jwt.Key, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL