diff --git a/connections/mongo/src/main/java/org/keycloak/connections/mongo/DefaultMongoConnectionFactoryProvider.java b/connections/mongo/src/main/java/org/keycloak/connections/mongo/DefaultMongoConnectionFactoryProvider.java index d591fbabe1..7bc507a608 100755 --- a/connections/mongo/src/main/java/org/keycloak/connections/mongo/DefaultMongoConnectionFactoryProvider.java +++ b/connections/mongo/src/main/java/org/keycloak/connections/mongo/DefaultMongoConnectionFactoryProvider.java @@ -40,7 +40,8 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro "org.keycloak.models.entities.UserFederationProviderEntity", "org.keycloak.models.entities.ProtocolMapperEntity", "org.keycloak.models.entities.IdentityProviderMapperEntity", - "org.keycloak.models.mongo.keycloak.entities.MongoUserConsentEntity" + "org.keycloak.models.mongo.keycloak.entities.MongoUserConsentEntity", + "org.keycloak.models.mongo.keycloak.entities.MongoMigrationModelEntity" }; private static final Logger logger = Logger.getLogger(DefaultMongoConnectionFactoryProvider.class); diff --git a/forms/common-themes/src/main/resources/theme/base/account/applications.ftl b/forms/common-themes/src/main/resources/theme/base/account/applications.ftl index 7442c4987c..78bde00ea8 100755 --- a/forms/common-themes/src/main/resources/theme/base/account/applications.ftl +++ b/forms/common-themes/src/main/resources/theme/base/account/applications.ftl @@ -9,6 +9,7 @@
+ diff --git a/forms/common-themes/src/main/resources/theme/base/account/messages/messages_en.properties b/forms/common-themes/src/main/resources/theme/base/account/messages/messages_en.properties index ee8d70fdeb..7eb971b684 100755 --- a/forms/common-themes/src/main/resources/theme/base/account/messages/messages_en.properties +++ b/forms/common-themes/src/main/resources/theme/base/account/messages/messages_en.properties @@ -51,9 +51,11 @@ role_manage-clients=Manage clients role_manage-events=Manage events role_view-profile=View profile role_manage-account=Manage account +role_read-token=Read token client_account=Account client_security-admin-console=Security Admin Console client_realm-management=Realm Management +client_broker=Broker requiredFields=Required fields diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties index a1f76eee6b..98985ca29c 100755 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties @@ -84,9 +84,11 @@ role_manage-clients=Manage clients role_manage-events=Manage events role_view-profile=View profile role_manage-account=Manage account +role_read-token=Read token client_account=Account client_security-admin-console=Security Admin Console client_realm-management=Realm Management +client_broker=Broker invalidUserMessage=Invalid username or password. invalidEmailMessage=Invalid email address. diff --git a/model/api/src/main/java/org/keycloak/migration/migrators/MigrationTo1_2_0_RC1.java b/model/api/src/main/java/org/keycloak/migration/migrators/MigrationTo1_2_0_RC1.java index 5c483f9b28..1ad5ac7de5 100755 --- a/model/api/src/main/java/org/keycloak/migration/migrators/MigrationTo1_2_0_RC1.java +++ b/model/api/src/main/java/org/keycloak/migration/migrators/MigrationTo1_2_0_RC1.java @@ -8,6 +8,7 @@ import org.keycloak.models.RealmModel; import org.keycloak.models.utils.KeycloakModelUtils; import java.util.List; +import java.util.Map; /** * @author Bill Burke @@ -21,17 +22,33 @@ public class MigrationTo1_2_0_RC1 { if (client == null) { client = KeycloakModelUtils.createClient(realm, Constants.BROKER_SERVICE_CLIENT_ID); client.setEnabled(true); + client.setName("${client_" + Constants.BROKER_SERVICE_CLIENT_ID + "}"); client.setFullScopeAllowed(false); for (String role : Constants.BROKER_SERVICE_ROLES) { - client.addRole(role).setDescription("${role_"+role+"}"); + client.addRole(role).setDescription("${role_"+ role.toLowerCase().replaceAll("_", "-") +"}"); } } } + + private void setupClientNames(RealmModel realm) { + Map clients = realm.getClientNameMap(); + + setupClientName(clients, Constants.ACCOUNT_MANAGEMENT_CLIENT_ID); + setupClientName(clients, Constants.ADMIN_CONSOLE_CLIENT_ID); + setupClientName(clients, Constants.REALM_MANAGEMENT_CLIENT_ID); + } + + private void setupClientName(Map clients, String clientId) { + ClientModel client = clients.get(clientId); + if (client != null && client.getName() == null) client.setName("${client_" + clientId + "}"); + } + public void migrate(KeycloakSession session) { List realms = session.realms().getRealms(); for (RealmModel realm : realms) { setupBrokerService(realm); + setupClientNames(realm); } } diff --git a/model/api/src/main/java/org/keycloak/models/Constants.java b/model/api/src/main/java/org/keycloak/models/Constants.java index 60d71c79e2..32fe6d5712 100755 --- a/model/api/src/main/java/org/keycloak/models/Constants.java +++ b/model/api/src/main/java/org/keycloak/models/Constants.java @@ -9,6 +9,7 @@ public interface Constants { String ACCOUNT_MANAGEMENT_CLIENT_ID = "account"; String BROKER_SERVICE_CLIENT_ID = "broker"; + String REALM_MANAGEMENT_CLIENT_ID = "realm-management"; String INSTALLED_APP_URN = "urn:ietf:wg:oauth:2.0:oob"; String INSTALLED_APP_URL = "http://localhost"; diff --git a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/entities/MongoMigrationModelEntity.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/entities/MongoMigrationModelEntity.java index 6acc40cbc9..2eadc113f4 100755 --- a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/entities/MongoMigrationModelEntity.java +++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/entities/MongoMigrationModelEntity.java @@ -1,5 +1,6 @@ package org.keycloak.models.mongo.keycloak.entities; +import org.keycloak.connections.mongo.api.MongoCollection; import org.keycloak.connections.mongo.api.MongoIdentifiableEntity; import org.keycloak.connections.mongo.api.context.MongoStoreInvocationContext; @@ -7,6 +8,7 @@ import org.keycloak.connections.mongo.api.context.MongoStoreInvocationContext; * @author Bill Burke * @version $Revision: 1 $ */ +@MongoCollection(collectionName = "migrationModel") public class MongoMigrationModelEntity implements MongoIdentifiableEntity { public static final String MIGRATION_MODEL_ID = "VERSION"; private String id = MIGRATION_MODEL_ID; 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 4ff3ee18c4..88d9eb53d4 100755 --- a/services/src/main/java/org/keycloak/services/managers/RealmManager.java +++ b/services/src/main/java/org/keycloak/services/managers/RealmManager.java @@ -113,11 +113,11 @@ public class RealmManager { } public String getRealmAdminClientId(RealmModel realm) { - return "realm-management"; + return Constants.REALM_MANAGEMENT_CLIENT_ID; } public String getRealmAdminClientId(RealmRepresentation realm) { - return "realm-management"; + return Constants.REALM_MANAGEMENT_CLIENT_ID; } @@ -223,10 +223,11 @@ public class RealmManager { if (client == null) { client = new ClientManager(this).createClient(realm, Constants.BROKER_SERVICE_CLIENT_ID); client.setEnabled(true); + client.setName("${client_" + Constants.BROKER_SERVICE_CLIENT_ID + "}"); client.setFullScopeAllowed(false); for (String role : Constants.BROKER_SERVICE_ROLES) { - client.addRole(role).setDescription("${role_"+role+"}"); + client.addRole(role).setDescription("${role_"+ role.toLowerCase().replaceAll("_", "-") +"}"); } } } diff --git a/services/src/main/java/org/keycloak/services/resources/AccountService.java b/services/src/main/java/org/keycloak/services/resources/AccountService.java index b9e8d89c93..bc81f46de6 100755 --- a/services/src/main/java/org/keycloak/services/resources/AccountService.java +++ b/services/src/main/java/org/keycloak/services/resources/AccountService.java @@ -531,7 +531,14 @@ public class AccountService { event.event(EventType.REVOKE_GRANT).client(auth.getClient()).user(auth.getUser()).detail(Details.REVOKED_CLIENT, client.getClientId()).success(); setReferrerOnPage(); - return account.setSuccess(Messages.SUCCESS_GRANT_REVOKED).createResponse(AccountPages.APPLICATIONS); + UriBuilder builder = Urls.accountBase(uriInfo.getBaseUri()).path(AccountService.class, "applicationsPage"); + String referrer = uriInfo.getQueryParameters().getFirst("referrer"); + if (referrer != null) { + builder.queryParam("referrer", referrer); + + } + URI location = builder.build(realm.getName()); + return Response.seeOther(location).build(); } /**