Documentation ¶
Index ¶
- Constants
- func IsJWS(s string) bool
- func IsJWTUnsecured(s string) bool
- func UnsecuredJWTVerifier() jose.SignatureVerifier
- func VerifyEdDSA(pubKey *verifier.PublicKey, message, signature []byte) error
- func VerifyRS256(pubKey *verifier.PublicKey, message, signature []byte) error
- type BasicVerifier
- type Claims
- type JSONWebToken
- type KeyResolver
- type KeyResolverFunc
- 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 IsJWTUnsecured ¶ added in v0.1.3
IsJWTUnsecured checks if JWT is an unsecured JWT of valid structure.
func UnsecuredJWTVerifier ¶
func UnsecuredJWTVerifier() jose.SignatureVerifier
UnsecuredJWTVerifier provides verifier for unsecured JWT.
func VerifyEdDSA ¶
VerifyEdDSA verifies EdDSA 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 NewUnsecured ¶ added in v0.1.3
func NewUnsecured(claims interface{}, headers jose.Headers) (*JSONWebToken, error)
NewUnsecured creates new unsecured 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.
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.
type KeyResolver ¶
type KeyResolver interface { // Resolve resolves public key. Resolve(what, kid string) (*verifier.PublicKey, error) }
KeyResolver resolves public key based on what and kid.
type KeyResolverFunc ¶ added in v0.1.3
KeyResolverFunc defines function.
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.