Documentation ¶
Index ¶
- Constants
- Variables
- type JWT
- func (tok *JWT) GetALG() string
- func (tok *JWT) GetAUD() string
- func (tok *JWT) GetCRIT() []string
- func (tok *JWT) GetCTY() string
- func (tok *JWT) GetClaim(key string) interface{}
- func (tok *JWT) GetEXP() *time.Time
- func (tok *JWT) GetHeaderParameter(key string) interface{}
- func (tok *JWT) GetIAT() *time.Time
- func (tok *JWT) GetISS() string
- func (tok *JWT) GetJKU() string
- func (tok *JWT) GetJTI() string
- func (tok *JWT) GetJWK() string
- func (tok *JWT) GetKID() string
- func (tok *JWT) GetNBF() *time.Time
- func (tok *JWT) GetSUB() string
- func (tok *JWT) GetTYP() string
- func (tok *JWT) GetX5T() string
- func (tok *JWT) GetX5TS256() string
- func (tok *JWT) GetX5U() string
- func (tok *JWT) Serialize() ([]byte, error)
- func (tok *JWT) SerializeCompact() ([]byte, error)
- func (tok *JWT) SetAUD(aud string) *JWT
- func (tok *JWT) SetCRIT(crit []string) *JWT
- func (tok *JWT) SetCTY(cty string) *JWT
- func (tok *JWT) SetClaim(key string, val interface{}) *JWT
- func (tok *JWT) SetEXP(exp *time.Time) *JWT
- func (tok *JWT) SetHeaderParameter(key string, val interface{}) *JWT
- func (tok *JWT) SetIAT(iat *time.Time) *JWT
- func (tok *JWT) SetISS(iss string) *JWT
- func (tok *JWT) SetJKU(jku string) *JWT
- func (tok *JWT) SetJTI(jti string) *JWT
- func (tok *JWT) SetJWK(jwk string) *JWT
- func (tok *JWT) SetKID(kid string) *JWT
- func (tok *JWT) SetNBF(nbf *time.Time) *JWT
- func (tok *JWT) SetSUB(sub string) *JWT
- func (tok *JWT) SetTYP(typ string) *JWT
- func (tok *JWT) SetX5T(x5t string) *JWT
- func (tok *JWT) SetX5TS256(x5fs256 string) *JWT
- func (tok *JWT) SetX5U(x5u string) *JWT
- func (tok *JWT) Sign(alg string, key interface{}) error
- func (tok *JWT) Verify(key interface{}) error
- func (tok *JWT) VerifyALG() error
- func (tok *JWT) VerifyAUD() error
- func (tok *JWT) VerifyCRIT() error
- func (tok *JWT) VerifyCTY() error
- func (tok *JWT) VerifyEXP() error
- func (tok *JWT) VerifyIAT() error
- func (tok *JWT) VerifyISS() error
- func (tok *JWT) VerifyJKU() error
- func (tok *JWT) VerifyJTI() error
- func (tok *JWT) VerifyJWK() error
- func (tok *JWT) VerifyKID() error
- func (tok *JWT) VerifyNBF() error
- func (tok *JWT) VerifySUB() error
- func (tok *JWT) VerifyTYP() error
- func (tok *JWT) VerifyX5T() error
- func (tok *JWT) VerifyX5TS256() error
- func (tok *JWT) VerifyX5U() error
Constants ¶
View Source
const ( // ECDSA using P-256 and SHA-256 ES256 = "ES256" // ECDSA using P-384 and SHA-384 ES384 = "ES384" // ECDSA using P-521 and SHA-512 ES512 = "ES512" // HMAC using SHA-256 HS256 = "HS256" // HMAC using SHA-384 HS384 = "HS384" // HMAC using SHA-512 HS512 = "HS512" // RSASSA-PSS using SHA-256 and MGF1 with SHA-256 PS256 = "PS256" // RSASSA-PSS using SHA-384 and MGF1 with SHA-384 PS384 = "PS384" // RSASSA-PSS using SHA-512 and MGF1 with SHA-512 PS512 = "PS512" // RSASSA-PKCS1-v15 using SHA-256 RS256 = "RS256" // RSASSA-PKCS1-v15 using SHA-384 RS384 = "RS384" // RSASSA-PKCS1-v15 using SHA-512 RS512 = "RS512" // None NONE = "none" )
Algorithms
View Source
const ( // ISS represents the "iss" (Issuer) registered claim name. See // https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1 for more // information. ISS = "iss" // SUB represents the "sub" (Subject) registered claim name. See // https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2 for more // information. SUB = "sub" // AUD represents the "aud" (Audience) claim. See // https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3 for more // information. AUD = "aud" // EXP represents the "exp" (Expiration Time) claim. See // https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4 for more // information. EXP = "exp" // NBF represents the "nbf" (Not Before) claim. See // https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.5 for more // information. NBF = "nbf" // IAT represents the "iat" (Issued At) claim. See // https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.6 for more // information. IAT = "iat" // JTI represents the "jti" (JWT ID) claim. See // https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.7 for more // information. JTI = "jti" )
Registered Claim Names
View Source
const ( // Algorithm ALG = "alg" // Critical CRIT = "crit" // Content-Type CTY = "cty" // JWK URL JKU = "jku" // JWK JWK = "jwk" // ... KID = "kid" // Type TYP = "typ" // ... X5TS256 = "x5t#S256" // ... X5T = "x5t" // ... X5U = "x5u" )
Registered Header Parameter Names
Variables ¶
View Source
var ( ErrorInvalidALG = errors.New("invalid claim: 'ALG'") ErrorInvalidAUD = errors.New("invalid claim: 'AUD'") ErrorInvalidEXP = errors.New("invalid claim: 'EXP'") ErrorInvalidIAT = errors.New("invalid claim: 'IAT'") ErrorInvalidISS = errors.New("invalid claim: 'ISS'") ErrorInvalidJTI = errors.New("invalid claim: 'JTI'") ErrorInvalidNBF = errors.New("invalid claim: 'NBF'") ErrorInvalidSUB = errors.New("invalid claim: 'SUB'") ErrorInvalidCRIT = errors.New("invalid claim: 'CRIT'") ErrorInvalidCTY = errors.New("invalid claim: 'CTY'") ErrorInvalidJKU = errors.New("invalid claim: 'JKU'") ErrorInvalidJWK = errors.New("invalid claim: 'JWK'") ErrorInvalidKID = errors.New("invalid claim: 'KID'") ErrorInvalidTYP = errors.New("invalid claim: 'TYP'") ErrorInvalidX5TS256 = errors.New("invalid claim: 'X5TS256'") ErrorInvalidX5T = errors.New("invalid claim: 'X5T'") ErrorInvalidX5U = errors.New("invalid claim: 'X5U'") ErrorInvalidSignature = errors.New("invalid signature") ErrorInvalidToken = errors.New("invalid token") ErrorNotImplemented = errors.New("not implemented") )
Errors
Functions ¶
This section is empty.
Types ¶
type JWT ¶
type JWT struct { Header map[string]interface{} Payload map[string]interface{} Signature []byte // contains filtered or unexported fields }
JWT represents instance of JSON Web Token (JWT).
func DeserializeCompact ¶
DeserializeCompact deserializes compact representation of JWT.
func (*JWT) GetHeaderParameter ¶
GetHeaderParameter ...
func (*JWT) SerializeCompact ¶
SerializeCompact ...
func (*JWT) SetHeaderParameter ¶ added in v0.1.5
SetHeaderParameter ...
func (*JWT) SetX5TS256 ¶ added in v0.1.5
SetX5TS256 ...
Click to show internal directories.
Click to hide internal directories.