Documentation ¶
Index ¶
Constants ¶
View Source
const (
// JwtIdentifierPrefix is the prefix of the JWT Identifier key
JwtIdentifierPrefix = "jwt_id"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultTokenValidator ¶
type DefaultTokenValidator struct {
// contains filtered or unexported fields
}
DefaultTokenValidator struct
func NewDefaultTokenValidator ¶
func NewDefaultTokenValidator(redisClient *redis.Client) (*DefaultTokenValidator, error)
NewDefaultTokenValidator creates a new token validator
func (*DefaultTokenValidator) AddToken ¶
func (d *DefaultTokenValidator) AddToken(jwtId string, period time.Duration) error
AddToken adds the JWT Identifier with the given expiration period
func (*DefaultTokenValidator) GetKey ¶
func (d *DefaultTokenValidator) GetKey(jwtId string) string
GetKey gets the JWT Identifier key
func (*DefaultTokenValidator) IsTokenValid ¶
func (d *DefaultTokenValidator) IsTokenValid(jwtId string) (bool, error)
IsTokenValid checks if the token is valid
func (*DefaultTokenValidator) RevokeToken ¶
func (d *DefaultTokenValidator) RevokeToken(jwtId string) error
RevokeToken revokes the JWT Identifier by setting the value to false
Click to show internal directories.
Click to hide internal directories.