Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKeys ¶
GenerateKeys generate and save the keys to disk
func Sign ¶
Sign function to sign a new key
Types ¶
type Claims ¶
type Claims struct {
// Subject or userid
Sub string `json:"sub,omitempty"`
// When the token will expire
Exp int `json:"exp,omitempty"`
// Token is not valid before this time
Nbf int `json:"nbf,omitempty"`
// When the token was issued
Iat int `json:"iat,omitempty"`
}
Claims struct to hold various public data
func NewClaimsParse ¶
NewClaimsParse creates a new claims from a string the message should be a base64.URLEncoded string
func (*Claims) Bytes ¶
Bytes returns the bytes for the claims
func (*Claims) EncodedBytes ¶
EncodedBytes takes the bytes tring and url encodes it
func (*Claims) Parse ¶
Parse unmarshall claims from json
type Header ¶
Header struct to hold the header information
func NewHeaderParse ¶
NewHeaderParse function to create new JWT header message should be the base64.URLEncoded string
func (*Header) Bytes ¶
Bytes returns the bytes for the header
func (*Header) EncodedBytes ¶
EncodedBytes takes the bytes string and url encodes it
func (*Header) Parse ¶
Parse unmarshall header from json message should be the unparsed json string
type JWT ¶
JWT struct holds the entire token
func NewJWT ¶
NewJWT returns a new JWT with header and claims
func NewJWTParse ¶
NewJWTParse takes a jwt token string and parse it into a token message should be the unmodified base64.RawURLEncoded string
func (*JWT) EncodedBytesSignature ¶
EncodedBytesSignature returns the encoded byte string
func (*JWT) GenerateMessage ¶
GenerateMessage returns the full jwt token
func (*JWT) GenerateToken ¶
GenerateToken takes all the components and spits out a token
func (*JWT) ValidateToken ¶
ValidateToken checks the token claims at UTC time
Source Files
¶
- generate.go
- jwt.go
- sign.go
- verify.go