mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 19:22: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 {
|
if err != nil {
|
||||||
bytes, err = ioutil.ReadFile(filepath.Join(Root, "config", "config.yaml"))
|
bytes, err = ioutil.ReadFile(filepath.Join(Root, "config", "config.yaml"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error() + " config: " + filepath.Join(cfgName, "config", "config.yaml"))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Root = cfgName
|
Root = cfgName
|
||||||
@ -541,5 +541,4 @@ func init() {
|
|||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,14 @@ type Claims struct {
|
|||||||
|
|
||||||
func BuildClaims(uid, platform string, ttl int64) Claims {
|
func BuildClaims(uid, platform string, ttl int64) Claims {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
before := now.Add(-time.Minute * 5)
|
||||||
return Claims{
|
return Claims{
|
||||||
UID: uid,
|
UID: uid,
|
||||||
Platform: platform,
|
Platform: platform,
|
||||||
RegisteredClaims: jwt.RegisteredClaims{
|
RegisteredClaims: jwt.RegisteredClaims{
|
||||||
ExpiresAt: jwt.NewNumericDate(now.Add(time.Duration(ttl*24) * time.Hour)), //Expiration time
|
ExpiresAt: jwt.NewNumericDate(now.Add(time.Duration(ttl*24) * time.Hour)), //Expiration time
|
||||||
IssuedAt: jwt.NewNumericDate(now), //Issuing 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