authjwt

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

README

Ping

Middleware to add new URL path and send "pong" as response.

Usefull for checking the health of server.

Usage

Import

import "github.com/ngamux/middleware/authjwt"

Instance With Default Config

authjwtMiddleware := authjwt.New()

Instance With Custom Config

authjwtMiddleware := authjwt.New(authjwt.Config{
	SigningKey: []byte("123123123"),
	Header:     "X-API-Key",
})

Mount to Ngamux

mux := ngamux.New()
mux.Use(authjwtMiddleware)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorForbidden = errors.New("forbidden")
)

Functions

func New

func New(configs ...Config) func(next http.HandlerFunc) http.HandlerFunc

Types

type Config

type Config struct {
	SigningKey   []byte
	ContextKey   string
	Header       string
	ErrorHandler func(rw http.ResponseWriter, err error)
}

Jump to

Keyboard shortcuts

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