middleware

package
v0.0.0-...-4c11209 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
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"
)

Variables

View Source
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")
)

Functions

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.

Types

type JWTConfig

type JWTConfig struct {
	ProviderURL string
	ClientID    string
	AuthScheme  string
}

JWTConfig jwt middleware configuration.

Jump to

Keyboard shortcuts

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