Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSignature = errors.New("Token signature invalid")
ErrSignature is returned by jwt.Service.Verify method when the token signature is invalid.
Functions ¶
This section is empty.
Types ¶
type CustomClaims ¶
type CustomClaims struct { Username string `json:"username"` jwt.StandardClaims }
CustomClaims hold the extended claims for the application. i.e. standard claims and the username
type FilePrivateKeyReader ¶
type FilePrivateKeyReader struct {
KeyPath string
}
FilePrivateKeyReader implements PrivateKeyReader.
func (FilePrivateKeyReader) Read ¶
func (r FilePrivateKeyReader) Read() ([]byte, error)
Read a private key from a local file
type PrivateKeyReader ¶
PrivateKeyReader depicts the interface to read a private key from a location.
type Service ¶
type Service struct {
PrivateKeyReader PrivateKeyReader
}
Service exhibits the methods one can call on a jwt.Service. It has a PrivateKeyReader to read a private key from a location depending the implementation.
func (Service) Verify ¶
Verify a token. Returns false along with the associated error
if the private key cannot be read if the key cannot be parsed if the claims cannot be parsed if the claims are not of type jwt.CustomClaims.
Returns false and jwt.ErrSignature if the token signature is invalid. Returns true if the verification is successfull.