jwt

package
v0.0.0-...-d07672d Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConstJwtExtMetadataKey            = "JWT_EXT_METADATA_DxesDCH7matc2VnPO7JuzE6s"
	ConstDefaultJwtTokenExpireSecords = 86400
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTokenResponse

type CreateTokenResponse struct {
	Token    string `json:"token,omitempty" yaml:"token,omitempty"`
	ExpireAt int64  `json:"expireAt,omitempty" yaml:"expireAt,omitempty"`
}

type FeatureOpts

type FeatureOpts struct {
	EnableMetrics bool `json:"enableMetrics,omitempty" yaml:"enableMetrics,omitempty"` // 开启 metrics 记录
}

func NewDefaultFeatureOpts

func NewDefaultFeatureOpts() *FeatureOpts

type JsonWebToken

type JsonWebToken struct {
	// contains filtered or unexported fields
}

func NewJsonWebToken

func NewJsonWebToken(jwtConf *JsonWebTokenConfig, featureOpts *FeatureOpts) *JsonWebToken

func (*JsonWebToken) JwtAuthenticator

func (t *JsonWebToken) JwtAuthenticator() gin.HandlerFunc

func (*JsonWebToken) RouteHandler

func (t *JsonWebToken) RouteHandler(rg *gin.RouterGroup)

func (*JsonWebToken) Stop

func (t *JsonWebToken) Stop()

type JsonWebTokenConfig

type JsonWebTokenConfig struct {
	TokenExpireSecords uint32                                      `json:"tokenExpireSecords,omitempty" yaml:"tokenExpireSecords,omitempty"`
	LoginAuthFunc      func() bool                                 `json:"-" yaml:"-"`
	GetExtMetadataFunc func(c *gin.Context) map[string]interface{} `json:"-" yaml:"-"`
	Logger             *zap.SugaredLogger                          `json:"-" yaml:"-"`
}

func NewDefaultJsonWebTokenConfig

func NewDefaultJsonWebTokenConfig() *JsonWebTokenConfig

Jump to

Keyboard shortcuts

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