Back to

Package middleware

Latest Go to latest

The highest tagged major version is .

Published: Oct 24, 2019 | License: Apache-2.0 | Module:



const (
	// DefaultAuthScheme default authentication scheme for JWT tokens
	DefaultAuthScheme = "Bearer"
	// DefaultAuthHeaderName default header to load the JWT
	DefaultAuthHeaderName = "Authorization"

	// DefaultContextVar the variable in the context to store the JWT token after successful login
	DefaultContextVar = "user"


var (
	// ErrJWTMissing missing or malformed jwt
	ErrJWTMissing = echo.NewHTTPError(http.StatusBadRequest, "missing or malformed jwt")

	// ErrJWTValidation invalid jwt
	ErrJWTValidation = echo.NewHTTPError(http.StatusUnauthorized, "invalid jwt")

func ErrorLog

func ErrorLog(next echo.HandlerFunc) echo.HandlerFunc

ErrorLog middleware which logs each error.

func JWTWithConfig

func JWTWithConfig(config *JWTConfig) echo.MiddlewareFunc

JWTWithConfig middleware which validates tokens

func RequestID

func RequestID(next echo.HandlerFunc) echo.HandlerFunc

RequestID middleware which checks request id.

func RequestLog

func RequestLog(next echo.HandlerFunc) echo.HandlerFunc

RequestLog middleware which logs each request.

type JWTConfig

type JWTConfig struct {
	ProviderURL string
	ClientID    string
	AuthScheme  string

JWTConfig jwt middleware configuration

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier