jwt

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckToken

func CheckToken(c *gin.Context)

func GenerateToken

func GenerateToken(uid string) (string, error)

func GenerateTokenWithTimeout

func GenerateTokenWithTimeout(uid string, timeout time.Duration) (string, error)

func RefreshToken

func RefreshToken(c *gin.Context) (string, bool)

func RefreshTokenByToken

func RefreshTokenByToken(token string, timeout ...time.Duration) (newToken string, err error)

func SetOption

func SetOption(opfs ...func(opt *Option))

func Uid

func Uid(c *gin.Context) (string, bool)

Types

type Claims

type Claims struct {
	Uid string `json:"uid"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string) (*Claims, error)

type Option

type Option struct {
	TokenHeaderKey string
	Secret         string
	Timeout        time.Duration
}

Jump to

Keyboard shortcuts

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