Documentation ¶
Overview ¶
Package to verify tokens
Index ¶
Constants ¶
View Source
const (
// Environment variable to point to path of the public key file
EnvPublicKeyPath = "PUBLIC_KEY_PATH"
)
Variables ¶
View Source
var ( // Token could not be recognized in authorizationString ErrTokenNotFound = errors.New("token not found") // Claim doesn't match content from token ErrClaimCouldNotBeParsed = errors.New("claim could not be parsed") // Token is not valid. Maybe it is expired or doesn't match the public key ErrTokenNotValid = errors.New("token is not valid") // Public key from environment variable PUBLIC_KEY_PATH couldn't be read ErrWhileReadingKey = errors.New("error while reading public key") // Public key seams to not have the valid format ErrWhileParsingKey = errors.New("error while parsing public key") )
Functions ¶
This section is empty.
Types ¶
type JWTParser ¶
type JWTParser struct {
// contains filtered or unexported fields
}
Struct to parse and validate jwt tokens
type ParseTokenRecord ¶ added in v0.3.0
type ParseTokenRecord struct {
AuthorizationString string
}
type ParseTokenResponse ¶ added in v0.3.0
type Parser ¶
Interface fo pars and validate tokens
func NewJWTParser ¶
Constructor to create jwt parser. public key path have to be set under environment variable PUBLIC_KEY_PATH
type ParserMock ¶ added in v0.3.0
type ParserMock struct { ParseTokenRecordArray []*ParseTokenRecord ParseTokenResponseArray []*ParseTokenResponse }
func (*ParserMock) ParseToken ¶ added in v0.3.0
func (mock *ParserMock) ParseToken(authorizationString string) (*adapter.Claims, error)
Click to show internal directories.
Click to hide internal directories.