jwt

package
v0.0.0-...-8a3df02 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserIdContextKey    contextKey = "userId"
	UserEmailContextKey contextKey = "userEmail"
	UserRolesContextKey contextKey = "userRole"
)

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(publicKey rsa.PublicKey) func(http.Handler) http.Handler

func CreateJwt

func CreateJwt(privateKey *rsa.PrivateKey, expirationTime time.Time, claims JwtCustomClaims, jti *string) (string, error)

Types

type JwtClaims

type JwtClaims struct {
	*JwtCustomClaims
	jwt.RegisteredClaims
}

func VerifyJwt

func VerifyJwt(tokenString string, publicKey *rsa.PublicKey) (*JwtClaims, error)

type JwtCustomClaims

type JwtCustomClaims struct {
	Email string
	Sub   string
	Role  int
}

func GetClaimsFromAccountData

func GetClaimsFromAccountData(accounId string, accountEmail string, accountRole int) JwtCustomClaims

func GetClaimsFromJwtClaims

func GetClaimsFromJwtClaims(claims JwtClaims) JwtCustomClaims

Jump to

Keyboard shortcuts

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