Documentation ¶
Index ¶
- Constants
- func CheckClaimSet(claims, tmpl *ClaimSet) error
- func CheckTime(claims *ClaimSet, now time.Time) (time.Duration, error)
- func EncodeAndSign(c *ClaimSet, s Signer) (string, error)
- func Verify(tok *Token, v Verifier, t time.Time) error
- type ClaimSet
- type HS256
- type Header
- type Signer
- type Token
- type Verifier
Constants ¶
View Source
const ( AlgHS256 = "HS256" // HMAC + SHA256 AlgRS256 = "RS256" // RSA + SHA256 )
Signing algorithm codes.
View Source
const (
DefaultType = "JWT"
)
The default type string.
Variables ¶
This section is empty.
Functions ¶
func CheckClaimSet ¶
CheckClaimSet checks claims in claim set, see if it matches the values in the template.
func EncodeAndSign ¶
EncodeAndSign signs and encodes a claim set and signs it.
Types ¶
type ClaimSet ¶
type ClaimSet struct { Iss string `json:"iss"` // Issuer. Scope string `json:"scope"` // Scope, space-delimited list. Aud string `json:"aud"` // Audiance. Intended target. Exp int64 `json:"exp"` // Expiration time (Unix timestamp seconds) Iat int64 `json:"iat"` // Asserstion time (Unix timestamp seconds) Typ string `json:"typ"` // Token type. Sub string `json:"sub"` Extra map[string]interface{} `json:"-"` }
ClaimSet contains the JWT claims
type HS256 ¶
type HS256 struct {
// contains filtered or unexported fields
}
HS256 implements the HS256 signing algorithm. It uses SHA256 hash and HMAC signing.
type Header ¶
type Header struct { Alg string `json:"alg"` Typ string `json:"typ"` KeyID string `json:"kid,omitempty"` // Key ID. }
Header is the JWT header.
Click to show internal directories.
Click to hide internal directories.