Skip to content

Commit

Permalink
optimize jwt process logic to github.com/golang-jwt/jwt/v4 style
Browse files Browse the repository at this point in the history
  • Loading branch information
alimy committed Nov 3, 2022
1 parent 1ab3276 commit 0909650
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/app/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
type Claims struct {
UID int64 `json:"uid"`
Username string `json:"username"`
jwt.StandardClaims
jwt.RegisteredClaims
}

func GetJWTSecret() []byte {
Expand All @@ -23,8 +23,8 @@ func GenerateToken(User *model.User) (string, error) {
claims := Claims{
UID: User.ID,
Username: User.Username,
StandardClaims: jwt.StandardClaims{
ExpiresAt: expireTime.Unix(),
RegisteredClaims: jwt.RegisteredClaims{
ExpiresAt: jwt.NewNumericDate(expireTime),
Issuer: conf.JWTSetting.Issuer + ":" + User.Salt,
},
}
Expand Down

0 comments on commit 0909650

Please sign in to comment.