redis

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToParseBoolValue = "failed to parse bool value: %v"
)
View Source
var (
	// JwtIdentifierPrefix is the prefix of the JWT Identifier key
	JwtIdentifierPrefix = "jti"
)

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) (
	*TokenValidatorService,
	error,
)

NewTokenValidatorService creates a new token validator service

func (*TokenValidatorService) Delete

func (d *TokenValidatorService) Delete(jti string) error

Delete deletes the token

func (*TokenValidatorService) Get

func (d *TokenValidatorService) Get(jti string) (interface{}, error)

Get gets the token

func (*TokenValidatorService) GetKey

func (d *TokenValidatorService) GetKey(jti string) string

GetKey gets the JWT Identifier key

func (*TokenValidatorService) Has

func (d *TokenValidatorService) Has(jti string) (bool, error)

Has checks if the token is valid

func (*TokenValidatorService) Set

func (d *TokenValidatorService) Set(
	jti string,
	value interface{},
	expiresAt time.Time,
) error

Set sets the token with the value and period

Jump to

Keyboard shortcuts

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