jwt

package
v0.0.0-...-6ac1af6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

type JWT

type JWT interface {
	CreateAccessToken(userId uint, userRole string) (Token, error)
	ParseJwtToken(tokenString string) (*JwtClaims, error)
}

func NewJwtManager

func NewJwtManager() JWT

NewJwtManager returns a new JWT manager using JWT config from envs

type JwtClaims

type JwtClaims struct {
	goJwt.RegisteredClaims
	UserId   uint   `json:"user_id"`
	UserRole string `json:"user_role"`
}

type Token

type Token struct {
	Raw       string
	ExpiresAt time.Time
}

Jump to

Keyboard shortcuts

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