diff --git a/export-import/export-import-api/src/main/java/org/keycloak/exportimport/util/ImportUtils.java b/export-import/export-import-api/src/main/java/org/keycloak/exportimport/util/ImportUtils.java index 21285c9572..66b106cc04 100755 --- a/export-import/export-import-api/src/main/java/org/keycloak/exportimport/util/ImportUtils.java +++ b/export-import/export-import-api/src/main/java/org/keycloak/exportimport/util/ImportUtils.java @@ -81,7 +81,7 @@ public class ImportUtils { // We just imported master realm. All 'masterAdminApps' need to be refreshed RealmModel adminRealm = realm; for (RealmModel currentRealm : model.getRealms()) { - ClientModel masterApp = adminRealm.getClientByClientId(KeycloakModelUtils.getMasterRealmAdminApplicationName(currentRealm)); + ClientModel masterApp = adminRealm.getClientByClientId(KeycloakModelUtils.getMasterRealmAdminApplicationClientId(currentRealm)); if (masterApp != null) { currentRealm.setMasterAdminClient(masterApp); } else { @@ -91,7 +91,7 @@ public class ImportUtils { } else { // Need to refresh masterApp for current realm RealmModel adminRealm = model.getRealm(adminRealmId); - ClientModel masterApp = adminRealm.getClientByClientId(KeycloakModelUtils.getMasterRealmAdminApplicationName(realm)); + ClientModel masterApp = adminRealm.getClientByClientId(KeycloakModelUtils.getMasterRealmAdminApplicationClientId(realm)); if (masterApp != null) { realm.setMasterAdminClient(masterApp); } else { @@ -119,7 +119,7 @@ public class ImportUtils { } adminRole.setDescription("${role_"+AdminRoles.ADMIN+"}"); - ClientModel realmAdminApp = KeycloakModelUtils.createClient(adminRealm, KeycloakModelUtils.getMasterRealmAdminApplicationName(realm)); + ClientModel realmAdminApp = KeycloakModelUtils.createClient(adminRealm, KeycloakModelUtils.getMasterRealmAdminApplicationClientId(realm)); realmAdminApp.setBearerOnly(true); realm.setMasterAdminClient(realmAdminApp); diff --git a/model/api/src/main/java/org/keycloak/models/AdminRoles.java b/model/api/src/main/java/org/keycloak/models/AdminRoles.java index 73a93c3872..c067a1d842 100755 --- a/model/api/src/main/java/org/keycloak/models/AdminRoles.java +++ b/model/api/src/main/java/org/keycloak/models/AdminRoles.java @@ -9,7 +9,7 @@ public class AdminRoles { public static String ADMIN = "admin"; - // for admin application local to each realm + // for admin client local to each realm public static String REALM_ADMIN = "realm-admin"; public static String CREATE_REALM = "create-realm"; diff --git a/model/api/src/main/java/org/keycloak/models/ClientModel.java b/model/api/src/main/java/org/keycloak/models/ClientModel.java index 9cc51f375c..026e35e242 100755 --- a/model/api/src/main/java/org/keycloak/models/ClientModel.java +++ b/model/api/src/main/java/org/keycloak/models/ClientModel.java @@ -16,7 +16,7 @@ public interface ClientModel extends RoleContainerModel { String PUBLIC_KEY = "publicKey"; String X509CERTIFICATE = "X509Certificate"; - void updateApplication(); + void updateClient(); String getId(); diff --git a/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java b/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java index bd03cac67e..8ee918bd6f 100755 --- a/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java +++ b/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java @@ -245,7 +245,7 @@ public final class KeycloakModelUtils { } } - public static String getMasterRealmAdminApplicationName(RealmModel realm) { + public static String getMasterRealmAdminApplicationClientId(RealmModel realm) { return realm.getName() + "-realm"; } } diff --git a/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java b/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java index ae26387bab..f830ac1f24 100755 --- a/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java +++ b/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java @@ -517,7 +517,7 @@ public class RepresentationToModel { * @return */ public static ClientModel createClient(KeycloakSession session, RealmModel realm, ClientRepresentation resourceRep, boolean addDefaultRoles) { - logger.debug("************ CREATE APPLICATION: {0}" + resourceRep.getClientId()); + logger.debug("Create client: {0}" + resourceRep.getClientId()); ClientModel client = resourceRep.getId()!=null ? realm.addClient(resourceRep.getId(), resourceRep.getClientId()) : realm.addClient(resourceRep.getClientId()); if (resourceRep.isEnabled() != null) client.setEnabled(resourceRep.isEnabled()); @@ -540,7 +540,7 @@ public class RepresentationToModel { } else { client.setNodeReRegistrationTimeout(-1); } - client.updateApplication(); + client.updateClient(); if (resourceRep.getNotBefore() != null) { client.setNotBefore(resourceRep.getNotBefore()); @@ -565,7 +565,7 @@ public class RepresentationToModel { } if (resourceRep.getWebOrigins() != null) { for (String webOrigin : resourceRep.getWebOrigins()) { - logger.debugv("Application: {0} webOrigin: {1}", resourceRep.getClientId(), webOrigin); + logger.debugv("Client: {0} webOrigin: {1}", resourceRep.getClientId(), webOrigin); client.addWebOrigin(webOrigin); } } else { @@ -580,7 +580,7 @@ public class RepresentationToModel { if (uri.getPort() != -1) { origin += ":" + uri.getPort(); } - logger.debugv("adding default application origin: {0}" , origin); + logger.debugv("adding default client origin: {0}" , origin); origins.add(origin); } } @@ -627,7 +627,7 @@ public class RepresentationToModel { if (rep.getBaseUrl() != null) resource.setBaseUrl(rep.getBaseUrl()); if (rep.isSurrogateAuthRequired() != null) resource.setSurrogateAuthRequired(rep.isSurrogateAuthRequired()); if (rep.getNodeReRegistrationTimeout() != null) resource.setNodeReRegistrationTimeout(rep.getNodeReRegistrationTimeout()); - resource.updateApplication(); + resource.updateClient(); if (rep.getProtocol() != null) resource.setProtocol(rep.getProtocol()); if (rep.getAttributes() != null) { @@ -725,7 +725,7 @@ public class RepresentationToModel { for (ScopeMappingRepresentation mapping : mappings) { ClientModel client = realm.getClientByClientId(mapping.getClient()); if (client == null) { - throw new RuntimeException("Unknown client specified in application scope mappings"); + throw new RuntimeException("Unknown client specified in client scope mappings"); } for (String roleString : mapping.getRoles()) { RoleModel role = clientModel.getRole(roleString.trim()); @@ -821,15 +821,15 @@ public class RepresentationToModel { // Role mappings - public static void createClientRoleMappings(ClientModel applicationModel, UserModel user, List roleNames) { + public static void createClientRoleMappings(ClientModel clientModel, UserModel user, List roleNames) { if (user == null) { throw new RuntimeException("User not found"); } for (String roleName : roleNames) { - RoleModel role = applicationModel.getRole(roleName.trim()); + RoleModel role = clientModel.getRole(roleName.trim()); if (role == null) { - role = applicationModel.addRole(roleName.trim()); + role = clientModel.addRole(roleName.trim()); } user.grantRole(role); diff --git a/model/file/src/main/java/org/keycloak/models/file/adapter/ClientAdapter.java b/model/file/src/main/java/org/keycloak/models/file/adapter/ClientAdapter.java index e40d25182c..18cc9c858b 100755 --- a/model/file/src/main/java/org/keycloak/models/file/adapter/ClientAdapter.java +++ b/model/file/src/main/java/org/keycloak/models/file/adapter/ClientAdapter.java @@ -62,7 +62,7 @@ public class ClientAdapter implements ClientModel { } @Override - public void updateApplication() { + public void updateClient() { } @Override diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/ClientAdapter.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/ClientAdapter.java index 42d41538db..5330fbc18a 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/ClientAdapter.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/ClientAdapter.java @@ -42,8 +42,8 @@ public class ClientAdapter implements ClientModel { } @Override - public void updateApplication() { - if (updated != null) updated.updateApplication(); + public void updateClient() { + if (updated != null) updated.updateClient(); } @Override diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/ClientAdapter.java b/model/jpa/src/main/java/org/keycloak/models/jpa/ClientAdapter.java index 90e83f4c89..b04a92c15e 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/ClientAdapter.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/ClientAdapter.java @@ -469,7 +469,7 @@ public class ClientAdapter implements ClientModel { } @Override - public void updateApplication() { + public void updateClient() { em.flush(); } diff --git a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/ClientAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/ClientAdapter.java index a2e1fa04d2..803cedf417 100755 --- a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/ClientAdapter.java +++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/ClientAdapter.java @@ -46,7 +46,7 @@ public class ClientAdapter extends AbstractMongoAdapter imple } @Override - public void updateApplication() { + public void updateClient() { updateMongoEntity(); } diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ClientModelTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ClientModelTest.java index a9b1344f2c..f0fc63b14c 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ClientModelTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ClientModelTest.java @@ -48,7 +48,7 @@ public class ClientModelTest extends AbstractModelTest { client.registerNode("node1", 10); client.registerNode("10.20.30.40", 50); - client.updateApplication(); + client.updateClient(); } @Test