Documentation ¶
Index ¶
Constants ¶
View Source
const JWT_PAYLOAD key = "jwt-payload"
Variables ¶
View Source
var ( ErrInvalidToken = errors.New("token is invalid") ErrExpiredToken = errors.New("token has expired") )
Functions ¶
func AppendRequestCtx ¶
Types ¶
type JWT ¶
type JWT interface { CreateToken(tokenType string, params PayloadParams, duration time.Duration) (string, *Payload, error) VerifyToken(token string) (*Payload, error) }
func NewJWTMaker ¶
func NewJWTMaker(config *common_utils.BaseConfig) (JWT, error)
type JWTMaker ¶ added in v1.0.13
type JWTMaker struct {
// contains filtered or unexported fields
}
func (*JWTMaker) CreateToken ¶ added in v1.0.13
type Payload ¶
type Payload struct { jwt.RegisteredClaims ID uuid.UUID `json:"id"` UserId uuid.UUID `json:"userId"` Email string `json:"email"` Role string `json:"role"` Status string `json:"status"` TokenType string `json:"tokenType"` IssuedAt time.Time `json:"issuedAt"` ExpiredAt time.Time `json:"expiredAt"` }
func GetRequestCtx ¶
func NewPayload ¶
func NewPayload(params PayloadParams, duration time.Duration) *Payload
Click to show internal directories.
Click to hide internal directories.