Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
func Authenticate(a *auth.Auth) web.Middleware
Authenticate validates a JWT from the `Authorization` header.
func Authorize ¶
func Authorize(a *auth.Auth, rule string) web.Middleware
Authorize executes the specified role and does not extract any domain data.
Authorize validates that an authenticated user has at least one role from a specified list. This method constructs the actual function
that is used.
func Errors ¶
func Errors(log *zap.SugaredLogger) web.Middleware
Errors handles errors coming out of the call chain. It detects normal application errors which are used to respond to the client in a uniform way. Unexpected errors (status >= 500) are logged. Error handling means logging the error, so we needed to pass the logger. Note: Middlewares accepts the thing they need like the logger.
func Logger ¶
func Logger(log *zap.SugaredLogger) web.Middleware
with Logger, we have the ability to do the logging before and after the handler that was called
func Panics ¶
func Panics() web.Middleware
Panics recovers from panics and converts the panic to an error so it is reported in Metrics and handled in Errors.
We returned a web.Middleware although we don't do anything in that middleware. This is just for consistency with other middlewares.
We're using a named return arg here. We're doing it so we can leverage closures.
Types ¶
This section is empty.