Shorter JWT token lifetime to enter chat

This commit is contained in:
Noah Petherbridge 2023-04-19 19:56:09 -07:00
parent 0527ff54b5
commit 7af6d82fc7

View File

@ -82,9 +82,7 @@ func Landing() http.HandlerFunc {
ProfileURL: "/u/" + currentUser.Username, ProfileURL: "/u/" + currentUser.Username,
Nickname: currentUser.NameOrUsername(), Nickname: currentUser.NameOrUsername(),
RegisteredClaims: jwt.RegisteredClaims{ RegisteredClaims: jwt.RegisteredClaims{
// TODO: ExpiresAt 60 minutes to work around chat server reliability, ExpiresAt: jwt.NewNumericDate(time.Now().Add(5 * time.Minute)),
// should be shorter like 5 minutes.
ExpiresAt: jwt.NewNumericDate(time.Now().Add(60 * time.Minute)),
IssuedAt: jwt.NewNumericDate(time.Now()), IssuedAt: jwt.NewNumericDate(time.Now()),
NotBefore: jwt.NewNumericDate(time.Now()), NotBefore: jwt.NewNumericDate(time.Now()),
Issuer: config.Title, Issuer: config.Title,