validator

package
v0.6.39 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultValidator

type DefaultValidator struct {
	TokenValidator commonjwtvalidatorgrpc.TokenValidator
	// contains filtered or unexported fields
}

DefaultValidator struct

func NewDefaultValidator

func NewDefaultValidator(
	publicKey []byte, tokenValidator commonjwtvalidatorgrpc.TokenValidator,
) (*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 pbconfiggrpc.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 pbconfiggrpc.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 pbconfiggrpc.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