use the "remember me" max time if set for expires (#20413)
fixes: #9264
This commit is contained in:
parent
3862f82c2d
commit
f3c393f53e
1 changed files with 5 additions and 1 deletions
|
@ -32,6 +32,7 @@ import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.jboss.resteasy.annotations.cache.NoCache;
|
import org.jboss.resteasy.annotations.cache.NoCache;
|
||||||
|
import org.keycloak.common.util.Time;
|
||||||
import org.keycloak.device.DeviceActivityManager;
|
import org.keycloak.device.DeviceActivityManager;
|
||||||
import org.keycloak.models.AccountRoles;
|
import org.keycloak.models.AccountRoles;
|
||||||
import org.keycloak.models.ClientModel;
|
import org.keycloak.models.ClientModel;
|
||||||
|
@ -160,7 +161,10 @@ public class SessionResource {
|
||||||
sessionRep.setIpAddress(s.getIpAddress());
|
sessionRep.setIpAddress(s.getIpAddress());
|
||||||
sessionRep.setStarted(s.getStarted());
|
sessionRep.setStarted(s.getStarted());
|
||||||
sessionRep.setLastAccess(s.getLastSessionRefresh());
|
sessionRep.setLastAccess(s.getLastSessionRefresh());
|
||||||
sessionRep.setExpires(s.getStarted() + realm.getSsoSessionMaxLifespan());
|
int maxLifespan = s.isRememberMe() && realm.getSsoSessionMaxLifespanRememberMe() > 0
|
||||||
|
? realm.getSsoSessionMaxLifespanRememberMe() : realm.getSsoSessionMaxLifespan();
|
||||||
|
int expires = s.getStarted() + maxLifespan;
|
||||||
|
sessionRep.setExpires(expires);
|
||||||
sessionRep.setBrowser(device.getBrowser());
|
sessionRep.setBrowser(device.getBrowser());
|
||||||
|
|
||||||
if (isCurrentSession(s)) {
|
if (isCurrentSession(s)) {
|
||||||
|
|
Loading…
Reference in a new issue