redis

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// JwtIdentifierPrefix is the prefix of the JWT Identifier key
	JwtIdentifierPrefix = "jti"

	// JwtIdentifierSeparator is the separator of the JWT identifier prefixes
	JwtIdentifierSeparator = gostringsseparator.Dots
)
View Source
var (
	ErrFailedToParseBoolValue = "failed to parse bool value: %v"
)

Functions

This section is empty.

Types

type TokenValidatorService

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

TokenValidatorService struct

func NewTokenValidatorService

func NewTokenValidatorService(
	redisClient *redis.Client,
	logger *gojwtcache.Logger,
) (
	*TokenValidatorService,
	error,
)

NewTokenValidatorService creates a new token validator service

func (*TokenValidatorService) GetKey

func (d *TokenValidatorService) GetKey(
	token gojwttoken.Token,
	id string,
) (string, error)

GetKey gets the JWT Identifier key

func (*TokenValidatorService) IsValid added in v0.4.7

func (d *TokenValidatorService) IsValid(
	token gojwttoken.Token,
	id string,
) (bool, error)

IsValid checks if the token is valid

func (*TokenValidatorService) Revoke added in v0.4.7

func (d *TokenValidatorService) Revoke(
	token gojwttoken.Token,
	id string,
) error

Revoke revokes the token

func (*TokenValidatorService) Set

func (d *TokenValidatorService) Set(
	token gojwttoken.Token,
	id string,
	isValid bool,
	expiresAt time.Time,
) error

Set sets the token with the value and expiration

Jump to

Keyboard shortcuts

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