jwtT

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	JwtToken            = "token"
	JwtAuth             = "auth"
	JwtMsg              = "msg"
	JwtUser             = "user"
	JwtUsername         = "username"
	JwtTokenError       = "jwt is error"
	JwtTokenExpired     = "jwt is expired"
	JwtTokenNotValidYet = "jwt is not valid yet"
)

Variables

View Source
var DefaultJwtConfig = &JwtConfig{
	JwtExpiresTime: 60 * 60 * 24 * 7,
	JwtSigningKey:  "tinytok",
}

Functions

func Auth

func Auth() gin.HandlerFunc

func CreateToken

func CreateToken(claims *UserClaims) (string, error)

func RefreshToken

func RefreshToken(tokenString string) (string, error)

Types

type JwtConfig

type JwtConfig struct {
	JwtExpiresTime int
	JwtSigningKey  string
}

type UserClaims

type UserClaims struct {
	Name   string
	UserID int
	jwt.StandardClaims
}

func ParseToken

func ParseToken(tokenString string) (*UserClaims, error)

Jump to

Keyboard shortcuts

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