Documentation
¶
Index ¶
Constants ¶
View Source
const CurrentUserContextKey = "current_user"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JWT ¶
type JWT struct {
// contains filtered or unexported fields
}
JWT is a middleware which validates, verifies JSON Web Token provided through an authorization header. It also handles all possible exceptions and, in case of valid request, fetches user, associated with the provided JWT and transfers it to the next handler through CurrentUserContextKey context key.
func (*JWT) Middleware ¶
func (m *JWT) Middleware() MiddlewareFunc
type MiddlewareFunc ¶
MiddlewareFunc is a which is a middleware: it receives an HTTP handler, and returns an HTTP handler which performs some operations and optionally calls the provided handler.
type Middlewarer ¶
type Middlewarer interface { // Middleware must return a middleware function which can be used to wrap handlers. Middleware() MiddlewareFunc }
Middlewarer describes a structure which holds a middleware.
Click to show internal directories.
Click to hide internal directories.