update third party dependencies

This commit is contained in:
MaysWind
2023-05-28 15:48:28 +08:00
parent 21d73e5f69
commit 9511644ce6
14 changed files with 642 additions and 536 deletions
+1 -7
View File
@@ -61,13 +61,7 @@ func (c *Context) GetCurrentUid() int64 {
return 0
}
uid, err := strconv.ParseInt(claims.Id, 10, 64)
if err != nil {
return 0
}
return uid
return claims.Uid
}
// GetClientTimezoneOffset returns the client timezone offset
+40 -2
View File
@@ -1,7 +1,9 @@
package core
import (
"github.com/golang-jwt/jwt/v4"
"time"
"github.com/golang-jwt/jwt/v5"
)
// TokenType represents token type
@@ -16,7 +18,43 @@ const (
// UserTokenClaims represents user token
type UserTokenClaims struct {
UserTokenId string `json:"userTokenId"`
Uid int64 `json:"jti,string"`
Username string `json:"username,omitempty"`
Type TokenType `json:"type"`
jwt.StandardClaims
IssuedAt int64 `json:"iat"`
ExpiresAt int64 `json:"exp"`
}
// GetExpirationTime returns the expiration time of this token
func (c *UserTokenClaims) GetExpirationTime() (*jwt.NumericDate, error) {
return &jwt.NumericDate{
Time: time.Unix(c.ExpiresAt, 0),
}, nil
}
// GetIssuedAt returns the issue time of this token
func (c *UserTokenClaims) GetIssuedAt() (*jwt.NumericDate, error) {
return &jwt.NumericDate{
Time: time.Unix(c.IssuedAt, 0),
}, nil
}
// GetNotBefore returns the earliest valid time of this token
func (c *UserTokenClaims) GetNotBefore() (*jwt.NumericDate, error) {
return &jwt.NumericDate{}, nil
}
// GetIssuer returns the issuer of this token
func (c *UserTokenClaims) GetIssuer() (string, error) {
return "", nil
}
// GetSubject returns the subject of this token
func (c *UserTokenClaims) GetSubject() (string, error) {
return "", nil
}
// GetAudience returns the audience of this token
func (c *UserTokenClaims) GetAudience() (jwt.ClaimStrings, error) {
return jwt.ClaimStrings{}, nil
}