Documentation ¶
Index ¶
- Constants
- type JWT
- func (j *JWT) CreateRefreshToken(userID int64) (string, error)
- func (j *JWT) CreateToken(userID int64) (string, error)
- func (j *JWT) GetUserID(tokenString string) (int64, error)
- func (j *JWT) ParseToken(tokenString string) (*gojwt.Token, error)
- func (j *JWT) RefreshToken(refreshTokenString string) (string, error)
Constants ¶
View Source
const UserID = "user_id"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JWT ¶
type JWT struct { Secret string RefreshTokenLifespanHours time.Duration AuthTokenLifespanMinutes time.Duration }
func (*JWT) CreateRefreshToken ¶
CreateRefreshToken generates new jwt refresh token with the given user id
func (*JWT) CreateToken ¶
CreateToken generates new auth token with the given user id
func (*JWT) ParseToken ¶
ParseToken validates and decodes a given token and returns a Token object
Click to show internal directories.
Click to hide internal directories.