Documentation
¶
Index ¶
- type BaseJWK
- type Claims
- type ClaimsOptions
- type JWKS
- type Key
- type KeySet
- type RSAJWK
- type RSAKey
- func (r RSAKey) GetExponent() string
- func (r RSAKey) GetJWK() interface{}
- func (r RSAKey) GetKeyID() string
- func (r RSAKey) GetModulus() string
- func (r RSAKey) GetPublicKey() *rsa.PublicKey
- func (r RSAKey) GetSigningMethod() jwt.SigningMethod
- func (r RSAKey) GetVerificationKey() interface{}
- func (r RSAKey) GetX5T() string
- func (r RSAKey) SignToken(token *jwt.Token) (string, error)
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseJWK ¶
type BaseJWK struct {
// Algorithm is the algorithm intended for use with the key.
Algorithm string `json:"alg"`
// KeyType is the cryptographic algorithm family used with the key.
KeyType string `json:"kty"`
// KeyID matches a specific key.
KeyID string `json:"kid"`
}
BaseJWK defines JSON web key fields returned by all key types.
type Claims ¶
type Claims struct {
jwt.StandardClaims
}
Claims are JSON web token claims.
func NewClaims ¶
func NewClaims(opts ClaimsOptions) *Claims
NewClaims generates new claims for a JSON web token.
type ClaimsOptions ¶
ClaimsOptions are options for creating a JSON web token.
type Key ¶
type Key interface {
// GetSigningMethod gets the signing method.
GetSigningMethod() jwt.SigningMethod
// GetJWK gets JSON web key fields.
GetJWK() interface{}
// GetKeyID gets the key identifier.
GetKeyID() string
// GetVerificationKey gets the JSON web token verification key.
GetVerificationKey() interface{}
// Sign signs a JSON web tokens.
SignToken(token *jwt.Token) (string, error)
}
Key is a JSON web key.
type KeySet ¶
type KeySet struct {
// contains filtered or unexported fields
}
KeySet is a JSON web key set.
func (KeySet) GetVerificationKey ¶
GetVerificationKey gets the JSON web token verification key.
type RSAJWK ¶
type RSAJWK struct {
BaseJWK
// Modulus is the RSA key's modulus value.
Modulus string `json:"n"`
// Exponent is the RSA key's exponent value.
Exponent string `json:"e"`
// X5T is the X.509 certificate SHA-1 thumbprint.
X5T string `json:"x5t"`
}
RSAJWK defines additional JWK fields included in RSA JSON web keys.
type RSAKey ¶
type RSAKey struct {
// contains filtered or unexported fields
}
RSAKey is an RSA key.
func GenerateRandomRSAKey ¶
GenerateRandomRSAKey generates a random RSA JSON web key.
func (RSAKey) GetExponent ¶
GetExponent gets the Base64urlUInt-encoded RSA exponent value.
func (RSAKey) GetModulus ¶
GetModulus gets the Base64urlUInt-encoded RSA modulus value.
func (RSAKey) GetPublicKey ¶
GetPublicKey gets the public RSA key.
func (RSAKey) GetSigningMethod ¶
func (r RSAKey) GetSigningMethod() jwt.SigningMethod
GetSigningMethod gets the RSA signing method.
func (RSAKey) GetVerificationKey ¶
func (r RSAKey) GetVerificationKey() interface{}
GetVerificationKey gets the JSON web token verification key.
func (RSAKey) GetX5T ¶
GetX5T gets the X.509 certificate SHA-1 thumbprint. https://datatracker.ietf.org/doc/html/rfc7517#section-4.8