Documentation
¶
Overview ¶
Package jwt provides functions for JWT token manipulation
Index ¶
- func GenerateToken(signingKey string, timeZone string, timeoutPeriod string, issuer string, ...) (string, string, int64, error)
- func GetAudience(tokenString string) (string, error)
- func GetExpirationTime(tokenString string) (int64, error)
- func ValidateToken(targetTokenString, sourceTokenString, tokenSHA256, signingKey string) (bool, error)
- type JWTToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateToken ¶
func GenerateToken(signingKey string, timeZone string, timeoutPeriod string, issuer string, subject string, audience string, data string) (string, string, int64, error)
Generate token generates a JWT token and returns the encoded token data, token SHA256, and expiration time (in the respective order)
func GetAudience ¶
Get the audience of the token
func GetExpirationTime ¶
Get the expiration time of the token
func ValidateToken ¶
func ValidateToken(targetTokenString, sourceTokenString, tokenSHA256, signingKey string) (bool, error)
Validate token uses a JWT token string and a signing key to validate the token
Types ¶
type JWTToken ¶
type JWTToken struct {
Header struct {
Algorithm string `json:"algorithm"`
Type string `json:"type"`
} `json:"header"`
Payload struct {
ExpirationTime int64 `json:"expirationTime"`
IssuedAt int64 `json:"issuedAt"`
Issuer string `json:"issuer"`
Subject string `json:"subject"`
Audience string `json:"audience"`
JwtID string `json:"jwtID"`
Data string `json:"data"`
} `json:"payload"`
Signature string `json:"signature"`
}
JWTToken struct for JWT token
Click to show internal directories.
Click to hide internal directories.