Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrEmptyJWK = fmt.Errorf("specified JWK is empty")
)
Functions ¶
This section is empty.
Types ¶
type JWK ¶
type JWK struct { // Alg specifies cryptographic algorithm used with the key. Ex.: "RS256" Alg string `json:"alg" yaml:"alg"` // Kty specifies family of cryptographic algorithms used with the key. Ex.: "RSA" Kty string `json:"kty" yaml:"kty"` // Use specifies how the key was meant to be used; Ex.: "sig" represents the signature. Use string `json:"use" yaml:"use"` // N specifies modulus for the RSA public key. Ex.: "vY07WxvavajnrJRe6...." N string `json:"n" yaml:"n"` // E specifies exponent for the RSA public key. Ex.: "AQAB" E string `json:"e" yaml:"e"` // Kid specifies identifier of the key. Ex.: "M_XXXX-n" Kid string `json:"kid" yaml:"kid"` // X5t specifies thumbprint of the x.509 cert (SHA-1 thumbprint). Ex.: "kXXNB-yYYYYYt" X5t string `json:"x5t" yaml:"x5t"` // X5c specifies x.509 certificate chain. // X5c[0] is the certificate to use for token verification // X5c[1:] [OPTIONAL, not necessary to be included] can be used to verify X5c[0]. X5c []string `json:"x5c" yaml:"x5c"` File string `json:"file,omitempty" yaml:"file,omitempty"` Data string `json:"data,omitempty" yaml:"data,omitempty"` // PublicKey is a parsed public key extracted from X5c chain PublicKey *rsa.PublicKey }
JWK specifies one JSON Web Key
type JWKS ¶
type JWKS struct { // Keys is a set of keys - main part of the JWKS Keys []*JWK `json:"keys,omitempty" yaml:"keys,omitempty"` // File specifies what JSON-containing file to read keys (key set) from. File string `json:"file,omitempty" yaml:"file,omitempty"` // URL specifies what JSON-containing url to read keys (key set) from. URL string `json:"url,omitempty" yaml:"url,omitempty"` // Data specifies JSON-string with keys (key set) to be parsed. Data string `json:"data,omitempty" yaml:"data,omitempty"` }
JWKS specifies JSON Web Key Set (JWKS). JWKS is a set of public keys used to verify JWT issued by authorization server See more for details: https://auth0.com/docs/security/tokens/json-web-tokens/json-web-key-sets
func NewFromBytes ¶
NewFromBytes creates new JWKS from JSON bytes
func NewFromFile ¶
NewFromFile creates new JWKS from file with JSON
func NewFromReader ¶
NewFromReader creates new JWKS from reader which providers JSON
func NewFromString ¶
NewFromString creates new JWKS from JSON string
func NewFromURL ¶
NewFromURL creates new JWKS from URL which providers JSON
func (*JWKS) GetVerificationPublicKey ¶
func (jwks *JWKS) GetVerificationPublicKey(token *jwt.Token, fallbackToDefault bool) (*rsa.PublicKey, error)
GetVerificationPublicKey searches for cert specified in token's header
Click to show internal directories.
Click to hide internal directories.