gjwt

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromAuthHeader

func FromAuthHeader(r *http.Request) (string, error)

func FromContext

func FromContext(ctx context.Context) (jwt.Claims, bool)

func GetJWTTokenStr

func GetJWTTokenStr(r *http.Request) string

func OnError

func OnError(w http.ResponseWriter, r *http.Request, err string)

func WithClaims

func WithClaims(ctx context.Context, claims jwt.Claims) context.Context

Types

type Middleware

type Middleware struct {
	Options Options
}

func New

func New(opts Options) *Middleware

func (*Middleware) CheckJWT

func (m *Middleware) CheckJWT(w http.ResponseWriter, r *http.Request) (*http.Request, error)

func (*Middleware) CheckJWTTCP

func (m *Middleware) CheckJWTTCP(token string) (jwt.Claims, error)

func (*Middleware) Handler

func (m *Middleware) Handler(h http.Handler) http.Handler

type Options

type Options struct {
	KeyGetter     jwt.Keyfunc
	NewClaimsFunc func() jwt.Claims
	SigningMethod jwt.SigningMethod
	ErrorHandler  errorHandler
}

Jump to

Keyboard shortcuts

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