diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/session/JpaUserSessionPersisterProviderFactory.java b/model/jpa/src/main/java/org/keycloak/models/jpa/session/JpaUserSessionPersisterProviderFactory.java
index d2d13bf903..70147b4619 100644
--- a/model/jpa/src/main/java/org/keycloak/models/jpa/session/JpaUserSessionPersisterProviderFactory.java
+++ b/model/jpa/src/main/java/org/keycloak/models/jpa/session/JpaUserSessionPersisterProviderFactory.java
@@ -18,18 +18,20 @@
package org.keycloak.models.jpa.session;
import org.keycloak.Config;
+import org.keycloak.common.Profile;
import org.keycloak.connections.jpa.JpaConnectionProvider;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.models.session.UserSessionPersisterProvider;
import org.keycloak.models.session.UserSessionPersisterProviderFactory;
+import org.keycloak.provider.EnvironmentDependentProviderFactory;
import javax.persistence.EntityManager;
/**
* @author Marek Posolda
*/
-public class JpaUserSessionPersisterProviderFactory implements UserSessionPersisterProviderFactory {
+public class JpaUserSessionPersisterProviderFactory implements UserSessionPersisterProviderFactory, EnvironmentDependentProviderFactory {
public static final String ID = "jpa";
@@ -63,4 +65,9 @@ public class JpaUserSessionPersisterProviderFactory implements UserSessionPersis
public int order() {
return 100;
}
+
+ @Override
+ public boolean isSupported() {
+ return !Profile.isFeatureEnabled(Profile.Feature.MAP_STORAGE);
+ }
}
diff --git a/server-spi-private/src/main/java/org/keycloak/models/session/DisabledUserSessionPersisterProvider.java b/model/legacy-private/src/main/java/org/keycloak/models/session/DisabledUserSessionPersisterProvider.java
similarity index 100%
rename from server-spi-private/src/main/java/org/keycloak/models/session/DisabledUserSessionPersisterProvider.java
rename to model/legacy-private/src/main/java/org/keycloak/models/session/DisabledUserSessionPersisterProvider.java
diff --git a/server-spi-private/src/main/java/org/keycloak/models/session/PersistentAuthenticatedClientSessionAdapter.java b/model/legacy-private/src/main/java/org/keycloak/models/session/PersistentAuthenticatedClientSessionAdapter.java
similarity index 100%
rename from server-spi-private/src/main/java/org/keycloak/models/session/PersistentAuthenticatedClientSessionAdapter.java
rename to model/legacy-private/src/main/java/org/keycloak/models/session/PersistentAuthenticatedClientSessionAdapter.java
diff --git a/server-spi-private/src/main/java/org/keycloak/models/session/PersistentClientSessionModel.java b/model/legacy-private/src/main/java/org/keycloak/models/session/PersistentClientSessionModel.java
similarity index 100%
rename from server-spi-private/src/main/java/org/keycloak/models/session/PersistentClientSessionModel.java
rename to model/legacy-private/src/main/java/org/keycloak/models/session/PersistentClientSessionModel.java
diff --git a/server-spi-private/src/main/java/org/keycloak/models/session/PersistentUserSessionAdapter.java b/model/legacy-private/src/main/java/org/keycloak/models/session/PersistentUserSessionAdapter.java
similarity index 100%
rename from server-spi-private/src/main/java/org/keycloak/models/session/PersistentUserSessionAdapter.java
rename to model/legacy-private/src/main/java/org/keycloak/models/session/PersistentUserSessionAdapter.java
diff --git a/server-spi-private/src/main/java/org/keycloak/models/session/PersistentUserSessionModel.java b/model/legacy-private/src/main/java/org/keycloak/models/session/PersistentUserSessionModel.java
similarity index 100%
rename from server-spi-private/src/main/java/org/keycloak/models/session/PersistentUserSessionModel.java
rename to model/legacy-private/src/main/java/org/keycloak/models/session/PersistentUserSessionModel.java
diff --git a/server-spi-private/src/main/java/org/keycloak/models/session/UserSessionPersisterProvider.java b/model/legacy-private/src/main/java/org/keycloak/models/session/UserSessionPersisterProvider.java
similarity index 100%
rename from server-spi-private/src/main/java/org/keycloak/models/session/UserSessionPersisterProvider.java
rename to model/legacy-private/src/main/java/org/keycloak/models/session/UserSessionPersisterProvider.java
diff --git a/server-spi-private/src/main/java/org/keycloak/models/session/UserSessionPersisterProviderFactory.java b/model/legacy-private/src/main/java/org/keycloak/models/session/UserSessionPersisterProviderFactory.java
similarity index 100%
rename from server-spi-private/src/main/java/org/keycloak/models/session/UserSessionPersisterProviderFactory.java
rename to model/legacy-private/src/main/java/org/keycloak/models/session/UserSessionPersisterProviderFactory.java
diff --git a/server-spi-private/src/main/java/org/keycloak/models/session/UserSessionPersisterSpi.java b/model/legacy-private/src/main/java/org/keycloak/models/session/UserSessionPersisterSpi.java
similarity index 100%
rename from server-spi-private/src/main/java/org/keycloak/models/session/UserSessionPersisterSpi.java
rename to model/legacy-private/src/main/java/org/keycloak/models/session/UserSessionPersisterSpi.java
diff --git a/server-spi-private/src/main/resources/META-INF/services/org.keycloak.models.session.UserSessionPersisterProviderFactory b/model/legacy-private/src/main/resources/META-INF/services/org.keycloak.models.session.UserSessionPersisterProviderFactory
similarity index 100%
rename from server-spi-private/src/main/resources/META-INF/services/org.keycloak.models.session.UserSessionPersisterProviderFactory
rename to model/legacy-private/src/main/resources/META-INF/services/org.keycloak.models.session.UserSessionPersisterProviderFactory
diff --git a/model/legacy-private/src/main/resources/META-INF/services/org.keycloak.provider.Spi b/model/legacy-private/src/main/resources/META-INF/services/org.keycloak.provider.Spi
index 21ae0fad9e..cbb0036ce8 100644
--- a/model/legacy-private/src/main/resources/META-INF/services/org.keycloak.provider.Spi
+++ b/model/legacy-private/src/main/resources/META-INF/services/org.keycloak.provider.Spi
@@ -20,3 +20,4 @@ org.keycloak.models.cache.CacheRealmProviderSpi
org.keycloak.storage.client.ClientStorageProviderSpi
org.keycloak.storage.group.GroupStorageProviderSpi
org.keycloak.storage.clientscope.ClientScopeStorageProviderSpi
+org.keycloak.models.session.UserSessionPersisterSpi
diff --git a/server-spi-private/src/main/resources/META-INF/services/org.keycloak.provider.Spi b/server-spi-private/src/main/resources/META-INF/services/org.keycloak.provider.Spi
index b489f28cae..6d5febf873 100755
--- a/server-spi-private/src/main/resources/META-INF/services/org.keycloak.provider.Spi
+++ b/server-spi-private/src/main/resources/META-INF/services/org.keycloak.provider.Spi
@@ -30,7 +30,6 @@ org.keycloak.models.SingleUseObjectSpi
org.keycloak.models.UserSessionSpi
org.keycloak.models.UserLoginFailureSpi
org.keycloak.models.UserSpi
-org.keycloak.models.session.UserSessionPersisterSpi
org.keycloak.models.dblock.DBLockSpi
org.keycloak.migration.MigrationSpi
org.keycloak.events.EventListenerSpi
diff --git a/services/src/main/java/org/keycloak/services/managers/UserSessionManager.java b/services/src/main/java/org/keycloak/services/managers/UserSessionManager.java
index 31cba06562..b9aab05e48 100644
--- a/services/src/main/java/org/keycloak/services/managers/UserSessionManager.java
+++ b/services/src/main/java/org/keycloak/services/managers/UserSessionManager.java
@@ -27,7 +27,6 @@ import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.UserModel;
import org.keycloak.models.UserSessionModel;
-import org.keycloak.models.session.UserSessionPersisterProvider;
import org.keycloak.services.ServicesLogger;
import java.util.List;
@@ -46,11 +45,9 @@ public class UserSessionManager {
private static final Logger logger = Logger.getLogger(UserSessionManager.class);
private final KeycloakSession kcSession;
- private final UserSessionPersisterProvider persister;
public UserSessionManager(KeycloakSession session) {
this.kcSession = session;
- this.persister = session.getProvider(UserSessionPersisterProvider.class);
}
public void createOrUpdateOfflineSession(AuthenticatedClientSessionModel clientSession, UserSessionModel userSession) {
diff --git a/testsuite/integration-arquillian/tests/base/pom.xml b/testsuite/integration-arquillian/tests/base/pom.xml
index bd295ac4bc..e08790531f 100644
--- a/testsuite/integration-arquillian/tests/base/pom.xml
+++ b/testsuite/integration-arquillian/tests/base/pom.xml
@@ -852,6 +852,7 @@
false
false
false
+