Documentation
¶
Index ¶
- Constants
- func UnsecuredJWTVerifier() jose.SignatureVerifier
- func VerifyEdDSA(pubKey interface{}, message, signature []byte) error
- func VerifyRS256(pubKey interface{}, message, signature []byte) error
- type BasicVerifier
- type Claims
- type JSONWebToken
- func (j *JSONWebToken) DecodeClaims(c interface{}) error
- func (j *JSONWebToken) LookupStringHeader(name string) string
- func (j *JSONWebToken) SerializeSigned(signer jose.Signer, detached bool) (string, error)
- func (j *JSONWebToken) SerializeUnsecured(extraHeaders map[string]interface{}, detached bool) (string, error)
- type KeyResolver
- type ParseOpt
Constants ¶
const ( // TypeJWT defines JWT type TypeJWT = "JWT" // AlgorithmNone used to indicate unsecured JWT AlgorithmNone = "none" )
Variables ¶
This section is empty.
Functions ¶
func UnsecuredJWTVerifier ¶
func UnsecuredJWTVerifier() jose.SignatureVerifier
UnsecuredJWTVerifier provides verifier for unsecured JWT.
func VerifyEdDSA ¶
VerifyEdDSA verifies EdDSA signature.
func VerifyRS256 ¶
VerifyRS256 verifies RS256 signature.
Types ¶
type BasicVerifier ¶
type BasicVerifier struct {
// contains filtered or unexported fields
}
BasicVerifier defines basic Signed JWT verifier based on Issuer Claim and Key ID JOSE Header.
func NewVerifier ¶
func NewVerifier(resolver KeyResolver) *BasicVerifier
NewVerifier creates a new basic Verifier.
type Claims ¶
Claims defines JSON Web Token Claims (https://tools.ietf.org/html/rfc7519#section-4)
type JSONWebToken ¶
type JSONWebToken struct { Headers jose.Headers Payload map[string]interface{} // contains filtered or unexported fields }
JSONWebToken defines JSON Web Token (https://tools.ietf.org/html/rfc7519)
func New ¶
func New(claims interface{}) (*JSONWebToken, error)
New creates new JSON Web Token based on input claims.
func Parse ¶
func Parse(jwtSerialized string, opts ...ParseOpt) (*JSONWebToken, error)
Parse parses input JWT in serialized form into JSON Web Token. Currently JWS and unsecured JWT is supported.9
func (*JSONWebToken) DecodeClaims ¶
func (j *JSONWebToken) DecodeClaims(c interface{}) error
DecodeClaims fills input c with claims of a token.
func (*JSONWebToken) LookupStringHeader ¶
func (j *JSONWebToken) LookupStringHeader(name string) string
LookupStringHeader makes look up of particular header with string value.
func (*JSONWebToken) SerializeSigned ¶
SerializeSigned makes (compact) serialization of token.
func (*JSONWebToken) SerializeUnsecured ¶
func (j *JSONWebToken) SerializeUnsecured(extraHeaders map[string]interface{}, detached bool) (string, error)
SerializeUnsecured build unsecured JWT.
type KeyResolver ¶
type KeyResolver interface { // Resolve resolves public key. Resolve(what, kid string) (interface{}, error) }
KeyResolver resolves public key based on what and kid.
type ParseOpt ¶
type ParseOpt func(opts *parseOpts)
ParseOpt is the JWT Parser option.
func WithJWTDetachedPayload ¶
WithJWTDetachedPayload option is for definition of JWT detached payload.
func WithSignatureVerifier ¶
func WithSignatureVerifier(signatureVerifier jose.SignatureVerifier) ParseOpt
WithSignatureVerifier option is for definition of JWT detached payload.