mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
Set the token activity time to five minutes ago
This commit is contained in:
parent
652d560a21
commit
073b6d200a
@ -524,7 +524,7 @@ func init() {
|
||||
if err != nil {
|
||||
bytes, err = ioutil.ReadFile(filepath.Join(Root, "config", "config.yaml"))
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
panic(err.Error() + " config: " + filepath.Join(cfgName, "config", "config.yaml"))
|
||||
}
|
||||
} else {
|
||||
Root = cfgName
|
||||
@ -541,5 +541,4 @@ func init() {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,13 +28,14 @@ type Claims struct {
|
||||
|
||||
func BuildClaims(uid, platform string, ttl int64) Claims {
|
||||
now := time.Now()
|
||||
before := now.Add(-time.Minute * 5)
|
||||
return Claims{
|
||||
UID: uid,
|
||||
Platform: platform,
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
ExpiresAt: jwt.NewNumericDate(now.Add(time.Duration(ttl*24) * time.Hour)), //Expiration time
|
||||
IssuedAt: jwt.NewNumericDate(now), //Issuing time
|
||||
NotBefore: jwt.NewNumericDate(now), //Begin Effective time
|
||||
NotBefore: jwt.NewNumericDate(before), //Begin Effective time
|
||||
}}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user