authorization

package
v0.0.0-...-d66a43f Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	TD entity.TokenDetails
	jwt.StandardClaims
}

type JWTConfiguration

type JWTConfiguration func(*JWTService) error

func WithRedisCacheRepository

func WithRedisCacheRepository(config config.Redis) JWTConfiguration

type JWTService

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

func New

func New(cfgs ...JWTConfiguration) (*JWTService, error)

func (*JWTService) CreateTokensAndMetaData

func (j *JWTService) CreateTokensAndMetaData(username string) (*entity.TokenDetails, error)

Generate Both access token and refresh token and set them in redis as well

func (*JWTService) Middleware

func (r *JWTService) Middleware() gin.HandlerFunc

func (*JWTService) VerifyToken

func (j *JWTService) VerifyToken(tokenString, secret string) (*jwt.Token, error)

Verify JWT based on given secret which can be for accesstoken and refreshtoken

Jump to

Keyboard shortcuts

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