jwt

package
v0.0.0-...-05d1b2a Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) (*jwt.GinJWTMiddleware, error)

Types

type Option

type Option func(*Options)

func Authenticator

func Authenticator(f func(c *gin.Context) (any, error)) Option

func CookieName

func CookieName(cookieName string) Option

func Key

func Key(key string) Option

func LoginResponse

func LoginResponse(f func(c *gin.Context, code int, token string, expire time.Time)) Option

func LogoutResponse

func LogoutResponse(f func(c *gin.Context, code int)) Option

func MaxRefresh

func MaxRefresh(t time.Duration) Option

func RefreshResponse

func RefreshResponse(f func(c *gin.Context, code int, token string, expire time.Time)) Option

func Timeout

func Timeout(t time.Duration) Option

func TokenLookup

func TokenLookup(tokenLookup string) Option

func Unauthorized

func Unauthorized(f func(c *gin.Context, code int, message string)) Option

type Options

type Options struct {
	Key             string
	Timeout         time.Duration
	MaxRefresh      time.Duration
	TokenLookup     string
	Authenticator   func(c *gin.Context) (any, error)
	LoginResponse   func(c *gin.Context, code int, token string, expire time.Time)
	LogoutResponse  func(c *gin.Context, code int)
	Unauthorized    func(c *gin.Context, code int, message string)
	RefreshResponse func(c *gin.Context, code int, token string, expire time.Time)
	SendCookie      bool
	CookieName      string
}

Jump to

Keyboard shortcuts

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