868 UserSessionEntity entity =
new UserSessionEntity();
869 entity.setId(userSession.getId());
870 entity.setRealmId(userSession.getRealm().getId());
872 entity.setAuthMethod(userSession.getAuthMethod());
873 entity.setBrokerSessionId(userSession.getBrokerSessionId());
874 entity.setBrokerUserId(userSession.getBrokerUserId());
875 entity.setIpAddress(userSession.getIpAddress());
876 entity.setNotes(userSession.getNotes() == null ?
new ConcurrentHashMap<>() : userSession.getNotes());
877 entity.setAuthenticatedClientSessions(
new AuthenticatedClientSessionStore());
878 entity.setRememberMe(userSession.isRememberMe());
879 entity.setState(userSession.getState());
880 if (userSession instanceof OfflineUserSessionModel) {
883 OfflineUserSessionModel oline = (OfflineUserSessionModel)userSession;
884 entity.setUser(oline.getUserId());
889 entity.setLoginUsername(userSession.getLoginUsername());
890 entity.setUser(userSession.getUser().getId());
893 entity.setStarted(userSession.getStarted());
894 entity.setLastSessionRefresh(userSession.getLastSessionRefresh());
896 InfinispanChangelogBasedTransaction<String, UserSessionEntity> userSessionUpdateTx =
getTransaction(offline);
897 InfinispanChangelogBasedTransaction<UUID, AuthenticatedClientSessionEntity> clientSessionUpdateTx =
getClientSessionTransaction(offline);
899 SessionUpdateTask<UserSessionEntity> importTask = Tasks.addIfAbsentSync();
900 userSessionUpdateTx.addTask(userSession.getId(), importTask, entity);
902 UserSessionAdapter importedSession =
wrap(userSession.getRealm(), entity, offline);
905 if (importAuthenticatedClientSessions) {
906 for (AuthenticatedClientSessionModel clientSession : userSession.getAuthenticatedClientSessions().values()) {
907 importClientSession(importedSession, clientSession, userSessionUpdateTx, clientSessionUpdateTx, offline);
911 return importedSession;
InfinispanChangelogBasedTransaction< UUID, AuthenticatedClientSessionEntity > getClientSessionTransaction(boolean offline)
Definition: InfinispanUserSessionProvider.java:159
AuthenticatedClientSessionAdapter importClientSession(UserSessionAdapter sessionToImportInto, AuthenticatedClientSessionModel clientSession, InfinispanChangelogBasedTransaction< String, UserSessionEntity > userSessionUpdateTx, InfinispanChangelogBasedTransaction< UUID, AuthenticatedClientSessionEntity > clientSessionUpdateTx, boolean offline)
Definition: InfinispanUserSessionProvider.java:915
UserSessionAdapter wrap(RealmModel realm, UserSessionEntity entity, boolean offline)
Definition: InfinispanUserSessionProvider.java:769
InfinispanChangelogBasedTransaction< String, UserSessionEntity > getTransaction(boolean offline)
Definition: InfinispanUserSessionProvider.java:151