use of org.keycloak.models.sessions.infinispan.changes.sessions.CrossDCLastSessionRefreshChecker in project keycloak by keycloak.
the class UserSessionAdapter method setLastSessionRefresh.
public void setLastSessionRefresh(int lastSessionRefresh) {
if (offline) {
// Received the message from the other DC that we should update the lastSessionRefresh in local cluster. Don't update DB in that case.
// The other DC already did.
Boolean ignoreRemoteCacheUpdate = (Boolean) session.getAttribute(CrossDCLastSessionRefreshListener.IGNORE_REMOTE_CACHE_UPDATE);
if (ignoreRemoteCacheUpdate == null || !ignoreRemoteCacheUpdate) {
provider.getPersisterLastSessionRefreshStore().putLastSessionRefresh(session, entity.getId(), realm.getId(), lastSessionRefresh);
}
}
UserSessionUpdateTask task = new UserSessionUpdateTask() {
@Override
public void runUpdate(UserSessionEntity entity) {
entity.setLastSessionRefresh(lastSessionRefresh);
}
@Override
public CrossDCMessageStatus getCrossDCMessageStatus(SessionEntityWrapper<UserSessionEntity> sessionWrapper) {
return new CrossDCLastSessionRefreshChecker(provider.getLastSessionRefreshStore(), provider.getOfflineLastSessionRefreshStore()).shouldSaveUserSessionToRemoteCache(UserSessionAdapter.this.session, UserSessionAdapter.this.realm, sessionWrapper, offline, lastSessionRefresh);
}
@Override
public String toString() {
return "setLastSessionRefresh(" + lastSessionRefresh + ')';
}
};
update(task);
}
use of org.keycloak.models.sessions.infinispan.changes.sessions.CrossDCLastSessionRefreshChecker in project keycloak by keycloak.
the class AuthenticatedClientSessionAdapter method setTimestamp.
@Override
public void setTimestamp(int timestamp) {
ClientSessionUpdateTask task = new ClientSessionUpdateTask() {
@Override
public void runUpdate(AuthenticatedClientSessionEntity entity) {
entity.setTimestamp(timestamp);
}
@Override
public CrossDCMessageStatus getCrossDCMessageStatus(SessionEntityWrapper<AuthenticatedClientSessionEntity> sessionWrapper) {
return new CrossDCLastSessionRefreshChecker(provider.getLastSessionRefreshStore(), provider.getOfflineLastSessionRefreshStore()).shouldSaveClientSessionToRemoteCache(kcSession, client.getRealm(), sessionWrapper, userSession, offline, timestamp);
}
@Override
public String toString() {
return "setTimestamp(" + timestamp + ')';
}
};
update(task);
}
Aggregations