validator

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 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")
	NilJwtClaimsError            = errors.New("jwt claims cannot be nil")
	MustBeAccessTokenError       = errors.New("must be access token")
	MustBeRefreshTokenError      = errors.New("must be refresh token")
	NilValidatorError            = errors.New("validator cannot be nil")
)

Functions

This section is empty.

Types

type Ed25519Validator added in v0.7.0

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

Ed25519Validator handles parsing and validation of JWT tokens with ED25519 public key

func NewEd25519Validator added in v0.7.0

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

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

func (*Ed25519Validator) GetClaims added in v0.7.0

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

GetClaims parses and validates the given JWT token string

func (*Ed25519Validator) GetToken added in v0.7.0

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

GetToken parses the given JWT token string

func (*Ed25519Validator) GetValidatedClaims added in v0.7.0

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

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

func (*Ed25519Validator) ValidateClaims added in v0.7.0

func (d *Ed25519Validator) 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
}

Logger is the JWT validator logger

func NewLogger

func NewLogger(logger commonlogger.Logger) (*Logger, error)

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 tokens

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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