Move session persistence package to legacy-private module

Also, disabling the jpa session persister when map storage is enabled.

Closes #12712
This commit is contained in:
Alexander Schwartz 2022-07-01 11:51:07 +02:00 committed by Bruno Oliveira da Silva
parent 9143d8bd0e
commit 4b20e90292
14 changed files with 10 additions and 5 deletions

View file

@ -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 <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
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);
}
}

View file

@ -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

View file

@ -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

View file

@ -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) {

View file

@ -852,6 +852,7 @@
<keycloak.authorizationCache.enabled>false</keycloak.authorizationCache.enabled>
<keycloak.realmCache.enabled>false</keycloak.realmCache.enabled>
<keycloak.userCache.enabled>false</keycloak.userCache.enabled>
<keycloak.userSessionPersister.provider></keycloak.userSessionPersister.provider>
</systemPropertyVariables>
</configuration>
</plugin>