- type ClaimSet
- type Header
- type ResourceActions
- type Token
- type VerifyOptions
const ( // TokenSeparator is the value which separates the header, claims, and // signature in the compact serialization of a JSON Web Token. TokenSeparator = "." // Leeway is the Duration that will be added to NBF and EXP claim // checks to account for clock skew as per https://tools.ietf.org/html/rfc7519#section-4.1.5 Leeway = 60 * time.Second )
Errors used and exported by this package.
Errors used by token parsing and verification.
This section is empty.
ClaimSet describes the main section of a JSON Web Token.
Header describes the header section of a JSON Web Token.
type ResourceActions ¶
ResourceActions stores allowed actions on a named and typed resource.
Token describes a JSON Web Token.
NewToken parses the given raw token string and constructs an unverified JSON Web Token.
Verify attempts to verify this token using the given options. Returns a nil error if the token is valid.
func (*Token) VerifySigningKey ¶
func (t *Token) VerifySigningKey(verifyOpts VerifyOptions) (signingKey libtrust.PublicKey, err error)
VerifySigningKey attempts to get the key which was used to sign this token. The token header should contain either of these 3 fields:
`x5c` - The x509 certificate chain for the signing key. Needs to be verified. `jwk` - The JSON Web Key representation of the signing key. May contain its own `x5c` field which needs to be verified. `kid` - The unique identifier for the key. This library interprets it as a libtrust fingerprint. The key itself can be looked up in the trustedKeys field of the given verify options.
Each of these methods are tried in that order of preference until the signing key is found or an error is returned.