jwt

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExceptLocalhost

func ExceptLocalhost() gin.HandlerFunc

func GenerateToken

func GenerateToken(username, password string, id int, issuer string, t time.Duration) (string, error)

func GetAccessToken

func GetAccessToken(username, pwd string, id int) string

get AccessToken

func GetRefreshToken

func GetRefreshToken(username, pwd string, id int) string

func JWT

func JWT() gin.HandlerFunc

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	Password string `json:"password"`
	ID       int    `json:"id"`
	jwt.RegisteredClaims
}

func ParseToken

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

func Validate

func Validate(token string) (*Claims, int)

Jump to

Keyboard shortcuts

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