Documentation ¶
Overview ¶
Copyright (c) 2020 Steven Victor https://github.com/tienbm90/simple-jwt-auth/blob/master/LICENSE
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidToken = errors.New("token is invalid") ErrExpiredToken = errors.New("token has expired") )
Functions ¶
Types ¶
type AccessDetails ¶
func ExtractTokenMetadata ¶
func ExtractTokenMetadata(r *http.Request, secretKey string) (*AccessDetails, error)
ExtractTokenMetadata トークンのメタデータを抽出
type JWTMaker ¶
type JWTMaker struct {
// contains filtered or unexported fields
}
JWTMaker is a JSON Web Token maker
func (*JWTMaker) CreateToken ¶
CreateToken creates a new token for a specific username and duration
type Maker ¶
type Maker interface { CreateToken(username string, duration time.Duration) (string, error) VerifyToken(token string) (*Payload, error) }
func NewJWTMaker ¶
NewJWTMaker creates a new JWTMaker
type Payload ¶
type TokenDetails ¶
type TokenDetails struct { AccessToken string RefreshToken string TokenUuid string RefreshUuid string AtExpires int64 RtExpires int64 }
func CreateToken ¶
func CreateToken(userID, userName, secretKey, refreshKey string) (*TokenDetails, error)
func NewTokenDetails ¶
func NewTokenDetails() *TokenDetails
Click to show internal directories.
Click to hide internal directories.