mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
update third party dependencies
This commit is contained in:
+1
-7
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user