Documentation ¶
Index ¶
- func GenerateAccessToken(userID string, roles []string, refreshToken string) (string, error)
- func GenerateRefreshToken(userID string, roles []string) (*models.Token, error)
- func GetToken(tokenString string) (*jwt.Token, error)
- func RefreshToken(token *jwt.Token) ([]byte, error)
- func Roles(token *jwt.Token) []string
- func UserID(token *jwt.Token) string
- type AuthClaims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateAccessToken ¶
GenerateAccessToken return a new token.
func GenerateRefreshToken ¶
GenerateRefreshToken returns an Token
func GetToken ¶
GetToken return a token from a token string. Return nil if the token string is invalid or if the token as expired.
func RefreshToken ¶
RefreshToken return the refreshToken
Types ¶
type AuthClaims ¶
type AuthClaims struct { Roles []string `json:"roles"` RefreshToken string `json:"refreshToken"` jwt.StandardClaims }
AuthClaims add roles to the jwt claims.
Click to show internal directories.
Click to hide internal directories.