Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type JWTManager ¶
type JWTManager struct {
// contains filtered or unexported fields
}
JWTManager is a JSON web token manager
func NewJWTManager ¶
func NewJWTManager(secretKey string, tokenDuration time.Duration) *JWTManager
NewJWTManager returns a new JWT manager
func (*JWTManager) Generate ¶
func (manager *JWTManager) Generate(user *model.User) (string, error)
Generate generates and signs a new token for a user
func (*JWTManager) Verify ¶
func (manager *JWTManager) Verify(accessToken string) (*UserClaims, error)
Verify verifies the access token string and return a user claim if the token is valid
type RBACRequest ¶
type RBACRequest struct {
// contains filtered or unexported fields
}
type UserClaims ¶
type UserClaims struct { jwt.StandardClaims ID uint64 `json:"id"` }
UserClaims is a custom JWT claims that contains some user's information
Click to show internal directories.
Click to hide internal directories.