jwt

package
v0.0.0-...-6076d7e Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckJWTFromCookie

func CheckJWTFromCookie(reqID uint64, cookie *http.Cookie, jwtKey []byte) error

CheckJWTFromCookie load JWT check from Cookie and check it

func CreateJWT

func CreateJWT(claims *Claims, expirationTime *time.Time, jwtKey []byte) (string, error)

CreateJWT create new JWT

func CreateJWTCookie

func CreateJWTCookie(claims *Claims, jwtExpiresAt int, jwtKey []byte) (*http.Cookie, error)

CreateJWTCookie create new JWT as Cookie

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	jwt.StandardClaims
}

Claims a struct that will be encoded to a JWT. We add jwt.StandardClaims as an embedded type, to provide fields like expiry time

func CheckJWT

func CheckJWT(reqID uint64, tknStr string, jwtKey []byte) (*Claims, error)

CheckJWT check JWT

Jump to

Keyboard shortcuts

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