Documentation
¶
Overview ¶
Package jwt defines all the methods for JWT manipulation.
Index ¶
Constants ¶
View Source
const ExpiresDuration = 24 * time.Hour
ExpiresDuration is the duration when a user session expires.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct {
jwt.RegisteredClaims
UserID string `json:"user_id"`
UserName string `json:"user_name"`
}
Claims are the fields stored in a JWT.
type Secret ¶
type Secret []byte
Secret is a HMAC JWT secret used for signing.
func (Secret) GenerateToken ¶
GenerateToken creates a JWT session token which stores the user identity.
The returned token is signed with the JWT secret, meaning it cannot be falsified.
Click to show internal directories.
Click to hide internal directories.