ginjwt

package module
v0.0.0-...-5cb455f Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: GPL-2.0 Imports: 6 Imported by: 0

README

Jwt Authentication middleware for gin framework


base on lestrrat-go/jwx module

Documentation

Index

Constants

View Source
const (
	Header fetchType = iota
	Cookie
)

Variables

View Source
var (
	ErrorUnauthorized = fmt.Errorf("login required")
)

Functions

This section is empty.

Types

type JwtAuthMiddleware

type JwtAuthMiddleware interface {
	AuthenticationMiddleware() gin.HandlerFunc
	LoginRequiredMiddleware() gin.HandlerFunc
	LoginHandler()
	// contains filtered or unexported methods
}

type JwtAuthentication

type JwtAuthentication struct {
	Authenticator func(c *gin.Context) (interface{}, error)
	Authorizator  func(data interface{}) (interface{}, error)
	SecretKey     interface{}
	Algorithm     jwa.SignatureAlgorithm
	IdentityKey   string
	TokenLookup   TokenLookup
	TokenHeadName string
}

func (*JwtAuthentication) AuthenticationMiddleware

func (ja *JwtAuthentication) AuthenticationMiddleware() gin.HandlerFunc

func (*JwtAuthentication) LoginHandler

func (ja *JwtAuthentication) LoginHandler(c *gin.Context)

func (*JwtAuthentication) LoginRequiredMiddleware

func (ja *JwtAuthentication) LoginRequiredMiddleware() gin.HandlerFunc

type TokenLookup

type TokenLookup struct {
	From fetchType
	Name string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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