Documentation ¶
Index ¶
- Constants
- func ClaimNamesText(name string) string
- func Copy(elements map[string]interface{}) (result map[string]interface{})
- func HeaderParameterText(param string) string
- type AuthKey
- func (a *AuthKey) GetSignedKey(token *jwt.Token) (interface{}, error)
- func (a *AuthKey) GetSignedMethod() jwt.SigningMethod
- func (a *AuthKey) GetVerifiedKey(token *jwt.Token) (interface{}, error)
- func (a *AuthKey) IsECMAKey() bool
- func (a *AuthKey) IsRSAKey() bool
- func (a *AuthKey) IsSymmetricKey() bool
- type Claims
- func (c *Claims) Add(key string, value interface{})
- func (c *Claims) FromMap(m map[string]interface{})
- func (c *Claims) FromMapClaims(mc jwt.MapClaims)
- func (c Claims) Get(key string) interface{}
- func (c *Claims) ToMap() map[string]interface{}
- func (c Claims) ToMapClaims() jwt.MapClaims
- func (c *Claims) With(expiry time.Time, scope, audience []string) ClaimsContainer
- func (c *Claims) WithDefaults(iat time.Time, issuer string) ClaimsContainer
- type ClaimsContainer
- type RegisteredClaims
Constants ¶
View Source
const ( // Registered Claim Names ClaimNameIssuer = "iss" // RFC 7519, 4.1.1 ClaimNameSubject = "sub" // RFC 7519, 4.1.2 ClaimNameAudience = "aud" // RFC 7519, 4.1.3 ClaimNameExpirationTime = "exp" // RFC 7519, 4.1.4 ClaimNameNotBefore = "nbf" // RFC 7519, 4.1.5 ClaimNameIssuedAt = "iat" // RFC 7519, 4.1.6 ClaimNameJWTID = "jti" // RFC 7519, 4.1.7 )
See: https://tools.ietf.org/html/rfc7519
View Source
const ( // JOSE Header HeaderParameterType = "type" // RFC 7231, 5.1 HeaderParameterContentType = "cty" // RFC 7231, 5.2 // Replicating Claims as Header Parameters HeaderParameterIssuer = ClaimNameIssuer // RFC 7231, 5.3 RFC 7519, 10.4.1 HeaderParameterSubject = ClaimNameSubject // RFC 7231, 5.3 RFC 7519, 10.4.1 HeaderParameterAudience = ClaimNameAudience // RFC 7231, 5.3 RFC 7519, 10.4.1 HeaderParameterExpirationTime = ClaimNameExpirationTime // RFC 7231, 5.3 HeaderParameterNotBefore = ClaimNameNotBefore // RFC 7231, 5.3 HeaderParameterIssuedAt = ClaimNameIssuedAt // RFC 7231, 5.3 HeaderParameterJWTID = ClaimNameJWTID // RFC 7231, 5.3 )
View Source
const ( SigningMethodNone = "none" SigningMethodHS256 = "HS256" // HS256: HMAC using SHA-256 SigningMethodHS384 = "HS384" // HS384: HMAC using SHA-384 SigningMethodHS512 = "HS512" // HS512: HMAC using SHA-512 SigningMethodRS256 = "RS256" // RS256: RSASSA-PKCS-v1_5 using SHA-256 SigningMethodRS384 = "RS384" // RS384: RSASSA-PKCS-v1_5 using SHA-384 SigningMethodRS512 = "RS512" // RS512: RSASSA-PKCS-v1_5 using SHA-512 SigningMethodPS256 = "PS256" // PS256: RSASSA-PSS using SHA-256 and MGF1 with SHA-256 SigningMethodPS384 = "PS384" // PS384: RSASSA-PSS using SHA-384 and MGF1 with SHA-384 SigningMethodPS512 = "PS512" // PS512: RSASSA-PSS using SHA-512 and MGF1 with SHA-512 SigningMethodES256 = "ES256" // ES256: ECDSA using P-256 and SHA-256 SigningMethodES384 = "ES384" // ES384: ECDSA using P-384 and SHA-384 SigningMethodES512 = "ES512" // ES512: ECDSA using P-521 and SHA-512 )
Variables ¶
This section is empty.
Functions ¶
func ClaimNamesText ¶
ClaimNamesText returns a text for the Claim Names. It returns the empty string if the code is "".
func HeaderParameterText ¶
HeaderParameterText returns a text for the Claim Names. It returns the empty string if the code is "".
Types ¶
type AuthKey ¶
type AuthKey struct {
// contains filtered or unexported fields
}
func NewAuthKey ¶
func NewAuthKey(alg string, privateKey []byte, publicKey []byte, password ...string) (*AuthKey, error)
SymmetricKey : privateKey else: privKey publicKey
func NewAuthKeyFromFile ¶
func NewAuthKeyFromRandom ¶
func (*AuthKey) GetSignedKey ¶
func (*AuthKey) GetSignedMethod ¶
func (a *AuthKey) GetSignedMethod() jwt.SigningMethod
func (*AuthKey) GetVerifiedKey ¶
func (*AuthKey) IsSymmetricKey ¶
type Claims ¶
type Claims struct { RegisteredClaims Scope []string `json:"scope"` Extra map[string]interface{} }
Claims represent a token's claims.
func (*Claims) FromMapClaims ¶
func (c *Claims) FromMapClaims(mc jwt.MapClaims)
FromMapClaims will populate claims from a jwt-go MapClaims representation
func (Claims) ToMapClaims ¶
func (c Claims) ToMapClaims() jwt.MapClaims
ToMapClaims will return a jwt-go MapClaims representation
func (*Claims) With ¶
func (c *Claims) With(expiry time.Time, scope, audience []string) ClaimsContainer
func (*Claims) WithDefaults ¶
func (c *Claims) WithDefaults(iat time.Time, issuer string) ClaimsContainer
type ClaimsContainer ¶
type ClaimsContainer interface { // With returns a copy of itself with expiresAt, scope, audience set to the given values. With(expiry time.Time, scope, audience []string) ClaimsContainer // WithDefaults returns a copy of itself with issuedAt and issuer set to the given default values. If those // values are already set in the claims, they will not be updated. WithDefaults(iat time.Time, issuer string) ClaimsContainer // ToMapClaims returns the claims as a github.com/dgrijalva/jwt-go.MapClaims type. ToMapClaims() jwt.MapClaims }
type RegisteredClaims ¶
type RegisteredClaims struct { Subject string `json:"sub"` Issuer string `json:"iss"` Audience []string `json:"aud"` JWTID string `json:"jti"` IssuedAt time.Time `json:"iat"` NotBefore time.Time `json:"nbf"` ExpiresAt time.Time `json:"exp"` }
func (*RegisteredClaims) SetDefaults ¶
func (c *RegisteredClaims) SetDefaults()
Click to show internal directories.
Click to hide internal directories.