authjwt

package
v0.0.0-...-2da11fd Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 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 ngamux.Handler) ngamux.Handler

Types

type Config

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

Jump to

Keyboard shortcuts

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