From 84603a936395e9874658e16017f93cf65a3f0a9e Mon Sep 17 00:00:00 2001 From: Martin Kanis Date: Tue, 23 Jan 2024 14:50:31 +0100 Subject: [PATCH] Map Store Removal: Rename Legacy* classes (#26273) Closes #24105 Signed-off-by: Martin Kanis --- .github/workflows/ci.yml | 14 ++--- .../topics/keycloak/changes-24_0_0.adoc | 8 +++ .../upgrading/topics/migrate_db.adoc | 4 +- docs/guides/server/db.adoc | 6 +- .../kerberos/KerberosFederationProvider.java | 4 +- .../storage/ldap/LDAPStorageProvider.java | 8 +-- .../cache/infinispan/RealmCacheSession.java | 6 +- .../SubjectCredentialManagerCacheAdapter.java | 4 +- .../models/cache/infinispan/UserAdapter.java | 1 - .../cache/infinispan/UserCacheSession.java | 6 +- .../org/keycloak/models/jpa/RealmAdapter.java | 2 +- .../org/keycloak/models/jpa/UserAdapter.java | 4 +- .../migration/MigrationModelManager.java | 6 +- .../migration/migrators/MigrateTo1_3_0.java | 4 +- .../migration/migrators/MigrateTo1_4_0.java | 4 +- .../migration/migrators/MigrateTo1_8_0.java | 4 +- .../models/cache/CachedRealmModel.java | 4 +- .../storage/ClientStorageManager.java | 4 +- .../keycloak/storage/RoleStorageManager.java | 4 +- .../keycloak/storage/UserStorageManager.java | 4 +- .../storage/UserStoragePrivateUtil.java | 4 +- .../storage/adapter/InMemoryUserAdapter.java | 4 +- ...der.java => DefaultDatastoreProvider.java} | 12 ++-- ...a => DefaultDatastoreProviderFactory.java} | 16 +++--- ...r.java => DefaultExportImportManager.java} | 10 ++-- ...ager.java => DefaultMigrationManager.java} | 9 ++- .../managers/UserStorageSyncManager.java | 8 +-- ....keycloak.storage.DatastoreProviderFactory | 2 +- ...gerTest.java => MigrationManagerTest.java} | 15 +++-- .../exportimport/util/ImportUtils.java | 4 +- ...anager.java => UserCredentialManager.java} | 10 ++-- ...el.java => StorageProviderRealmModel.java} | 3 +- ...yStoreManagers.java => StoreManagers.java} | 2 +- .../AbstractUserAdapterFederatedStorage.java | 4 +- .../quarkus/deployment/KeycloakProcessor.java | 2 +- ... QuarkusJpaConnectionProviderFactory.java} | 6 +- ...> QuarkusInfinispanConnectionFactory.java} | 2 +- ...nispan.InfinispanConnectionProviderFactory | 2 +- ...nnections.jpa.JpaConnectionProviderFactory | 2 +- ...ider.java => CustomJpaEntityProvider.java} | 2 +- ...rProvider.java => CustomUserProvider.java} | 3 +- .../it/cli/dist/ClusterConfigDistTest.java | 4 +- ...a => CustomJpaEntityProviderDistTest.java} | 8 +-- ...t.java => CustomUserProviderDistTest.java} | 8 +-- .../it/cli/dist/FeaturesDistTest.java | 2 - .../keycloak/it/cli/dist/MetricsDistTest.java | 2 - .../cli/dist/QuarkusPropertiesDistTest.java | 2 - .../dist/DatabaseOptionsDistTest.java | 2 - .../database/dist/MariaDBDistTest.java | 3 - .../storage/database/dist/MySQLDistTest.java | 2 - .../database/dist/PostgreSQLDistTest.java | 2 - .../TransactionConfigurationDistTest.java | 2 - .../it/junit5/extension/CLITestExtension.java | 14 ++--- .../KeycloakDistributionDecorator.java | 10 ++-- .../it/junit5/extension/ServerOptions.java | 21 ++----- .../{LegacyStore.java => Storage.java} | 4 +- .../keycloak/storage/ExportImportManager.java | 2 +- ...a => StoreMigrateRepresentationEvent.java} | 9 ++- ...toreSyncEvent.java => StoreSyncEvent.java} | 10 ++-- .../services/managers/RealmManager.java | 10 ++-- .../resources/admin/RealmAdminResource.java | 6 +- .../federation/UserPropertyFileStorage.java | 4 +- .../federation/ldap/LDAPSyncTest.java | 4 +- .../federation/storage/ClientStorageTest.java | 12 ++-- .../UserStorageProvidersTestUtils.java | 4 +- testsuite/model/README.md | 3 +- testsuite/model/pom.xml | 56 +++++++++---------- .../testsuite/model/TimeOffsetTest.java | 2 +- .../parameters/{LegacyJpa.java => Jpa.java} | 9 ++- ...yJpaFederation.java => JpaFederation.java} | 10 ++-- .../SyncDummyFederationProviderCommand.java | 4 +- 71 files changed, 209 insertions(+), 245 deletions(-) rename model/legacy-private/src/main/java/org/keycloak/storage/datastore/{LegacyDatastoreProvider.java => DefaultDatastoreProvider.java} (95%) rename model/legacy-private/src/main/java/org/keycloak/storage/datastore/{LegacyDatastoreProviderFactory.java => DefaultDatastoreProviderFactory.java} (87%) rename model/legacy-private/src/main/java/org/keycloak/storage/datastore/{LegacyExportImportManager.java => DefaultExportImportManager.java} (99%) rename model/legacy-private/src/main/java/org/keycloak/storage/datastore/{LegacyMigrationManager.java => DefaultMigrationManager.java} (95%) rename model/legacy-private/src/test/java/org/keycloak/models/datastore/{LegacyMigrationManagerTest.java => MigrationManagerTest.java} (83%) rename model/legacy/src/main/java/org/keycloak/credential/{LegacyUserCredentialManager.java => UserCredentialManager.java} (96%) rename model/legacy/src/main/java/org/keycloak/models/{LegacyRealmModel.java => StorageProviderRealmModel.java} (97%) rename model/legacy/src/main/java/org/keycloak/storage/{LegacyStoreManagers.java => StoreManagers.java} (97%) rename quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/database/{LegacyJpaConnectionProviderFactory.java => QuarkusJpaConnectionProviderFactory.java} (97%) rename quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/infinispan/{LegacyInfinispanConnectionFactory.java => QuarkusInfinispanConnectionFactory.java} (93%) rename quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/entity/{CustomLegacyJpaEntityProvider.java => CustomJpaEntityProvider.java} (93%) rename quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/user/{CustomLegacyUserProvider.java => CustomUserProvider.java} (91%) rename quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/{CustomLegacyJpaEntityProviderDistTest.java => CustomJpaEntityProviderDistTest.java} (86%) rename quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/{CustomLegacyUserProviderDistTest.java => CustomUserProviderDistTest.java} (87%) rename quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/{LegacyStore.java => Storage.java} (90%) rename server-spi-private/src/main/java/org/keycloak/storage/{LegacyStoreMigrateRepresentationEvent.java => StoreMigrateRepresentationEvent.java} (77%) rename server-spi-private/src/main/java/org/keycloak/storage/{LegacyStoreSyncEvent.java => StoreSyncEvent.java} (79%) rename testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/{LegacyJpa.java => Jpa.java} (94%) rename testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/{LegacyJpaFederation.java => JpaFederation.java} (93%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fdf661070..bdcc47fcad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -251,8 +251,8 @@ jobs: with: job-id: jdk-integration-tests-${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.version }} - legacy-store-integration-tests: - name: Legacy Store IT + store-integration-tests: + name: Store IT needs: [build, conditional] if: needs.conditional.outputs.ci-store == 'true' runs-on: ubuntu-latest @@ -283,13 +283,13 @@ jobs: env: GH_TOKEN: ${{ github.token }} with: - job-name: Legacy Store IT + job-name: Store IT - name: Surefire reports if: always() uses: ./.github/actions/archive-surefire-reports with: - job-id: legacy-store-integration-tests-${{ matrix.db }} + job-id: store-integration-tests-${{ matrix.db }} store-model-tests: name: Store Model Tests @@ -325,7 +325,7 @@ jobs: job-id: store-model-tests clustering-integration-tests: - name: Legacy Clustering IT + name: Clustering IT needs: build runs-on: ubuntu-latest timeout-minutes: 35 @@ -351,7 +351,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} with: - job-name: Legacy Clustering IT + job-name: Clustering IT - name: Surefire reports if: always() @@ -650,7 +650,7 @@ jobs: - quarkus-unit-tests - quarkus-integration-tests - jdk-integration-tests - - legacy-store-integration-tests + - store-integration-tests - store-model-tests - clustering-integration-tests - fips-unit-tests diff --git a/docs/documentation/upgrading/topics/keycloak/changes-24_0_0.adoc b/docs/documentation/upgrading/topics/keycloak/changes-24_0_0.adoc index e3b058f3db..6c4f18fc57 100644 --- a/docs/documentation/upgrading/topics/keycloak/changes-24_0_0.adoc +++ b/docs/documentation/upgrading/topics/keycloak/changes-24_0_0.adoc @@ -224,3 +224,11 @@ PUT /admin/realms/{realm}/users/{id}/execute-actions-email = Removal of the deprecated mode for SAML encryption The compatibility mode for SAML encryption introduced in version 21 is now removed. The system property `keycloak.saml.deprecated.encryption` is not managed anymore by the server. The clients which still used the old signing key for encryption should update it from the new IDP configuration metadata. + += Renaming JPA provider configuration options for migration + +After removal of the Map Store the following configuration options were renamed: + +* `spi-connections-jpa-legacy-initialize-empty` to `spi-connections-jpa-quarkus-initialize-empty` +* `spi-connections-jpa-legacy-migration-export` to `spi-connections-jpa-quarkus-migration-export` +* `spi-connections-jpa-legacy-migration-strategy` to `spi-connections-jpa-quarkus-migration-strategy` diff --git a/docs/documentation/upgrading/topics/migrate_db.adoc b/docs/documentation/upgrading/topics/migrate_db.adoc index ba07a883b0..f5e7f93f1f 100644 --- a/docs/documentation/upgrading/topics/migrate_db.adoc +++ b/docs/documentation/upgrading/topics/migrate_db.adoc @@ -31,7 +31,7 @@ default `connections-jpa` provider: [source,bash] ---- -kc.[sh|bat] start --spi-connections-jpa-legacy-migration-strategy=manual +kc.[sh|bat] start --spi-connections-jpa-quarkus-migration-strategy=manual ---- When you start the server with this configuration it checks if the database needs to be migrated. @@ -42,7 +42,7 @@ default `connections-jpa` provider: [source,bash] ---- -kc.[sh|bat] start --spi-connections-jpa-legacy-migration-export=/ +kc.[sh|bat] start --spi-connections-jpa-quarkus-migration-export=/ ---- For further details on how to apply this file to the database, see the documentation for the relational database you're using. diff --git a/docs/guides/server/db.adoc b/docs/guides/server/db.adoc index dbe3fe6a08..d2d4c8c6bd 100644 --- a/docs/guides/server/db.adoc +++ b/docs/guides/server/db.adoc @@ -247,16 +247,16 @@ The maximum timeout for this lock is 900 seconds. If a node waits on this lock f To setup the JPA migrationStrategy (manual/update/validate) you should setup JPA provider as follows: .Setting the `migration-strategy` for the `quarkus` provider of the `connections-jpa` SPI -<@kc.start parameters="--spi-connections-jpa-legacy-migration-strategy=manual"/> +<@kc.start parameters="--spi-connections-jpa-quarkus-migration-strategy=manual"/> If you want to get a SQL file for DB initialization, too, you have to add this additional SPI initializeEmpty (true/false): .Setting the `initialize-empty` for the `quarkus` provider of the `connections-jpa` SPI -<@kc.start parameters="--spi-connections-jpa-legacy-initialize-empty=false"/> +<@kc.start parameters="--spi-connections-jpa-quarkus-initialize-empty=false"/> In the same way the migrationExport to point to a specific file and location: .Setting the `migration-export` for the `quarkus` provider of the `connections-jpa` SPI -<@kc.start parameters="--spi-connections-jpa-legacy-migration-export=/"/> +<@kc.start parameters="--spi-connections-jpa-quarkus-migration-export=/"/> diff --git a/federation/kerberos/src/main/java/org/keycloak/federation/kerberos/KerberosFederationProvider.java b/federation/kerberos/src/main/java/org/keycloak/federation/kerberos/KerberosFederationProvider.java index 5254bf7fe9..137449a079 100755 --- a/federation/kerberos/src/main/java/org/keycloak/federation/kerberos/KerberosFederationProvider.java +++ b/federation/kerberos/src/main/java/org/keycloak/federation/kerberos/KerberosFederationProvider.java @@ -24,7 +24,7 @@ import org.keycloak.credential.CredentialAuthentication; import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputValidator; -import org.keycloak.credential.LegacyUserCredentialManager; +import org.keycloak.credential.UserCredentialManager; import org.keycloak.federation.kerberos.impl.KerberosUsernamePasswordAuthenticator; import org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator; import org.keycloak.models.CredentialValidationOutput; @@ -168,7 +168,7 @@ public class KerberosFederationProvider implements UserStorageProvider, @Override public boolean isValid(RealmModel realm, UserModel user, CredentialInput input) { if (!(input instanceof UserCredentialModel)) return false; - if (input.getType().equals(PasswordCredentialModel.TYPE) && !((LegacyUserCredentialManager) user.credentialManager()).isConfiguredLocally(PasswordCredentialModel.TYPE)) { + if (input.getType().equals(PasswordCredentialModel.TYPE) && !((UserCredentialManager) user.credentialManager()).isConfiguredLocally(PasswordCredentialModel.TYPE)) { return validPassword(user.getFirstAttribute(KERBEROS_PRINCIPAL), input.getChallengeResponse()); } else { return false; // invalid cred type diff --git a/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java b/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java index 68c5eeca24..136e56197b 100755 --- a/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java +++ b/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java @@ -45,7 +45,7 @@ import org.keycloak.credential.CredentialAuthentication; import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputValidator; -import org.keycloak.credential.LegacyUserCredentialManager; +import org.keycloak.credential.UserCredentialManager; import org.keycloak.federation.kerberos.KerberosPrincipal; import org.keycloak.federation.kerberos.impl.KerberosUsernamePasswordAuthenticator; import org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator; @@ -68,7 +68,7 @@ import org.keycloak.policy.PasswordPolicyManagerProvider; import org.keycloak.policy.PolicyError; import org.keycloak.models.cache.UserCache; import org.keycloak.storage.DatastoreProvider; -import org.keycloak.storage.LegacyStoreManagers; +import org.keycloak.storage.StoreManagers; import org.keycloak.storage.ReadOnlyException; import org.keycloak.storage.StorageId; import org.keycloak.storage.UserStoragePrivateUtil; @@ -205,7 +205,7 @@ public class LDAPStorageProvider implements UserStorageProvider, // We need to avoid having CachedUserModel as cache is upper-layer then LDAP. Hence having CachedUserModel here may cause StackOverflowError if (local instanceof CachedUserModel) { - LegacyStoreManagers datastoreProvider = (LegacyStoreManagers) session.getProvider(DatastoreProvider.class); + StoreManagers datastoreProvider = (StoreManagers) session.getProvider(DatastoreProvider.class); local = datastoreProvider.userStorageManager().getUserById(realm, local.getId()); existing = userManager.getManagedProxiedUser(local.getId()); @@ -841,7 +841,7 @@ public class LDAPStorageProvider implements UserStorageProvider, @Override public boolean isValid(RealmModel realm, UserModel user, CredentialInput input) { if (!(input instanceof UserCredentialModel)) return false; - if (input.getType().equals(PasswordCredentialModel.TYPE) && !((LegacyUserCredentialManager) user.credentialManager()).isConfiguredLocally(PasswordCredentialModel.TYPE)) { + if (input.getType().equals(PasswordCredentialModel.TYPE) && !((UserCredentialManager) user.credentialManager()).isConfiguredLocally(PasswordCredentialModel.TYPE)) { return validPassword(realm, user, input.getChallengeResponse()); } else { return false; // invalid cred type diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmCacheSession.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmCacheSession.java index a148ec7bff..8bed4ba203 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmCacheSession.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmCacheSession.java @@ -27,7 +27,7 @@ import org.keycloak.models.cache.infinispan.entities.*; import org.keycloak.models.cache.infinispan.events.*; import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.storage.DatastoreProvider; -import org.keycloak.storage.LegacyStoreManagers; +import org.keycloak.storage.StoreManagers; import org.keycloak.storage.StorageId; import org.keycloak.storage.client.ClientStorageProviderModel; @@ -121,13 +121,13 @@ public class RealmCacheSession implements CacheRealmProvider { protected boolean clearAll; protected final long startupRevision; - private final LegacyStoreManagers datastoreProvider; + private final StoreManagers datastoreProvider; public RealmCacheSession(RealmCacheManager cache, KeycloakSession session) { this.cache = cache; this.session = session; this.startupRevision = cache.getCurrentCounter(); - this.datastoreProvider = (LegacyStoreManagers) session.getProvider(DatastoreProvider.class); + this.datastoreProvider = (StoreManagers) session.getProvider(DatastoreProvider.class); session.getTransactionManager().enlistPrepare(getPrepareTransaction()); session.getTransactionManager().enlistAfterCompletion(getAfterTransaction()); } diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/SubjectCredentialManagerCacheAdapter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/SubjectCredentialManagerCacheAdapter.java index 7f8943517e..ddb6fe68ec 100644 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/SubjectCredentialManagerCacheAdapter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/SubjectCredentialManagerCacheAdapter.java @@ -19,7 +19,7 @@ package org.keycloak.models.cache.infinispan; import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialModel; -import org.keycloak.credential.LegacyUserCredentialManager; +import org.keycloak.credential.UserCredentialManager; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; import org.keycloak.models.UserModel; @@ -27,7 +27,7 @@ import org.keycloak.models.UserModel; /** * @author Alexander Schwartz */ -public abstract class SubjectCredentialManagerCacheAdapter extends LegacyUserCredentialManager { +public abstract class SubjectCredentialManagerCacheAdapter extends UserCredentialManager { public SubjectCredentialManagerCacheAdapter(KeycloakSession session, RealmModel realm, UserModel user) { super(session, realm, user); diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java index d2abcbc4f5..7f3ae6a084 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java @@ -18,7 +18,6 @@ package org.keycloak.models.cache.infinispan; import org.keycloak.credential.CredentialModel; -import org.keycloak.credential.LegacyUserCredentialManager; import org.keycloak.models.ClientModel; import org.keycloak.models.GroupModel; import org.keycloak.models.KeycloakSession; diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserCacheSession.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserCacheSession.java index fa44b7dee5..91df0c7de9 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserCacheSession.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserCacheSession.java @@ -56,7 +56,7 @@ import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.models.utils.ReadOnlyUserModelDelegate; import org.keycloak.storage.CacheableStorageProviderModel; import org.keycloak.storage.DatastoreProvider; -import org.keycloak.storage.LegacyStoreManagers; +import org.keycloak.storage.StoreManagers; import org.keycloak.storage.OnCreateComponent; import org.keycloak.storage.OnUpdateComponent; import org.keycloak.storage.StorageId; @@ -94,13 +94,13 @@ public class UserCacheSession implements UserCache, OnCreateComponent, OnUpdateC protected Set realmInvalidations = new HashSet<>(); protected Set invalidationEvents = new HashSet<>(); // Events to be sent across cluster protected Map managedUsers = new HashMap<>(); - private LegacyStoreManagers datastoreProvider; + private StoreManagers datastoreProvider; public UserCacheSession(UserCacheManager cache, KeycloakSession session) { this.cache = cache; this.session = session; this.startupRevision = cache.getCurrentCounter(); - this.datastoreProvider = (LegacyStoreManagers) session.getProvider(DatastoreProvider.class); + this.datastoreProvider = (StoreManagers) session.getProvider(DatastoreProvider.class); session.getTransactionManager().enlistAfterCompletion(getTransaction()); } diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java b/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java index 655f3d601d..25eeef56a8 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java @@ -57,7 +57,7 @@ import static org.keycloak.utils.StreamsUtil.closing; * @author Bill Burke * @version $Revision: 1 $ */ -public class RealmAdapter implements LegacyRealmModel, JpaModel { +public class RealmAdapter implements StorageProviderRealmModel, JpaModel { protected static final Logger logger = Logger.getLogger(RealmAdapter.class); protected RealmEntity realm; protected EntityManager em; diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/UserAdapter.java b/model/jpa/src/main/java/org/keycloak/models/jpa/UserAdapter.java index e595c9d85b..c6ef656f92 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/UserAdapter.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/UserAdapter.java @@ -19,7 +19,7 @@ package org.keycloak.models.jpa; import org.keycloak.common.util.MultivaluedHashMap; import org.keycloak.common.util.ObjectUtil; -import org.keycloak.credential.LegacyUserCredentialManager; +import org.keycloak.credential.UserCredentialManager; import org.keycloak.models.ClientModel; import org.keycloak.models.GroupModel; import org.keycloak.models.KeycloakSession; @@ -519,7 +519,7 @@ public class UserAdapter implements UserModel, JpaModel { @Override public SubjectCredentialManager credentialManager() { - return new LegacyUserCredentialManager(session, realm, this); + return new UserCredentialManager(session, realm, this); } diff --git a/model/legacy-private/src/main/java/org/keycloak/migration/MigrationModelManager.java b/model/legacy-private/src/main/java/org/keycloak/migration/MigrationModelManager.java index bdb1917388..e52401714f 100644 --- a/model/legacy-private/src/main/java/org/keycloak/migration/MigrationModelManager.java +++ b/model/legacy-private/src/main/java/org/keycloak/migration/MigrationModelManager.java @@ -21,7 +21,7 @@ import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.storage.DatastoreProvider; -import org.keycloak.storage.datastore.LegacyDatastoreProvider; +import org.keycloak.storage.datastore.DefaultDatastoreProvider; /** * @author Bill Burke @@ -30,11 +30,11 @@ import org.keycloak.storage.datastore.LegacyDatastoreProvider; public class MigrationModelManager { public static void migrate(KeycloakSession session) { - ((LegacyDatastoreProvider) session.getProvider(DatastoreProvider.class)).getMigrationManager().migrate(); + ((DefaultDatastoreProvider) session.getProvider(DatastoreProvider.class)).getMigrationManager().migrate(); } public static void migrateImport(KeycloakSession session, RealmModel realm, RealmRepresentation rep, boolean skipUserDependent) { - ((LegacyDatastoreProvider) session.getProvider(DatastoreProvider.class)).getMigrationManager().migrate(realm, rep, skipUserDependent); + ((DefaultDatastoreProvider) session.getProvider(DatastoreProvider.class)).getMigrationManager().migrate(realm, rep, skipUserDependent); } } diff --git a/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_3_0.java b/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_3_0.java index 2c1a0b5730..cb1fdd3e3c 100755 --- a/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_3_0.java +++ b/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_3_0.java @@ -22,7 +22,7 @@ import org.keycloak.component.ComponentFactory; import org.keycloak.migration.ModelVersion; import org.keycloak.models.KeycloakSession; import org.keycloak.models.LDAPConstants; -import org.keycloak.models.LegacyRealmModel; +import org.keycloak.models.StorageProviderRealmModel; import org.keycloak.models.RealmModel; import org.keycloak.provider.ProviderFactory; import org.keycloak.representations.idm.RealmRepresentation; @@ -53,7 +53,7 @@ public class MigrateTo1_3_0 implements Migration { } private void migrateLDAPProviders(KeycloakSession session, RealmModel realm) { - ((LegacyRealmModel) realm).getUserStorageProvidersStream().forEachOrdered(fedProvider -> { + ((StorageProviderRealmModel) realm).getUserStorageProvidersStream().forEachOrdered(fedProvider -> { if (fedProvider.getProviderId().equals(LDAPConstants.LDAP_PROVIDER)) { fedProvider = new UserStorageProviderModel(fedProvider); // copy don't want to muck with cache MultivaluedHashMap config = fedProvider.getConfig(); diff --git a/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_4_0.java b/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_4_0.java index 8734b202a3..51c85666ce 100755 --- a/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_4_0.java +++ b/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_4_0.java @@ -22,7 +22,7 @@ import org.keycloak.migration.ModelVersion; import org.keycloak.models.ImpersonationConstants; import org.keycloak.models.KeycloakSession; import org.keycloak.models.LDAPConstants; -import org.keycloak.models.LegacyRealmModel; +import org.keycloak.models.StorageProviderRealmModel; import org.keycloak.models.RealmModel; import org.keycloak.models.UserModel; import org.keycloak.models.cache.UserCache; @@ -72,7 +72,7 @@ public class MigrateTo1_4_0 implements Migration { private void migrateLDAPMappers(KeycloakSession session, RealmModel realm) { List mandatoryInLdap = Arrays.asList("username", "username-cn", "first name", "last name"); - ((LegacyRealmModel) realm).getUserStorageProvidersStream() + ((StorageProviderRealmModel) realm).getUserStorageProvidersStream() .filter(providerModel -> Objects.equals(providerModel.getProviderId(), LDAPConstants.LDAP_PROVIDER)) .forEachOrdered(providerModel -> realm.getComponentsStream(providerModel.getId()) .filter(mapper -> mandatoryInLdap.contains(mapper.getName())) diff --git a/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_8_0.java b/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_8_0.java index 3b7c0b66e2..6874eefebd 100644 --- a/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_8_0.java +++ b/model/legacy-private/src/main/java/org/keycloak/migration/migrators/MigrateTo1_8_0.java @@ -21,7 +21,7 @@ import org.keycloak.component.ComponentModel; import org.keycloak.migration.ModelVersion; import org.keycloak.models.KeycloakSession; import org.keycloak.models.LDAPConstants; -import org.keycloak.models.LegacyRealmModel; +import org.keycloak.models.StorageProviderRealmModel; import org.keycloak.models.RealmModel; import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.representations.idm.RealmRepresentation; @@ -51,7 +51,7 @@ public class MigrateTo1_8_0 implements Migration { } protected void migrateRealm(RealmModel realm) { - ((LegacyRealmModel) realm).getUserStorageProvidersStream() + ((StorageProviderRealmModel) realm).getUserStorageProvidersStream() .filter(fedProvider -> Objects.equals(fedProvider.getProviderId(), LDAPConstants.LDAP_PROVIDER)) .filter(this::isActiveDirectory) .filter(fedProvider -> Objects.isNull(getMapperByName(realm, fedProvider, "MSAD account controls"))) diff --git a/model/legacy-private/src/main/java/org/keycloak/models/cache/CachedRealmModel.java b/model/legacy-private/src/main/java/org/keycloak/models/cache/CachedRealmModel.java index a20a4763d3..aa9d0b1f5b 100644 --- a/model/legacy-private/src/main/java/org/keycloak/models/cache/CachedRealmModel.java +++ b/model/legacy-private/src/main/java/org/keycloak/models/cache/CachedRealmModel.java @@ -17,7 +17,7 @@ package org.keycloak.models.cache; import org.keycloak.models.KeycloakSession; -import org.keycloak.models.LegacyRealmModel; +import org.keycloak.models.StorageProviderRealmModel; import org.keycloak.models.RealmModel; import org.keycloak.provider.ProviderEvent; @@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap; * @author Bill Burke * @version $Revision: 1 $ */ -public interface CachedRealmModel extends LegacyRealmModel { +public interface CachedRealmModel extends StorageProviderRealmModel { interface RealmCachedEvent extends ProviderEvent { CachedRealmModel getRealm(); diff --git a/model/legacy-private/src/main/java/org/keycloak/storage/ClientStorageManager.java b/model/legacy-private/src/main/java/org/keycloak/storage/ClientStorageManager.java index 9b7131cb1d..722275a87e 100644 --- a/model/legacy-private/src/main/java/org/keycloak/storage/ClientStorageManager.java +++ b/model/legacy-private/src/main/java/org/keycloak/storage/ClientStorageManager.java @@ -23,7 +23,7 @@ import org.keycloak.component.ComponentModel; import org.keycloak.models.ClientModel; import org.keycloak.models.ClientProvider; import org.keycloak.models.KeycloakSession; -import org.keycloak.models.LegacyRealmModel; +import org.keycloak.models.StorageProviderRealmModel; import org.keycloak.models.ModelException; import org.keycloak.models.RealmModel; import org.keycloak.storage.client.ClientLookupProvider; @@ -79,7 +79,7 @@ public class ClientStorageManager implements ClientProvider { private static Stream getStorageProviders(RealmModel realm, KeycloakSession session, Class type) { - return ((LegacyRealmModel) realm).getClientStorageProvidersStream() + return ((StorageProviderRealmModel) realm).getClientStorageProvidersStream() .filter(model -> { ClientStorageProviderFactory factory = getClientStorageProviderFactory(model, session); if (factory == null) { diff --git a/model/legacy-private/src/main/java/org/keycloak/storage/RoleStorageManager.java b/model/legacy-private/src/main/java/org/keycloak/storage/RoleStorageManager.java index 6720a16e26..a3f453a1b4 100644 --- a/model/legacy-private/src/main/java/org/keycloak/storage/RoleStorageManager.java +++ b/model/legacy-private/src/main/java/org/keycloak/storage/RoleStorageManager.java @@ -23,7 +23,7 @@ import org.keycloak.common.util.reflections.Types; import org.keycloak.component.ComponentModel; import org.keycloak.models.ClientModel; import org.keycloak.models.KeycloakSession; -import org.keycloak.models.LegacyRealmModel; +import org.keycloak.models.StorageProviderRealmModel; import org.keycloak.models.ModelException; import org.keycloak.models.RealmModel; import org.keycloak.models.RoleModel; @@ -73,7 +73,7 @@ public class RoleStorageManager implements RoleProvider { } public static Stream getStorageProviders(RealmModel realm, KeycloakSession session, Class type) { - return ((LegacyRealmModel) realm).getRoleStorageProvidersStream() + return ((StorageProviderRealmModel) realm).getRoleStorageProvidersStream() .filter(model -> { RoleStorageProviderFactory factory = getRoleStorageProviderFactory(model, session); if (factory == null) { diff --git a/model/legacy-private/src/main/java/org/keycloak/storage/UserStorageManager.java b/model/legacy-private/src/main/java/org/keycloak/storage/UserStorageManager.java index 4d4af91690..e5cf78a66f 100755 --- a/model/legacy-private/src/main/java/org/keycloak/storage/UserStorageManager.java +++ b/model/legacy-private/src/main/java/org/keycloak/storage/UserStorageManager.java @@ -60,7 +60,7 @@ import org.keycloak.models.cache.UserCache; import org.keycloak.models.utils.ComponentUtil; import org.keycloak.models.utils.ReadOnlyUserModelDelegate; import org.keycloak.storage.client.ClientStorageProvider; -import org.keycloak.storage.datastore.LegacyDatastoreProvider; +import org.keycloak.storage.datastore.DefaultDatastoreProvider; import org.keycloak.storage.federated.UserFederatedStorageProvider; import org.keycloak.storage.managers.UserStorageSyncManager; import org.keycloak.storage.user.ImportedUserValidation; @@ -89,7 +89,7 @@ public class UserStorageManager extends AbstractStorageManager realms = session.realms().getRealmsWithProviderTypeStream(UserStorageProvider.class); realms.forEach(realm -> { - Stream providers = ((LegacyRealmModel) realm).getUserStorageProvidersStream(); + Stream providers = ((StorageProviderRealmModel) realm).getUserStorageProvidersStream(); providers.forEachOrdered(provider -> { UserStorageProviderFactory factory = (UserStorageProviderFactory) session.getKeycloakSessionFactory().getProviderFactory(UserStorageProvider.class, provider.getProviderId()); if (factory instanceof ImportSynchronization && provider.isImportEnabled()) { @@ -174,7 +174,7 @@ public class UserStorageSyncManager { public static void notifyToRefreshPeriodicSyncAll(KeycloakSession session, RealmModel realm, boolean removed) { - ((LegacyRealmModel) realm).getUserStorageProvidersStream().forEachOrdered(fedProvider -> + ((StorageProviderRealmModel) realm).getUserStorageProvidersStream().forEachOrdered(fedProvider -> notifyToRefreshPeriodicSync(session, realm, fedProvider, removed)); } @@ -276,7 +276,7 @@ public class UserStorageSyncManager { @Override public void run(KeycloakSession session) { RealmModel persistentRealm = session.realms().getRealm(realmId); - ((LegacyRealmModel) persistentRealm).getUserStorageProvidersStream() + ((StorageProviderRealmModel) persistentRealm).getUserStorageProvidersStream() .filter(persistentFedProvider -> Objects.equals(provider.getId(), persistentFedProvider.getId())) .forEachOrdered(persistentFedProvider -> { // Update persistent provider in DB diff --git a/model/legacy-private/src/main/resources/META-INF/services/org.keycloak.storage.DatastoreProviderFactory b/model/legacy-private/src/main/resources/META-INF/services/org.keycloak.storage.DatastoreProviderFactory index f0a25ec0fb..371808c5a7 100644 --- a/model/legacy-private/src/main/resources/META-INF/services/org.keycloak.storage.DatastoreProviderFactory +++ b/model/legacy-private/src/main/resources/META-INF/services/org.keycloak.storage.DatastoreProviderFactory @@ -15,4 +15,4 @@ # limitations under the License. # -org.keycloak.storage.datastore.LegacyDatastoreProviderFactory \ No newline at end of file +org.keycloak.storage.datastore.DefaultDatastoreProviderFactory \ No newline at end of file diff --git a/model/legacy-private/src/test/java/org/keycloak/models/datastore/LegacyMigrationManagerTest.java b/model/legacy-private/src/test/java/org/keycloak/models/datastore/MigrationManagerTest.java similarity index 83% rename from model/legacy-private/src/test/java/org/keycloak/models/datastore/LegacyMigrationManagerTest.java rename to model/legacy-private/src/test/java/org/keycloak/models/datastore/MigrationManagerTest.java index be7aa5ea30..f23993176c 100755 --- a/model/legacy-private/src/test/java/org/keycloak/models/datastore/LegacyMigrationManagerTest.java +++ b/model/legacy-private/src/test/java/org/keycloak/models/datastore/MigrationManagerTest.java @@ -17,17 +17,16 @@ package org.keycloak.models.datastore; -import org.junit.Assert; import org.junit.Test; import org.keycloak.migration.ModelVersion; import static org.hamcrest.MatcherAssert.assertThat; -import static org.keycloak.storage.datastore.LegacyMigrationManager.RHSSO_VERSION_7_0_KEYCLOAK_VERSION; -import static org.keycloak.storage.datastore.LegacyMigrationManager.RHSSO_VERSION_7_1_KEYCLOAK_VERSION; -import static org.keycloak.storage.datastore.LegacyMigrationManager.RHSSO_VERSION_7_2_KEYCLOAK_VERSION; -import static org.keycloak.storage.datastore.LegacyMigrationManager.RHSSO_VERSION_7_3_KEYCLOAK_VERSION; -import static org.keycloak.storage.datastore.LegacyMigrationManager.RHSSO_VERSION_7_4_KEYCLOAK_VERSION; -import static org.keycloak.storage.datastore.LegacyMigrationManager.convertRHSSOVersionToKeycloakVersion; +import static org.keycloak.storage.datastore.DefaultMigrationManager.RHSSO_VERSION_7_0_KEYCLOAK_VERSION; +import static org.keycloak.storage.datastore.DefaultMigrationManager.RHSSO_VERSION_7_1_KEYCLOAK_VERSION; +import static org.keycloak.storage.datastore.DefaultMigrationManager.RHSSO_VERSION_7_2_KEYCLOAK_VERSION; +import static org.keycloak.storage.datastore.DefaultMigrationManager.RHSSO_VERSION_7_3_KEYCLOAK_VERSION; +import static org.keycloak.storage.datastore.DefaultMigrationManager.RHSSO_VERSION_7_4_KEYCLOAK_VERSION; +import static org.keycloak.storage.datastore.DefaultMigrationManager.convertRHSSOVersionToKeycloakVersion; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; @@ -36,7 +35,7 @@ import static org.hamcrest.CoreMatchers.nullValue; * @author Bill Burke * @version $Revision: 1 $ */ -public class LegacyMigrationManagerTest { +public class MigrationManagerTest { @Test public void testRHSSOVersionToKeycloakVersionConversion() { diff --git a/model/legacy-services/src/main/java/org/keycloak/exportimport/util/ImportUtils.java b/model/legacy-services/src/main/java/org/keycloak/exportimport/util/ImportUtils.java index 2de903f87e..4ae2c6fe1f 100755 --- a/model/legacy-services/src/main/java/org/keycloak/exportimport/util/ImportUtils.java +++ b/model/legacy-services/src/main/java/org/keycloak/exportimport/util/ImportUtils.java @@ -32,7 +32,7 @@ import org.keycloak.models.utils.RepresentationToModel; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.representations.idm.UserRepresentation; import org.keycloak.services.managers.RealmManager; -import org.keycloak.storage.datastore.LegacyExportImportManager; +import org.keycloak.storage.datastore.DefaultExportImportManager; import java.io.IOException; import java.io.InputStream; @@ -266,7 +266,7 @@ public class ImportUtils { private static void importFederatedUsers(KeycloakSession session, RealmProvider model, String realmName, List userReps) { RealmModel realm = model.getRealmByName(realmName); for (UserRepresentation user : userReps) { - LegacyExportImportManager.importFederatedUser(session, realm, user); + DefaultExportImportManager.importFederatedUser(session, realm, user); } } diff --git a/model/legacy/src/main/java/org/keycloak/credential/LegacyUserCredentialManager.java b/model/legacy/src/main/java/org/keycloak/credential/UserCredentialManager.java similarity index 96% rename from model/legacy/src/main/java/org/keycloak/credential/LegacyUserCredentialManager.java rename to model/legacy/src/main/java/org/keycloak/credential/UserCredentialManager.java index 562a723701..a2f8319a8b 100644 --- a/model/legacy/src/main/java/org/keycloak/credential/LegacyUserCredentialManager.java +++ b/model/legacy/src/main/java/org/keycloak/credential/UserCredentialManager.java @@ -24,7 +24,7 @@ import org.keycloak.models.SubjectCredentialManager; import org.keycloak.models.UserModel; import org.keycloak.storage.AbstractStorageManager; import org.keycloak.storage.DatastoreProvider; -import org.keycloak.storage.LegacyStoreManagers; +import org.keycloak.storage.StoreManagers; import org.keycloak.storage.StorageId; import org.keycloak.storage.UserStorageProvider; import org.keycloak.storage.UserStorageProviderFactory; @@ -36,17 +36,17 @@ import java.util.Objects; import java.util.stream.Stream; /** - * Handling credentials for a given user for the legacy store. + * Handling credentials for a given user for the store. * * @author Alexander Schwartz */ -public class LegacyUserCredentialManager extends AbstractStorageManager implements SubjectCredentialManager { +public class UserCredentialManager extends AbstractStorageManager implements SubjectCredentialManager { private final UserModel user; private final KeycloakSession session; private final RealmModel realm; - public LegacyUserCredentialManager(KeycloakSession session, RealmModel realm, UserModel user) { + public UserCredentialManager(KeycloakSession session, RealmModel realm, UserModel user) { super(session, UserStorageProviderFactory.class, UserStorageProvider.class, UserStorageProviderModel::new, "user"); this.user = user; this.session = session; @@ -269,7 +269,7 @@ public class LegacyUserCredentialManager extends AbstractStorageManagerStian Thorgersen */ -public class LegacyJpaConnectionProviderFactory extends AbstractJpaConnectionProviderFactory implements ServerInfoAwareProviderFactory { +public class QuarkusJpaConnectionProviderFactory extends AbstractJpaConnectionProviderFactory implements ServerInfoAwareProviderFactory { public static final String QUERY_PROPERTY_PREFIX = "kc.query."; - private static final Logger logger = Logger.getLogger(LegacyJpaConnectionProviderFactory.class); + private static final Logger logger = Logger.getLogger(QuarkusJpaConnectionProviderFactory.class); private static final String SQL_GET_LATEST_VERSION = "SELECT ID, VERSION FROM %sMIGRATION_MODEL ORDER BY UPDATE_TIME DESC"; enum MigrationStrategy { @@ -80,7 +80,7 @@ public class LegacyJpaConnectionProviderFactory extends AbstractJpaConnectionPro @Override public String getId() { - return "legacy"; + return "quarkus"; } private void addSpecificNamedQueries(KeycloakSession session) { diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/infinispan/LegacyInfinispanConnectionFactory.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/infinispan/QuarkusInfinispanConnectionFactory.java similarity index 93% rename from quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/infinispan/LegacyInfinispanConnectionFactory.java rename to quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/infinispan/QuarkusInfinispanConnectionFactory.java index 1913a6946d..83c7a4f5d1 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/infinispan/LegacyInfinispanConnectionFactory.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/infinispan/QuarkusInfinispanConnectionFactory.java @@ -23,7 +23,7 @@ import org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFa /** * @author Pedro Igor */ -public class LegacyInfinispanConnectionFactory extends DefaultInfinispanConnectionProviderFactory { +public class QuarkusInfinispanConnectionFactory extends DefaultInfinispanConnectionProviderFactory { @Override protected EmbeddedCacheManager initContainerManaged(EmbeddedCacheManager cacheManager) { diff --git a/quarkus/runtime/src/main/resources/META-INF/services/org.keycloak.connections.infinispan.InfinispanConnectionProviderFactory b/quarkus/runtime/src/main/resources/META-INF/services/org.keycloak.connections.infinispan.InfinispanConnectionProviderFactory index 441a760d18..b0480f6044 100644 --- a/quarkus/runtime/src/main/resources/META-INF/services/org.keycloak.connections.infinispan.InfinispanConnectionProviderFactory +++ b/quarkus/runtime/src/main/resources/META-INF/services/org.keycloak.connections.infinispan.InfinispanConnectionProviderFactory @@ -17,4 +17,4 @@ # */ # -org.keycloak.quarkus.runtime.storage.legacy.infinispan.LegacyInfinispanConnectionFactory \ No newline at end of file +org.keycloak.quarkus.runtime.storage.legacy.infinispan.QuarkusInfinispanConnectionFactory \ No newline at end of file diff --git a/quarkus/runtime/src/main/resources/META-INF/services/org.keycloak.connections.jpa.JpaConnectionProviderFactory b/quarkus/runtime/src/main/resources/META-INF/services/org.keycloak.connections.jpa.JpaConnectionProviderFactory index 26387b9b96..1abe5c5582 100644 --- a/quarkus/runtime/src/main/resources/META-INF/services/org.keycloak.connections.jpa.JpaConnectionProviderFactory +++ b/quarkus/runtime/src/main/resources/META-INF/services/org.keycloak.connections.jpa.JpaConnectionProviderFactory @@ -15,4 +15,4 @@ # limitations under the License. # -org.keycloak.quarkus.runtime.storage.legacy.database.LegacyJpaConnectionProviderFactory +org.keycloak.quarkus.runtime.storage.legacy.database.QuarkusJpaConnectionProviderFactory diff --git a/quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/entity/CustomLegacyJpaEntityProvider.java b/quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/entity/CustomJpaEntityProvider.java similarity index 93% rename from quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/entity/CustomLegacyJpaEntityProvider.java rename to quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/entity/CustomJpaEntityProvider.java index 52df541dee..8eee1545b1 100644 --- a/quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/entity/CustomLegacyJpaEntityProvider.java +++ b/quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/entity/CustomJpaEntityProvider.java @@ -21,7 +21,7 @@ import java.util.Collections; import java.util.Map; import org.keycloak.it.TestProvider; -public class CustomLegacyJpaEntityProvider implements TestProvider { +public class CustomJpaEntityProvider implements TestProvider { @Override public Class[] getClasses() { diff --git a/quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/user/CustomLegacyUserProvider.java b/quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/user/CustomUserProvider.java similarity index 91% rename from quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/user/CustomLegacyUserProvider.java rename to quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/user/CustomUserProvider.java index cf1662bb6a..66de718985 100644 --- a/quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/user/CustomLegacyUserProvider.java +++ b/quarkus/tests/integration/src/test-providers/java/com/acme/provider/legacy/jpa/user/CustomUserProvider.java @@ -20,9 +20,8 @@ package com.acme.provider.legacy.jpa.user; import java.util.Collections; import java.util.Map; import org.keycloak.it.TestProvider; -import com.acme.provider.legacy.jpa.entity.Realm; -public class CustomLegacyUserProvider implements TestProvider { +public class CustomUserProvider implements TestProvider { @Override public Class[] getClasses() { diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/ClusterConfigDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/ClusterConfigDistTest.java index ef6ad8a0f1..74033efa9d 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/ClusterConfigDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/ClusterConfigDistTest.java @@ -30,7 +30,7 @@ import org.junit.jupiter.api.condition.OS; import org.keycloak.it.junit5.extension.BeforeStartDistribution; import org.keycloak.it.junit5.extension.CLIResult; import org.keycloak.it.junit5.extension.DistributionTest; -import org.keycloak.it.junit5.extension.LegacyStore; +import org.keycloak.it.junit5.extension.Storage; import org.keycloak.it.junit5.extension.RawDistOnly; import org.keycloak.it.utils.KeycloakDistribution; @@ -39,7 +39,7 @@ import io.quarkus.test.junit.main.LaunchResult; @DistributionTest(reInstall = DistributionTest.ReInstall.BEFORE_TEST) @RawDistOnly(reason = "Not possible to mount files using docker.") -@LegacyStore(defaultLocalCache = false) +@Storage(defaultLocalCache = false) public class ClusterConfigDistTest { @Test diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomLegacyJpaEntityProviderDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomJpaEntityProviderDistTest.java similarity index 86% rename from quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomLegacyJpaEntityProviderDistTest.java rename to quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomJpaEntityProviderDistTest.java index d67a810dc6..49a61fda46 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomLegacyJpaEntityProviderDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomJpaEntityProviderDistTest.java @@ -20,21 +20,19 @@ package org.keycloak.it.cli.dist; import org.junit.jupiter.api.Test; import org.keycloak.it.junit5.extension.CLIResult; import org.keycloak.it.junit5.extension.DistributionTest; -import org.keycloak.it.junit5.extension.LegacyStore; import org.keycloak.it.junit5.extension.RawDistOnly; import org.keycloak.it.junit5.extension.TestProvider; -import com.acme.provider.legacy.jpa.entity.CustomLegacyJpaEntityProvider; +import com.acme.provider.legacy.jpa.entity.CustomJpaEntityProvider; import io.quarkus.test.junit.main.Launch; import io.quarkus.test.junit.main.LaunchResult; @DistributionTest @RawDistOnly(reason = "Containers are immutable") -@LegacyStore -public class CustomLegacyJpaEntityProviderDistTest { +public class CustomJpaEntityProviderDistTest { @Test - @TestProvider(CustomLegacyJpaEntityProvider.class) + @TestProvider(CustomJpaEntityProvider.class) @Launch({ "start-dev", "--log-level=org.hibernate.jpa.internal.util.LogHelper:debug" }) void testUserManagedEntityNotAddedToDefaultPU(LaunchResult result) { CLIResult cliResult = (CLIResult) result; diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomLegacyUserProviderDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomUserProviderDistTest.java similarity index 87% rename from quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomLegacyUserProviderDistTest.java rename to quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomUserProviderDistTest.java index 9c4fd1b5f9..e84cc9b1d9 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomLegacyUserProviderDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/CustomUserProviderDistTest.java @@ -20,21 +20,19 @@ package org.keycloak.it.cli.dist; import org.junit.jupiter.api.Test; import org.keycloak.it.junit5.extension.CLIResult; import org.keycloak.it.junit5.extension.DistributionTest; -import org.keycloak.it.junit5.extension.LegacyStore; import org.keycloak.it.junit5.extension.RawDistOnly; import org.keycloak.it.junit5.extension.TestProvider; -import com.acme.provider.legacy.jpa.user.CustomLegacyUserProvider; +import com.acme.provider.legacy.jpa.user.CustomUserProvider; import io.quarkus.test.junit.main.Launch; import io.quarkus.test.junit.main.LaunchResult; @DistributionTest @RawDistOnly(reason = "Containers are immutable") -@LegacyStore -public class CustomLegacyUserProviderDistTest { +public class CustomUserProviderDistTest { @Test - @TestProvider(CustomLegacyUserProvider.class) + @TestProvider(CustomUserProvider.class) @Launch({ "start-dev", "--spi-user-provider=custom_jpa", "--spi-user-jpa-enabled=false" }) void testUserManagedEntityNotAddedToDefaultPU(LaunchResult result) { CLIResult cliResult = (CLIResult) result; diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/FeaturesDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/FeaturesDistTest.java index 7df322ab8c..8d66ed4547 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/FeaturesDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/FeaturesDistTest.java @@ -10,7 +10,6 @@ import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.OS; import org.keycloak.it.junit5.extension.CLIResult; import org.keycloak.it.junit5.extension.DistributionTest; -import org.keycloak.it.junit5.extension.LegacyStore; import org.keycloak.it.junit5.extension.RawDistOnly; import org.keycloak.it.utils.KeycloakDistribution; import org.keycloak.quarkus.runtime.cli.command.Build; @@ -25,7 +24,6 @@ import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTI @DistributionTest @RawDistOnly(reason = "Containers are immutable") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) -@LegacyStore public class FeaturesDistTest { private static final String PREVIEW_FEATURES_EXPECTED_LOG = "Preview features enabled: admin-fine-grained-authz:v1, client-secret-rotation:v1, dpop:v1, multi-site:v1, recovery-codes:v1, scripts:v1, token-exchange:v1, update-email:v1"; diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/MetricsDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/MetricsDistTest.java index d2248d0d98..ba6605c152 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/MetricsDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/MetricsDistTest.java @@ -29,14 +29,12 @@ import java.util.function.Consumer; import org.junit.jupiter.api.Test; import org.keycloak.it.junit5.extension.BeforeStartDistribution; import org.keycloak.it.junit5.extension.DistributionTest; -import org.keycloak.it.junit5.extension.LegacyStore; import org.keycloak.it.junit5.extension.RawDistOnly; import org.keycloak.it.utils.KeycloakDistribution; import io.quarkus.test.junit.main.Launch; @DistributionTest(keepAlive =true) -@LegacyStore public class MetricsDistTest { @Test diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/QuarkusPropertiesDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/QuarkusPropertiesDistTest.java index 18204e0957..9d2f4b452f 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/QuarkusPropertiesDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/QuarkusPropertiesDistTest.java @@ -37,7 +37,6 @@ import org.keycloak.it.junit5.extension.BeforeStartDistribution; import org.keycloak.it.junit5.extension.CLIResult; import org.keycloak.it.junit5.extension.DistributionTest; import org.keycloak.it.junit5.extension.KeepServerAlive; -import org.keycloak.it.junit5.extension.LegacyStore; import org.keycloak.it.junit5.extension.RawDistOnly; import org.keycloak.it.utils.KeycloakDistribution; @@ -47,7 +46,6 @@ import io.quarkus.test.junit.main.LaunchResult; @DistributionTest(reInstall = DistributionTest.ReInstall.NEVER) @RawDistOnly(reason = "Containers are immutable") @TestMethodOrder(OrderAnnotation.class) -@LegacyStore public class QuarkusPropertiesDistTest { private static final String QUARKUS_BUILDTIME_HIBERNATE_METRICS_KEY = "quarkus.datasource.metrics.enabled"; diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/DatabaseOptionsDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/DatabaseOptionsDistTest.java index 2da42ec68f..b8c30c21cc 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/DatabaseOptionsDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/DatabaseOptionsDistTest.java @@ -22,13 +22,11 @@ import io.quarkus.test.junit.main.LaunchResult; import org.junit.jupiter.api.Test; import org.keycloak.it.junit5.extension.CLIResult; import org.keycloak.it.junit5.extension.DistributionTest; -import org.keycloak.it.junit5.extension.LegacyStore; import org.keycloak.it.junit5.extension.WithDatabase; import org.keycloak.it.junit5.extension.WithEnvVars; @DistributionTest @WithDatabase(alias = "postgres") -@LegacyStore public class DatabaseOptionsDistTest { @Test diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/MariaDBDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/MariaDBDistTest.java index dc6beaecca..41447cfbbe 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/MariaDBDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/MariaDBDistTest.java @@ -17,15 +17,12 @@ package org.keycloak.it.storage.database.dist; -import org.keycloak.it.junit5.extension.CLITest; import org.keycloak.it.junit5.extension.DistributionTest; -import org.keycloak.it.junit5.extension.LegacyStore; import org.keycloak.it.junit5.extension.WithDatabase; import org.keycloak.it.storage.database.MariaDBTest; @DistributionTest(removeBuildOptionsAfterBuild = true) @WithDatabase(alias = "mariadb") -@LegacyStore public class MariaDBDistTest extends MariaDBTest { } diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/MySQLDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/MySQLDistTest.java index 688f1ae678..9ec65ba2db 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/MySQLDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/MySQLDistTest.java @@ -1,12 +1,10 @@ package org.keycloak.it.storage.database.dist; import org.keycloak.it.junit5.extension.DistributionTest; -import org.keycloak.it.junit5.extension.LegacyStore; import org.keycloak.it.junit5.extension.WithDatabase; import org.keycloak.it.storage.database.MySQLTest; @DistributionTest(removeBuildOptionsAfterBuild = true) @WithDatabase(alias = "mysql") -@LegacyStore public class MySQLDistTest extends MySQLTest { } diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/PostgreSQLDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/PostgreSQLDistTest.java index cb871f3739..0ad0e03d32 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/PostgreSQLDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/PostgreSQLDistTest.java @@ -23,7 +23,6 @@ import static org.hamcrest.MatcherAssert.assertThat; import org.junit.jupiter.api.Test; import org.keycloak.it.junit5.extension.CLIResult; import org.keycloak.it.junit5.extension.DistributionTest; -import org.keycloak.it.junit5.extension.LegacyStore; import org.keycloak.it.junit5.extension.WithDatabase; import org.keycloak.it.storage.database.PostgreSQLTest; @@ -32,7 +31,6 @@ import io.quarkus.test.junit.main.LaunchResult; @DistributionTest(removeBuildOptionsAfterBuild = true) @WithDatabase(alias = "postgres") -@LegacyStore public class PostgreSQLDistTest extends PostgreSQLTest { @Test diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/TransactionConfigurationDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/TransactionConfigurationDistTest.java index 4cd0d55e69..a03b9f1115 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/TransactionConfigurationDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/dist/TransactionConfigurationDistTest.java @@ -5,12 +5,10 @@ import io.quarkus.test.junit.main.LaunchResult; import org.junit.jupiter.api.Test; import org.keycloak.it.junit5.extension.CLIResult; import org.keycloak.it.junit5.extension.DistributionTest; -import org.keycloak.it.junit5.extension.LegacyStore; import org.keycloak.it.junit5.extension.WithDatabase; @DistributionTest @WithDatabase(alias = "mssql") -@LegacyStore public class TransactionConfigurationDistTest { @Test diff --git a/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/CLITestExtension.java b/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/CLITestExtension.java index 4937a930fa..7a7b5e65ec 100644 --- a/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/CLITestExtension.java +++ b/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/CLITestExtension.java @@ -22,7 +22,6 @@ import io.quarkus.runtime.configuration.QuarkusConfigFactory; import io.quarkus.test.junit.QuarkusMainTestExtension; import io.quarkus.test.junit.main.Launch; import io.quarkus.test.junit.main.LaunchResult; - import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext.Namespace; import org.junit.jupiter.api.extension.ExtensionContext.Store; @@ -46,7 +45,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; -import java.util.Properties; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -101,7 +99,7 @@ public class CLITestExtension extends QuarkusMainTestExtension { onKeepServerAlive(context.getRequiredTestMethod().getAnnotation(KeepServerAlive.class)); if (dist == null) { - dist = createDistribution(distConfig, getLegacyStoreConfig(context), getDatabaseConfig(context)); + dist = createDistribution(distConfig, getStoreConfig(context), getDatabaseConfig(context)); } copyTestProvider(context.getRequiredTestClass().getAnnotation(TestProvider.class)); @@ -125,8 +123,8 @@ public class CLITestExtension extends QuarkusMainTestExtension { return context.getStore(Namespace.create(context.getRequiredTestClass(), context.getRequiredTestMethod())); } - private static LegacyStore getLegacyStoreConfig(ExtensionContext context) { - return context.getTestClass().get().getDeclaredAnnotation(LegacyStore.class); + private static Storage getStoreConfig(ExtensionContext context) { + return context.getTestClass().get().getDeclaredAnnotation(Storage.class); } private void copyTestProvider(TestProvider provider) { @@ -227,7 +225,7 @@ public class CLITestExtension extends QuarkusMainTestExtension { if (distConfig != null) { if (BEFORE_ALL.equals(distConfig.reInstall())) { - dist = createDistribution(distConfig, getLegacyStoreConfig(context), getDatabaseConfig(context)); + dist = createDistribution(distConfig, getStoreConfig(context), getDatabaseConfig(context)); } } else { forceTestLaunchMode(); @@ -245,8 +243,8 @@ public class CLITestExtension extends QuarkusMainTestExtension { super.afterAll(context); } - private KeycloakDistribution createDistribution(DistributionTest config, LegacyStore legacyStoreConfig, WithDatabase databaseConfig) { - return new KeycloakDistributionDecorator(legacyStoreConfig, databaseConfig, config, DistributionType.getCurrent().orElse(RAW).newInstance(config)); + private KeycloakDistribution createDistribution(DistributionTest config, Storage storeConfig, WithDatabase databaseConfig) { + return new KeycloakDistributionDecorator(storeConfig, databaseConfig, config, DistributionType.getCurrent().orElse(RAW).newInstance(config)); } @Override diff --git a/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/KeycloakDistributionDecorator.java b/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/KeycloakDistributionDecorator.java index 46ff1cf9f9..715b1a0025 100644 --- a/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/KeycloakDistributionDecorator.java +++ b/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/KeycloakDistributionDecorator.java @@ -24,14 +24,14 @@ import org.keycloak.it.utils.KeycloakDistribution; public class KeycloakDistributionDecorator implements KeycloakDistribution { - private LegacyStore legacyStoreConfig; + private Storage storageConfig; private WithDatabase databaseConfig; private DistributionTest config; private KeycloakDistribution delegate; - public KeycloakDistributionDecorator(LegacyStore legacyStoreConfig, WithDatabase databaseConfig, DistributionTest config, - KeycloakDistribution delegate) { - this.legacyStoreConfig = legacyStoreConfig; + public KeycloakDistributionDecorator(Storage storageConfig, WithDatabase databaseConfig, DistributionTest config, + KeycloakDistribution delegate) { + this.storageConfig = storageConfig; this.databaseConfig = databaseConfig; this.config = config; this.delegate = delegate; @@ -43,7 +43,7 @@ public class KeycloakDistributionDecorator implements KeycloakDistribution { args.addAll(List.of(config.defaultOptions())); - return delegate.run(new ServerOptions(legacyStoreConfig, databaseConfig, args)); + return delegate.run(new ServerOptions(storageConfig, databaseConfig, args)); } @Override diff --git a/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/ServerOptions.java b/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/ServerOptions.java index 932f87178c..85a524a76f 100644 --- a/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/ServerOptions.java +++ b/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/ServerOptions.java @@ -39,12 +39,12 @@ final class ServerOptions extends ArrayList { .or("-h"::equals) .or(ShowConfig.NAME::equals); - ServerOptions(LegacyStore legacyStoreConfig, WithDatabase withDatabase, List rawOptions) { + ServerOptions(Storage storageConfig, WithDatabase withDatabase, List rawOptions) { if (rawOptions.isEmpty()) { return; } - for (Map.Entry> entry : getDefaultOptions(legacyStoreConfig, withDatabase).entrySet()) { + for (Map.Entry> entry : getDefaultOptions(storageConfig, withDatabase).entrySet()) { if (contains(entry.getKey())) { continue; } @@ -57,28 +57,19 @@ final class ServerOptions extends ArrayList { addAll(0, rawOptions); } - private Map> getDefaultOptions(LegacyStore legacyStoreConfig, WithDatabase withDatabase) { + private Map> getDefaultOptions(Storage storageConfig, WithDatabase withDatabase) { Map> defaultOptions = new HashMap<>(); - defaultOptions.put("--cache=local", ignoreCacheLocal(legacyStoreConfig)); + defaultOptions.put("--cache=local", ignoreCacheLocal(storageConfig)); return defaultOptions; } - private Predicate ignoreCacheLocal(LegacyStore legacyStoreConfig) { + private Predicate ignoreCacheLocal(Storage storageConfig) { return new Predicate() { @Override public boolean test(String arg) { - return arg.contains("--cache") || legacyStoreConfig == null || !legacyStoreConfig.defaultLocalCache(); - } - }.or(IGNORED_ARGUMENTS); - } - - private Predicate ignoreStorageChm(LegacyStore legacyStoreConfig, WithDatabase withDatabase) { - return new Predicate() { - @Override - public boolean test(String arg) { - return arg.contains("--storage") || legacyStoreConfig != null || withDatabase != null; + return arg.contains("--cache") || storageConfig == null || !storageConfig.defaultLocalCache(); } }.or(IGNORED_ARGUMENTS); } diff --git a/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/LegacyStore.java b/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/Storage.java similarity index 90% rename from quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/LegacyStore.java rename to quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/Storage.java index 1247ecdca7..484c78e6fc 100644 --- a/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/LegacyStore.java +++ b/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/Storage.java @@ -24,12 +24,12 @@ import java.lang.annotation.Target; import org.junit.jupiter.api.extension.ExtendWith; /** - * Use this annotation to enable the legacy store when running a test. + * Use this annotation to change the default storage configuration when running a test. */ @Target(ElementType.TYPE) @ExtendWith({ CLITestExtension.class }) @Retention(RetentionPolicy.RUNTIME) -public @interface LegacyStore { +public @interface Storage { /** * If {@code true}, the cache is set to local by default. diff --git a/server-spi-private/src/main/java/org/keycloak/storage/ExportImportManager.java b/server-spi-private/src/main/java/org/keycloak/storage/ExportImportManager.java index 27e2034f90..f9dd452eb0 100644 --- a/server-spi-private/src/main/java/org/keycloak/storage/ExportImportManager.java +++ b/server-spi-private/src/main/java/org/keycloak/storage/ExportImportManager.java @@ -28,7 +28,7 @@ import org.keycloak.representations.idm.UserRepresentation; import java.io.InputStream; /** - * Manage importing and updating of realms for the legacy store. + * Manage importing and updating of realms for the store. * * @author Alexander Schwartz */ diff --git a/server-spi-private/src/main/java/org/keycloak/storage/LegacyStoreMigrateRepresentationEvent.java b/server-spi-private/src/main/java/org/keycloak/storage/StoreMigrateRepresentationEvent.java similarity index 77% rename from server-spi-private/src/main/java/org/keycloak/storage/LegacyStoreMigrateRepresentationEvent.java rename to server-spi-private/src/main/java/org/keycloak/storage/StoreMigrateRepresentationEvent.java index 19684680c0..0d2294b38a 100644 --- a/server-spi-private/src/main/java/org/keycloak/storage/LegacyStoreMigrateRepresentationEvent.java +++ b/server-spi-private/src/main/java/org/keycloak/storage/StoreMigrateRepresentationEvent.java @@ -22,19 +22,18 @@ import org.keycloak.provider.ProviderEvent; import org.keycloak.representations.idm.RealmRepresentation; /** - * Event for notifying legacy store, so it can do migrations on the representation as needed. + * Event for notifying the store, so it can do migrations on the representation as needed. * * CAUTION: This event is exceptional as it performs any necessary modificaton of the representation. - * This will be removed once the legacy store has been removed. */ -public class LegacyStoreMigrateRepresentationEvent implements ProviderEvent { +public class StoreMigrateRepresentationEvent implements ProviderEvent { private final KeycloakSession session; private final RealmModel realm; private final RealmRepresentation rep; private final boolean skipUserDependent; - public LegacyStoreMigrateRepresentationEvent(KeycloakSession session, RealmModel realm, RealmRepresentation rep, boolean skipUserDependent) { + public StoreMigrateRepresentationEvent(KeycloakSession session, RealmModel realm, RealmRepresentation rep, boolean skipUserDependent) { this.session = session; this.realm = realm; this.rep = rep; @@ -42,7 +41,7 @@ public class LegacyStoreMigrateRepresentationEvent implements ProviderEvent { } public static void fire(KeycloakSession session, RealmModel realm, RealmRepresentation rep, boolean skipUserDependent) { - session.getKeycloakSessionFactory().publish(new LegacyStoreMigrateRepresentationEvent(session, realm, rep, skipUserDependent)); + session.getKeycloakSessionFactory().publish(new StoreMigrateRepresentationEvent(session, realm, rep, skipUserDependent)); } public KeycloakSession getSession() { diff --git a/server-spi-private/src/main/java/org/keycloak/storage/LegacyStoreSyncEvent.java b/server-spi-private/src/main/java/org/keycloak/storage/StoreSyncEvent.java similarity index 79% rename from server-spi-private/src/main/java/org/keycloak/storage/LegacyStoreSyncEvent.java rename to server-spi-private/src/main/java/org/keycloak/storage/StoreSyncEvent.java index 54ba48ffb4..76a7907655 100644 --- a/server-spi-private/src/main/java/org/keycloak/storage/LegacyStoreSyncEvent.java +++ b/server-spi-private/src/main/java/org/keycloak/storage/StoreSyncEvent.java @@ -21,23 +21,23 @@ import org.keycloak.models.RealmModel; import org.keycloak.provider.ProviderEvent; /** - * Event for notifying legacy store about the need to reconfigure user providers - * sychronization. + * Event for notifying the store about the need to reconfigure user providers + * synchronization. */ -public class LegacyStoreSyncEvent implements ProviderEvent { +public class StoreSyncEvent implements ProviderEvent { private final KeycloakSession session; private final RealmModel realm; private final boolean removed; - public LegacyStoreSyncEvent(KeycloakSession session, RealmModel realm, boolean removed) { + public StoreSyncEvent(KeycloakSession session, RealmModel realm, boolean removed) { this.session = session; this.realm = realm; this.removed = removed; } public static void fire(KeycloakSession session, RealmModel realm, boolean removed) { - session.getKeycloakSessionFactory().publish(new LegacyStoreSyncEvent(session, realm, removed)); + session.getKeycloakSessionFactory().publish(new StoreSyncEvent(session, realm, removed)); } public KeycloakSession getSession() { diff --git a/services/src/main/java/org/keycloak/services/managers/RealmManager.java b/services/src/main/java/org/keycloak/services/managers/RealmManager.java index ad51e8c719..1881e70f67 100755 --- a/services/src/main/java/org/keycloak/services/managers/RealmManager.java +++ b/services/src/main/java/org/keycloak/services/managers/RealmManager.java @@ -53,8 +53,8 @@ import org.keycloak.representations.idm.RealmEventsConfigRepresentation; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.representations.idm.RoleRepresentation; import org.keycloak.sessions.AuthenticationSessionProvider; -import org.keycloak.storage.LegacyStoreMigrateRepresentationEvent; -import org.keycloak.storage.LegacyStoreSyncEvent; +import org.keycloak.storage.StoreMigrateRepresentationEvent; +import org.keycloak.storage.StoreSyncEvent; import org.keycloak.services.clientregistration.policy.DefaultClientRegistrationPolicies; import java.util.Collections; @@ -280,7 +280,7 @@ public class RealmManager { } // Refresh periodic sync tasks for configured storageProviders - LegacyStoreSyncEvent.fire(session, realm, true); + StoreSyncEvent.fire(session, realm, true); } return removed; } @@ -607,13 +607,13 @@ public class RealmManager { } // Refresh periodic sync tasks for configured storageProviders - LegacyStoreSyncEvent.fire(session, realm, false); + StoreSyncEvent.fire(session, realm, false); setupAuthorizationServices(realm); setupClientRegistrations(realm); if (rep.getKeycloakVersion() != null) { - LegacyStoreMigrateRepresentationEvent.fire(session, realm, rep, skipUserDependent); + StoreMigrateRepresentationEvent.fire(session, realm, rep, skipUserDependent); } session.clientPolicy().updateRealmModelFromRepresentation(realm, rep); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java index fdd65c7b5c..781a8c433f 100644 --- a/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java @@ -27,7 +27,6 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -117,8 +116,7 @@ import org.keycloak.services.resources.admin.permissions.AdminPermissionManageme import org.keycloak.services.resources.admin.permissions.AdminPermissions; import org.keycloak.storage.DatastoreProvider; import org.keycloak.storage.ExportImportManager; -import org.keycloak.storage.LegacyStoreSyncEvent; -import org.keycloak.userprofile.DeclarativeUserProfileProvider; +import org.keycloak.storage.StoreSyncEvent; import org.keycloak.utils.ProfileHelper; import org.keycloak.utils.ReservedCharValidator; @@ -447,7 +445,7 @@ public class RealmAdminResource { RepresentationToModel.updateRealm(rep, realm, session); // Refresh periodic sync tasks for configured federationProviders - LegacyStoreSyncEvent.fire(session, realm, false); + StoreSyncEvent.fire(session, realm, false); // This populates the map in DefaultKeycloakContext to be used when treating the event session.getContext().getUri(); diff --git a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserPropertyFileStorage.java b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserPropertyFileStorage.java index 066614d3d2..2279e5c0b9 100644 --- a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserPropertyFileStorage.java +++ b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserPropertyFileStorage.java @@ -19,7 +19,7 @@ package org.keycloak.testsuite.federation; import org.keycloak.component.ComponentModel; import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInputValidator; -import org.keycloak.credential.LegacyUserCredentialManager; +import org.keycloak.credential.UserCredentialManager; import org.keycloak.models.GroupModel; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; @@ -144,7 +144,7 @@ public class UserPropertyFileStorage implements UserLookupProvider, UserStorageP @Override public SubjectCredentialManager credentialManager() { - return new LegacyUserCredentialManager(session, realm, this); + return new UserCredentialManager(session, realm, this); } }; } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/ldap/LDAPSyncTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/ldap/LDAPSyncTest.java index bebe0186df..7fe72abaf8 100755 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/ldap/LDAPSyncTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/ldap/LDAPSyncTest.java @@ -33,7 +33,7 @@ import org.keycloak.component.ComponentModel; import org.keycloak.models.GroupModel; import org.keycloak.models.KeycloakSessionFactory; import org.keycloak.models.LDAPConstants; -import org.keycloak.models.LegacyRealmModel; +import org.keycloak.models.StorageProviderRealmModel; import org.keycloak.models.RealmModel; import org.keycloak.models.UserModel; import org.keycloak.models.UserProvider; @@ -151,7 +151,7 @@ public class LDAPSyncTest extends AbstractLDAPTest { // Assert lastSync time updated Assert.assertTrue(ctx.getLdapModel().getLastSync() > 0); - ((LegacyRealmModel) testRealm).getUserStorageProvidersStream().forEachOrdered(persistentFedModel -> { + ((StorageProviderRealmModel) testRealm).getUserStorageProvidersStream().forEachOrdered(persistentFedModel -> { if (LDAPStorageProviderFactory.PROVIDER_NAME.equals(persistentFedModel.getProviderId())) { Assert.assertTrue(persistentFedModel.getLastSync() > 0); } else { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/ClientStorageTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/ClientStorageTest.java index bf028b5b3b..775342caf9 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/ClientStorageTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/ClientStorageTest.java @@ -29,7 +29,7 @@ import org.keycloak.events.Details; import org.keycloak.models.ClientModel; import org.keycloak.models.Constants; import org.keycloak.models.KeycloakSession; -import org.keycloak.models.LegacyRealmModel; +import org.keycloak.models.StorageProviderRealmModel; import org.keycloak.models.RealmModel; import org.keycloak.models.cache.infinispan.ClientAdapter; import org.keycloak.representations.AccessToken; @@ -328,7 +328,7 @@ public class ClientStorageTest extends AbstractTestRealmKeycloakTest { testingClient.server().run(session -> { RealmModel realm = session.realms().getRealmByName("test"); - ClientStorageProviderModel model = ((LegacyRealmModel) realm).getClientStorageProvidersStream().findFirst().get(); + ClientStorageProviderModel model = ((StorageProviderRealmModel) realm).getClientStorageProvidersStream().findFirst().get(); Calendar eviction = Calendar.getInstance(); eviction.add(Calendar.HOUR, 1); model.setCachePolicy(CacheableStorageProviderModel.CachePolicy.EVICT_DAILY); @@ -352,7 +352,7 @@ public class ClientStorageTest extends AbstractTestRealmKeycloakTest { testingClient.server().run(session -> { RealmModel realm = session.realms().getRealmByName("test"); - ClientStorageProviderModel model = ((LegacyRealmModel) realm).getClientStorageProvidersStream().findAny().get(); + ClientStorageProviderModel model = ((StorageProviderRealmModel) realm).getClientStorageProvidersStream().findAny().get(); Calendar eviction = Calendar.getInstance(); eviction.add(Calendar.HOUR, 4 * 24); model.setCachePolicy(CacheableStorageProviderModel.CachePolicy.EVICT_WEEKLY); @@ -379,7 +379,7 @@ public class ClientStorageTest extends AbstractTestRealmKeycloakTest { testingClient.server().run(session -> { RealmModel realm = session.realms().getRealmByName("test"); - ClientStorageProviderModel model = ((LegacyRealmModel) realm).getClientStorageProvidersStream().findFirst().get(); + ClientStorageProviderModel model = ((StorageProviderRealmModel) realm).getClientStorageProvidersStream().findFirst().get(); model.setCachePolicy(CacheableStorageProviderModel.CachePolicy.MAX_LIFESPAN); model.setMaxLifespan(1 * 60 * 60 * 1000); realm.updateComponent(model); @@ -427,7 +427,7 @@ public class ClientStorageTest extends AbstractTestRealmKeycloakTest { testingClient.server().run(session -> { RealmModel realm = session.realms().getRealmByName("test"); - ClientStorageProviderModel model = ((LegacyRealmModel) realm).getClientStorageProvidersStream().findFirst().get(); + ClientStorageProviderModel model = ((StorageProviderRealmModel) realm).getClientStorageProvidersStream().findFirst().get(); model.setCachePolicy(CacheableStorageProviderModel.CachePolicy.NO_CACHE); realm.updateComponent(model); }); @@ -447,7 +447,7 @@ public class ClientStorageTest extends AbstractTestRealmKeycloakTest { private void setDefaultCachePolicy() { testingClient.server().run(session -> { RealmModel realm = session.realms().getRealmByName("test"); - ClientStorageProviderModel model = ((LegacyRealmModel) realm).getClientStorageProvidersStream().findFirst().get(); + ClientStorageProviderModel model = ((StorageProviderRealmModel) realm).getClientStorageProvidersStream().findFirst().get(); model.setCachePolicy(CacheableStorageProviderModel.CachePolicy.DEFAULT); realm.updateComponent(model); }); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/UserStorageProvidersTestUtils.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/UserStorageProvidersTestUtils.java index 629ce3a853..928acdfb02 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/UserStorageProvidersTestUtils.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/UserStorageProvidersTestUtils.java @@ -4,7 +4,7 @@ import org.jboss.logging.Logger; import org.keycloak.common.util.reflections.Types; import org.keycloak.component.ComponentModel; import org.keycloak.models.KeycloakSession; -import org.keycloak.models.LegacyRealmModel; +import org.keycloak.models.StorageProviderRealmModel; import org.keycloak.models.ModelException; import org.keycloak.models.RealmModel; import org.keycloak.storage.UserStorageProvider; @@ -47,7 +47,7 @@ public class UserStorageProvidersTestUtils { } public static Stream getStorageProviders(RealmModel realm, KeycloakSession session, Class type) { - return ((LegacyRealmModel) realm).getUserStorageProvidersStream() + return ((StorageProviderRealmModel) realm).getUserStorageProvidersStream() .filter(model -> { UserStorageProviderFactory factory = getUserStorageProviderFactory(model, session); if (factory == null) { diff --git a/testsuite/model/README.md b/testsuite/model/README.md index e992cd433c..a774e0c2f0 100644 --- a/testsuite/model/README.md +++ b/testsuite/model/README.md @@ -6,8 +6,7 @@ initialized only with those providers that are explicitly enabled in a used profile via `keycloak.model.parameters` system property. This allows writing tests and running those in different -configurations quickly, e.g. once with legacy JPA storage, -second time with purely new Hot Rod implementation. +configurations quickly. The valid parameters are names of classes in `org.keycloak.testsuite.model.parameters` package, and it is possible to combine those by providing multiple class names diff --git a/testsuite/model/pom.xml b/testsuite/model/pom.xml index e53eaea46b..7f8ae395ef 100644 --- a/testsuite/model/pom.xml +++ b/testsuite/model/pom.xml @@ -197,104 +197,104 @@ - legacy-jpa + jpa - LegacyJpa + Jpa - legacy-jpa+infinispan + jpa+infinispan - Infinispan,LegacyJpa + Infinispan,Jpa - legacy-jpa+infinispan+client-storage + jpa+infinispan+client-storage - LegacyJpa,Infinispan,HardcodedClientStorage + Jpa,Infinispan,HardcodedClientStorage - legacy-jpa+cross-dc-infinispan + jpa+cross-dc-infinispan - CrossDCInfinispan,LegacyJpa + CrossDCInfinispan,Jpa - legacy-jpa+cross-dc-infinispan-offline-sessions-preloading + jpa+cross-dc-infinispan-offline-sessions-preloading - CrossDCInfinispan,LegacyJpa + CrossDCInfinispan,Jpa enabled true - legacy-jpa+infinispan-offline-sessions-preloading + jpa+infinispan-offline-sessions-preloading - Infinispan,LegacyJpa + Infinispan,Jpa enabled true - legacy-jpa-federation+infinispan + jpa-federation+infinispan - Infinispan,LegacyJpaFederation,TestsuiteUserMapStorage + Infinispan,JpaFederation,TestsuiteUserMapStorage - legacy-jpa-federation-backward+infinispan + jpa-federation-backward+infinispan - Infinispan,LegacyJpaFederation,BackwardsCompatibilityUserStorage + Infinispan,JpaFederation,BackwardsCompatibilityUserStorage - legacy-jpa-federation + jpa-federation - LegacyJpaFederation,TestsuiteUserMapStorage + JpaFederation,TestsuiteUserMapStorage - legacy-jpa-federation-backward + jpa-federation-backward - LegacyJpaFederation,BackwardsCompatibilityUserStorage + JpaFederation,BackwardsCompatibilityUserStorage - legacy-jpa-federation-file-storage + jpa-federation-file-storage - LegacyJpaFederation,TestsuiteUserFileStorage + JpaFederation,TestsuiteUserFileStorage - legacy-jpa-federation-file-storage+infinispan + jpa-federation-file-storage+infinispan - LegacyJpaFederation,TestsuiteUserFileStorage,Infinispan + JpaFederation,TestsuiteUserFileStorage,Infinispan - legacy-jpa-federation+ldap + jpa-federation+ldap - LegacyJpaFederation,LdapUserStorage + JpaFederation,LdapUserStorage - legacy-jpa-federation+ldap+infinispan + jpa-federation+ldap+infinispan - LegacyJpaFederation,LdapUserStorage,Infinispan + JpaFederation,LdapUserStorage,Infinispan diff --git a/testsuite/model/src/test/java/org/keycloak/testsuite/model/TimeOffsetTest.java b/testsuite/model/src/test/java/org/keycloak/testsuite/model/TimeOffsetTest.java index 2dbaa3440f..ce6f375ea4 100644 --- a/testsuite/model/src/test/java/org/keycloak/testsuite/model/TimeOffsetTest.java +++ b/testsuite/model/src/test/java/org/keycloak/testsuite/model/TimeOffsetTest.java @@ -65,7 +65,7 @@ public class TimeOffsetTest extends KeycloakModelTest { setTimeOffset(5); - // legacy store requires explicit expiration of expired events + // store requires explicit expiration of expired events ProviderFactory providerFactory = session.getKeycloakSessionFactory().getProviderFactory(EventStoreProvider.class); if ("jpa".equals(providerFactory.getId())) { provider.clearExpiredEvents(); diff --git a/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/LegacyJpa.java b/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/Jpa.java similarity index 94% rename from testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/LegacyJpa.java rename to testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/Jpa.java index 15ac04aeb4..d1a2900574 100644 --- a/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/LegacyJpa.java +++ b/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/Jpa.java @@ -17,7 +17,6 @@ package org.keycloak.testsuite.model.parameters; import org.keycloak.authorization.jpa.store.JPAAuthorizationStoreFactory; -import org.keycloak.broker.provider.IdentityProvider; import org.keycloak.broker.provider.IdentityProviderFactory; import org.keycloak.broker.provider.IdentityProviderSpi; import org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory; @@ -43,7 +42,7 @@ import org.keycloak.models.jpa.JpaUserProviderFactory; import org.keycloak.provider.ProviderFactory; import org.keycloak.provider.Spi; import org.keycloak.storage.DatastoreSpi; -import org.keycloak.storage.datastore.LegacyDatastoreProviderFactory; +import org.keycloak.storage.datastore.DefaultDatastoreProviderFactory; import org.keycloak.testsuite.model.Config; import com.google.common.collect.ImmutableSet; import java.util.Set; @@ -54,7 +53,7 @@ import org.keycloak.protocol.LoginProtocolSpi; * * @author hmlnarik */ -public class LegacyJpa extends KeycloakModelParameters { +public class Jpa extends KeycloakModelParameters { static final Set> ALLOWED_SPIS = ImmutableSet.>builder() // jpa-specific @@ -78,7 +77,7 @@ public class LegacyJpa extends KeycloakModelParameters { static final Set> ALLOWED_FACTORIES = ImmutableSet.>builder() // jpa-specific - .add(LegacyDatastoreProviderFactory.class) + .add(DefaultDatastoreProviderFactory.class) .add(DefaultJpaConnectionProviderFactory.class) .add(JPAAuthorizationStoreFactory.class) @@ -103,7 +102,7 @@ public class LegacyJpa extends KeycloakModelParameters { .build(); - public LegacyJpa() { + public Jpa() { super(ALLOWED_SPIS, ALLOWED_FACTORIES); } diff --git a/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/LegacyJpaFederation.java b/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/JpaFederation.java similarity index 93% rename from testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/LegacyJpaFederation.java rename to testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/JpaFederation.java index 8cfb500bbd..29ba4088af 100644 --- a/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/LegacyJpaFederation.java +++ b/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/JpaFederation.java @@ -37,12 +37,12 @@ import org.keycloak.testsuite.model.Config; * * @author hmlnarik */ -public class LegacyJpaFederation extends KeycloakModelParameters { +public class JpaFederation extends KeycloakModelParameters { private final AtomicInteger counter = new AtomicInteger(); static final Set> ALLOWED_SPIS = ImmutableSet.>builder() - .addAll(LegacyJpa.ALLOWED_SPIS) + .addAll(Jpa.ALLOWED_SPIS) .add(UserStorageProviderSpi.class) .add(UserFederatedStorageProviderSpi.class) .add(ClientScopeStorageProviderSpi.class) @@ -50,12 +50,12 @@ public class LegacyJpaFederation extends KeycloakModelParameters { .build(); static final Set> ALLOWED_FACTORIES = ImmutableSet.>builder() - .addAll(LegacyJpa.ALLOWED_FACTORIES) + .addAll(Jpa.ALLOWED_FACTORIES) .add(JpaUserFederatedStorageProviderFactory.class) .add(ClientScopeStorageProviderFactory.class) .build(); - public LegacyJpaFederation() { + public JpaFederation() { super(ALLOWED_SPIS, ALLOWED_FACTORIES); } @@ -74,6 +74,6 @@ public class LegacyJpaFederation extends KeycloakModelParameters { @Override public void updateConfig(Config cf) { - LegacyJpa.updateConfigForJpa(cf); + Jpa.updateConfigForJpa(cf); } } diff --git a/testsuite/utils/src/main/java/org/keycloak/testsuite/util/cli/SyncDummyFederationProviderCommand.java b/testsuite/utils/src/main/java/org/keycloak/testsuite/util/cli/SyncDummyFederationProviderCommand.java index e1110cb60c..8de38c9b87 100644 --- a/testsuite/utils/src/main/java/org/keycloak/testsuite/util/cli/SyncDummyFederationProviderCommand.java +++ b/testsuite/utils/src/main/java/org/keycloak/testsuite/util/cli/SyncDummyFederationProviderCommand.java @@ -19,7 +19,7 @@ package org.keycloak.testsuite.util.cli; import org.keycloak.common.util.MultivaluedHashMap; import org.keycloak.models.KeycloakSession; -import org.keycloak.models.LegacyRealmModel; +import org.keycloak.models.StorageProviderRealmModel; import org.keycloak.models.RealmModel; import org.keycloak.storage.managers.UserStorageSyncManager; import org.keycloak.storage.UserStorageProviderModel; @@ -71,7 +71,7 @@ public class SyncDummyFederationProviderCommand extends AbstractCommand { return null; } - return ((LegacyRealmModel) realm).getUserStorageProvidersStream() + return ((StorageProviderRealmModel) realm).getUserStorageProvidersStream() .filter(fedProvider -> Objects.equals(fedProvider.getName(), displayName)) .findFirst() .orElse(null);