validator

package
v0.6.49 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InvalidTokenError            = errors.New("invalid token")
	UnexpectedSigningMethodError = errors.New("unexpected signing method")
	InvalidClaimsError           = errors.New("invalid claims")
	IRTNotValidError             = errors.New("irt not valid")
	IdentifierNotValidError      = errors.New("jwt_id not valid")
	MustBeAccessTokenError       = errors.New("must be access token")
	MustBeRefreshTokenError      = errors.New("must be refresh token")
)

Functions

This section is empty.

Types

type DefaultValidator

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

DefaultValidator struct

func NewDefaultValidator

func NewDefaultValidator(
	publicKey []byte, tokenValidator commonjwtvalidatorgrpc.TokenValidator, mode *commonflag.ModeFlag,
) (*DefaultValidator, error)

NewDefaultValidator returns a new validator by parsing the given file path as an ED25519 public key

func (*DefaultValidator) GetClaims

func (d *DefaultValidator) GetClaims(tokenString string) (
	*jwt.MapClaims, error,
)

GetClaims parses and validates the given JWT token string

func (*DefaultValidator) GetToken

func (d *DefaultValidator) GetToken(tokenString string) (*jwt.Token, error)

GetToken parses the given JWT token string

func (*DefaultValidator) GetValidatedClaims added in v0.5.14

func (d *DefaultValidator) GetValidatedClaims(
	token string,
	interception pbtypesgrpc.Interception,
) (
	*jwt.MapClaims, error,
)

GetValidatedClaims parses, validates and returns the claims of the given JWT token string

func (*DefaultValidator) ValidateClaims added in v0.5.14

func (d *DefaultValidator) ValidateClaims(
	token string,
	claims *jwt.MapClaims,
	interception pbtypesgrpc.Interception,
) (*jwt.MapClaims, error)

ValidateClaims validates the given claims

type Logger

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

func NewLogger

func NewLogger(logger commonlogger.Logger) Logger

NewLogger creates a new JWT validator logger

func (Logger) MissingTokenClaimsUserId added in v0.6.36

func (l Logger) MissingTokenClaimsUserId()

MissingTokenClaimsUserId logs the missing token claims user ID

func (Logger) ValidatedToken

func (l Logger) ValidatedToken()

ValidatedToken logs a message when the server validates a token

type Validator

type Validator interface {
	GetToken(tokenString string) (*jwt.Token, error)
	GetClaims(tokenString string) (*jwt.MapClaims, error)
	GetValidatedClaims(
		token string,
		interception pbtypesgrpc.Interception,
	) (*jwt.MapClaims, error)
}

Validator does parsing and validation of JWT token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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