jwtClaims

package
v1.17.33 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	RefreshToken
}

type Claims

type Claims interface {
	jwt.Claims
	GetType() string
}

type ClaimsUser added in v1.17.7

type ClaimsUser interface {
	Claims
	GetUID() uint
	GetUserOperateID() uint64
}

type LoginRedis

type LoginRedis struct {
	UID       uint     `json:"uid"`
	AvatarUrl string   `json:"avatarUrl"`
	Name      string   `json:"name"`
	IP        string   `json:"ip"`
	Groups    []string `json:"groups"`

	AppID uint `json:"appID"`
}

type LoginToken

type LoginToken struct {
	UserClaims
	ID uint64 `json:"id"`
}

type MfaRedis

type MfaRedis struct {
	LoginRedis
	Mfa         string `json:"mfa"`
	AppCallback string `json:"appCallback"`
}

type MfaToken

type MfaToken struct {
	UserClaims
	ID uint64 `json:"id"`
}

type RefreshToken

type RefreshToken struct {
	UserClaims
	ID      uint64 `json:"id"`
	AppCode string `json:"appCode"`
	Payload string `json:"payload,omitempty"`
}

type TypedClaims

type TypedClaims struct {
	jwt.RegisteredClaims
	Type string `json:"type"`
}

TypedClaims type 字段用于区分不同类型的 token,防止类型窜用导致的安全漏洞

func (TypedClaims) GetType

func (c TypedClaims) GetType() string

type U2fToken

type U2fToken struct {
	UserClaims
	ID uint64 `json:"id"`
	IP string `json:"ip"`
}

type UserClaims added in v1.17.7

type UserClaims struct {
	TypedClaims
	// 用户 ID
	UID           uint   `json:"uid"`
	UserOperateID uint64 `json:"oid"`
}

func (UserClaims) GetUID added in v1.17.7

func (u UserClaims) GetUID() uint

func (UserClaims) GetUserOperateID added in v1.17.7

func (u UserClaims) GetUserOperateID() uint64

type UserToken

type UserToken struct {
	UserClaims
	Name   string   `json:"name"`
	Groups []string `json:"groups,omitempty"`
}

Jump to

Keyboard shortcuts

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