makes sure rotation is always higher than urgent rotation

This commit is contained in:
bergquist
2019-01-24 13:54:45 +01:00
parent 9ae306e417
commit 516037fbdd
4 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -23,7 +23,7 @@ func init() {
var (
getTime = time.Now
UrgentRotateTime = 20 * time.Second
UrgentRotateTime = 1 * time.Minute
oneYearInSeconds = 31557600 //used as default maxage for session cookies. We validate/rotate them more often.
)
@@ -218,7 +218,7 @@ func (s *UserAuthTokenServiceImpl) RefreshToken(token *userAuthToken, clientIP,
needsRotation := false
rotatedAt := time.Unix(token.RotatedAt, 0)
if token.AuthTokenSeen {
needsRotation = rotatedAt.Before(now.Add(-s.Cfg.LoginCookieRotation))
needsRotation = rotatedAt.Before(now.Add(-time.Duration(s.Cfg.LoginCookieRotation) * time.Minute))
} else {
needsRotation = rotatedAt.Before(now.Add(-UrgentRotateTime))
}