Documentation ¶
Index ¶
- Variables
- type ClaimsValidator
- type Ed25519Validator
- func (d *Ed25519Validator) GetClaims(rawToken string) (*jwt.MapClaims, error)
- func (d *Ed25519Validator) GetToken(rawToken string) (*jwt.Token, error)
- func (d *Ed25519Validator) GetValidatedClaims(rawToken string, interception gojwtinterception.Interception) (*jwt.MapClaims, error)
- func (d *Ed25519Validator) ValidateClaims(rawToken string, interception gojwtinterception.Interception) (*jwt.MapClaims, error)
- type Logger
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ( NilValidatorError = errors.New("validator cannot be nil") InvalidTokenError = errors.New("invalid token") UnexpectedSigningMethodError = errors.New("unexpected signing method") InvalidClaimsError = errors.New("invalid claims") NilClaimsError = errors.New("claims cannot be nil") NilClaimsValidatorError = errors.New("claims validator cannot be nil") )
Functions ¶
This section is empty.
Types ¶
type ClaimsValidator ¶
type ClaimsValidator interface {
ValidateClaims(claims *jwt.MapClaims, interception gojwtinterception.Interception) (bool, error)
}
ClaimsValidator interface
type Ed25519Validator ¶
type Ed25519Validator struct {
// contains filtered or unexported fields
}
Ed25519Validator handles parsing and validation of JWT tokens with ED25519 public key
func NewEd25519Validator ¶
func NewEd25519Validator( publicKey []byte, claimsValidator ClaimsValidator, mode *goflagmode.Flag, ) (*Ed25519Validator, error)
NewEd25519Validator returns a new validator by parsing the given file path as an ED25519 public key
func (*Ed25519Validator) GetClaims ¶
func (d *Ed25519Validator) GetClaims(rawToken string) ( *jwt.MapClaims, error, )
GetClaims parses and validates the given JWT raw token
func (*Ed25519Validator) GetToken ¶
func (d *Ed25519Validator) GetToken(rawToken string) (*jwt.Token, error)
GetToken parses the given JWT raw token
func (*Ed25519Validator) GetValidatedClaims ¶
func (d *Ed25519Validator) GetValidatedClaims( rawToken string, interception gojwtinterception.Interception, ) ( *jwt.MapClaims, error, )
GetValidatedClaims parses, validates and returns the claims of the given JWT raw token
func (*Ed25519Validator) ValidateClaims ¶
func (d *Ed25519Validator) ValidateClaims( rawToken string, interception gojwtinterception.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 (*Logger) MissingTokenClaimsUserId ¶
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(rawToken string) (*jwt.Token, error) GetClaims(rawToken string) (*jwt.MapClaims, error) GetValidatedClaims( rawToken string, interception gojwtinterception.Interception, ) (*jwt.MapClaims, error) }
Validator does parsing and validation of JWT tokens