diff --git a/broker/oidc/src/main/java/org/keycloak/broker/oidc/KeycloakOIDCIdentityProvider.java b/broker/oidc/src/main/java/org/keycloak/broker/oidc/KeycloakOIDCIdentityProvider.java index 47847dc68dd..ff89a89edce 100755 --- a/broker/oidc/src/main/java/org/keycloak/broker/oidc/KeycloakOIDCIdentityProvider.java +++ b/broker/oidc/src/main/java/org/keycloak/broker/oidc/KeycloakOIDCIdentityProvider.java @@ -4,14 +4,12 @@ import org.keycloak.broker.oidc.util.SimpleHttp; import org.keycloak.constants.AdapterConstants; import org.keycloak.events.EventBuilder; import org.keycloak.jose.jws.JWSInput; -import org.keycloak.jose.jws.crypto.RSAProvider; import org.keycloak.models.RealmModel; import org.keycloak.models.UserSessionModel; import org.keycloak.representations.adapters.action.AdminAction; import org.keycloak.representations.adapters.action.LogoutAction; import org.keycloak.services.managers.AuthenticationManager; import org.keycloak.util.JsonSerialization; -import org.keycloak.util.PemUtils; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -90,7 +88,7 @@ public class KeycloakOIDCIdentityProvider extends OIDCIdentityProvider { @Override public SimpleHttp generateTokenRequest(String authorizationCode) { return super.generateTokenRequest(authorizationCode) - .param(AdapterConstants.APPLICATION_SESSION_STATE, "n/a"); // hack to get backchannel logout to work + .param(AdapterConstants.CLIENT_SESSION_STATE, "n/a"); // hack to get backchannel logout to work } diff --git a/core/src/main/java/org/keycloak/constants/AdapterConstants.java b/core/src/main/java/org/keycloak/constants/AdapterConstants.java index df302b2f1e7..aa223955d35 100755 --- a/core/src/main/java/org/keycloak/constants/AdapterConstants.java +++ b/core/src/main/java/org/keycloak/constants/AdapterConstants.java @@ -19,13 +19,13 @@ public interface AdapterConstants { String AUTH_DATA_PARAM_NAME = "org.keycloak.json.adapterConfig"; // Attribute passed in codeToToken request from adapter to Keycloak and saved in ClientSession. Contains ID of HttpSession on adapter - public static final String APPLICATION_SESSION_STATE = "application_session_state"; + public static final String CLIENT_SESSION_STATE = "client_session_state"; // Attribute passed in codeToToken request from adapter to Keycloak and saved in ClientSession. Contains hostname of adapter where HttpSession is served - public static final String APPLICATION_SESSION_HOST = "application_session_host"; + public static final String CLIENT_SESSION_HOST = "client_session_host"; // Attribute passed in registerNode request for register new application cluster node once he joined cluster - public static final String APPLICATION_CLUSTER_HOST = "application_cluster_host"; + public static final String CLIENT_CLUSTER_HOST = "client_cluster_host"; // Cookie used on adapter side to store token info. Used only when tokenStore is 'COOKIE' public static final String KEYCLOAK_ADAPTER_STATE_COOKIE = "KEYCLOAK_ADAPTER_STATE"; 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 b109dc35583..21285c95727 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 @@ -54,7 +54,7 @@ public class ImportUtils { if (Config.getAdminRealm().equals(realm.getId())) { // Delete all masterAdmin apps due to foreign key constraints for (RealmModel currRealm : model.getRealms()) { - currRealm.setMasterAdminApp(null); + currRealm.setMasterAdminClient(null); } } // TODO: For migration between versions, it should be possible to delete just realm but keep it's users @@ -83,7 +83,7 @@ public class ImportUtils { for (RealmModel currentRealm : model.getRealms()) { ClientModel masterApp = adminRealm.getClientByClientId(KeycloakModelUtils.getMasterRealmAdminApplicationName(currentRealm)); if (masterApp != null) { - currentRealm.setMasterAdminApp(masterApp); + currentRealm.setMasterAdminClient(masterApp); } else { setupMasterAdminManagement(model, currentRealm); } @@ -93,7 +93,7 @@ public class ImportUtils { RealmModel adminRealm = model.getRealm(adminRealmId); ClientModel masterApp = adminRealm.getClientByClientId(KeycloakModelUtils.getMasterRealmAdminApplicationName(realm)); if (masterApp != null) { - realm.setMasterAdminApp(masterApp); + realm.setMasterAdminClient(masterApp); } else { setupMasterAdminManagement(model, realm); } @@ -121,7 +121,7 @@ public class ImportUtils { ClientModel realmAdminApp = KeycloakModelUtils.createClient(adminRealm, KeycloakModelUtils.getMasterRealmAdminApplicationName(realm)); realmAdminApp.setBearerOnly(true); - realm.setMasterAdminApp(realmAdminApp); + realm.setMasterAdminClient(realmAdminApp); for (String r : AdminRoles.ALL_REALM_ROLES) { RoleModel role = realmAdminApp.addRole(r); diff --git a/forms/common-themes/src/main/resources/theme/base/admin/index.ftl b/forms/common-themes/src/main/resources/theme/base/admin/index.ftl index 161acdad734..20e21b744f7 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/index.ftl +++ b/forms/common-themes/src/main/resources/theme/base/admin/index.ftl @@ -30,8 +30,7 @@ - - + diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/app.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/app.js index f7ea60dddf0..f45453c7441 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/app.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/app.js @@ -212,8 +212,8 @@ module.config([ '$routeProvider', function($routeProvider) { realm : function(RealmLoader) { return RealmLoader(); }, - applications : function(ApplicationListLoader) { - return ApplicationListLoader(); + clients : function(ClientListLoader) { + return ClientListLoader(); }, roles : function(RoleListLoader) { return RoleListLoader(); @@ -311,8 +311,8 @@ module.config([ '$routeProvider', function($routeProvider) { user : function(UserLoader) { return UserLoader(); }, - applications : function(ApplicationListLoader) { - return ApplicationListLoader(); + clients : function(ClientListLoader) { + return ClientListLoader(); } }, controller : 'UserRoleMappingCtrl' @@ -369,8 +369,8 @@ module.config([ '$routeProvider', function($routeProvider) { roles : function(RoleListLoader) { return RoleListLoader(); }, - applications : function(ApplicationListLoader) { - return ApplicationListLoader(); + clients : function(ClientListLoader) { + return ClientListLoader(); } }, controller : 'RoleDetailCtrl' @@ -387,8 +387,8 @@ module.config([ '$routeProvider', function($routeProvider) { roles : function(RoleListLoader) { return RoleListLoader(); }, - applications : function(ApplicationListLoader) { - return ApplicationListLoader(); + clients : function(ClientListLoader) { + return ClientListLoader(); } }, controller : 'RoleDetailCtrl' @@ -406,14 +406,14 @@ module.config([ '$routeProvider', function($routeProvider) { controller : 'RoleListCtrl' }) - .when('/create/role/:realm/applications/:application', { - templateUrl : resourceUrl + '/partials/application-role-detail.html', + .when('/create/role/:realm/clients/:client', { + templateUrl : resourceUrl + '/partials/client-role-detail.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); }, role : function() { return {}; @@ -421,56 +421,56 @@ module.config([ '$routeProvider', function($routeProvider) { roles : function(RoleListLoader) { return RoleListLoader(); }, - applications : function(ApplicationListLoader) { - return ApplicationListLoader(); + clients : function(ClientListLoader) { + return ClientListLoader(); } }, - controller : 'ApplicationRoleDetailCtrl' + controller : 'ClientRoleDetailCtrl' }) - .when('/realms/:realm/applications/:application/roles/:role', { - templateUrl : resourceUrl + '/partials/application-role-detail.html', + .when('/realms/:realm/clients/:client/roles/:role', { + templateUrl : resourceUrl + '/partials/client-role-detail.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); }, - role : function(ApplicationRoleLoader) { - return ApplicationRoleLoader(); + role : function(ClientRoleLoader) { + return ClientRoleLoader(); }, roles : function(RoleListLoader) { return RoleListLoader(); }, - applications : function(ApplicationListLoader) { - return ApplicationListLoader(); + clients : function(ClientListLoader) { + return ClientListLoader(); } }, - controller : 'ApplicationRoleDetailCtrl' + controller : 'ClientRoleDetailCtrl' }) - .when('/realms/:realm/applications/:application/mappers', { - templateUrl : resourceUrl + '/partials/application-mappers.html', + .when('/realms/:realm/clients/:client/mappers', { + templateUrl : resourceUrl + '/partials/client-mappers.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); }, serverInfo : function(ServerInfoLoader) { return ServerInfoLoader(); } }, - controller : 'ApplicationProtocolMapperListCtrl' + controller : 'ClientProtocolMapperListCtrl' }) - .when('/realms/:realm/applications/:application/add-mappers', { - templateUrl : resourceUrl + '/partials/application-mappers-add.html', + .when('/realms/:realm/clients/:client/add-mappers', { + templateUrl : resourceUrl + '/partials/client-mappers-add.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); }, serverInfo : function(ServerInfoLoader) { return ServerInfoLoader(); @@ -478,26 +478,26 @@ module.config([ '$routeProvider', function($routeProvider) { }, controller : 'AddBuiltinProtocolMapperCtrl' }) - .when('/realms/:realm/applications/:application/mappers/:id', { + .when('/realms/:realm/clients/:client/mappers/:id', { templateUrl : resourceUrl + '/partials/protocol-mapper-detail.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); }, serverInfo : function(ServerInfoLoader) { return ServerInfoLoader(); }, - mapper : function(ApplicationProtocolMapperLoader) { - return ApplicationProtocolMapperLoader(); + mapper : function(ClientProtocolMapperLoader) { + return ClientProtocolMapperLoader(); } }, - controller : 'ApplicationProtocolMapperCtrl' + controller : 'ClientProtocolMapperCtrl' }) - .when('/create/application/:realm/:application/mappers', { + .when('/create/client/:realm/:client/mappers', { templateUrl : resourceUrl + '/partials/protocol-mapper-detail.html', resolve : { realm : function(RealmLoader) { @@ -506,231 +506,231 @@ module.config([ '$routeProvider', function($routeProvider) { serverInfo : function(ServerInfoLoader) { return ServerInfoLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationProtocolMapperCreateCtrl' + controller : 'ClientProtocolMapperCreateCtrl' }) - .when('/realms/:realm/applications/:application/sessions', { - templateUrl : resourceUrl + '/partials/application-sessions.html', + .when('/realms/:realm/clients/:client/sessions', { + templateUrl : resourceUrl + '/partials/client-sessions.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); }, - sessionCount : function(ApplicationSessionCountLoader) { - return ApplicationSessionCountLoader(); + sessionCount : function(ClientSessionCountLoader) { + return ClientSessionCountLoader(); } }, - controller : 'ApplicationSessionsCtrl' + controller : 'ClientSessionsCtrl' }) - .when('/realms/:realm/applications/:application/credentials', { - templateUrl : resourceUrl + '/partials/application-credentials.html', + .when('/realms/:realm/clients/:client/credentials', { + templateUrl : resourceUrl + '/partials/client-credentials.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationCredentialsCtrl' + controller : 'ClientCredentialsCtrl' }) - .when('/realms/:realm/applications/:application/identity-provider', { - templateUrl : resourceUrl + '/partials/application-identity-provider.html', + .when('/realms/:realm/clients/:client/identity-provider', { + templateUrl : resourceUrl + '/partials/client-identity-provider.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationIdentityProviderCtrl' + controller : 'ClientIdentityProviderCtrl' }) - .when('/realms/:realm/applications/:application/clustering', { - templateUrl : resourceUrl + '/partials/application-clustering.html', + .when('/realms/:realm/clients/:client/clustering', { + templateUrl : resourceUrl + '/partials/client-clustering.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationClusteringCtrl' + controller : 'ClientClusteringCtrl' }) - .when('/register-node/realms/:realm/applications/:application/clustering', { - templateUrl : resourceUrl + '/partials/application-clustering-node.html', + .when('/register-node/realms/:realm/clients/:client/clustering', { + templateUrl : resourceUrl + '/partials/client-clustering-node.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationClusteringNodeCtrl' + controller : 'ClientClusteringNodeCtrl' }) - .when('/realms/:realm/applications/:application/clustering/:node', { - templateUrl : resourceUrl + '/partials/application-clustering-node.html', + .when('/realms/:realm/clients/:client/clustering/:node', { + templateUrl : resourceUrl + '/partials/client-clustering-node.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationClusteringNodeCtrl' + controller : 'ClientClusteringNodeCtrl' }) - .when('/realms/:realm/applications/:application/saml/keys', { - templateUrl : resourceUrl + '/partials/application-saml-keys.html', + .when('/realms/:realm/clients/:client/saml/keys', { + templateUrl : resourceUrl + '/partials/client-saml-keys.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationSamlKeyCtrl' + controller : 'ClientSamlKeyCtrl' }) - .when('/realms/:realm/applications/:application/saml/:keyType/import/:attribute', { - templateUrl : resourceUrl + '/partials/application-saml-key-import.html', + .when('/realms/:realm/clients/:client/saml/:keyType/import/:attribute', { + templateUrl : resourceUrl + '/partials/client-saml-key-import.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationCertificateImportCtrl' + controller : 'ClientCertificateImportCtrl' }) - .when('/realms/:realm/applications/:application/saml/:keyType/export/:attribute', { - templateUrl : resourceUrl + '/partials/application-saml-key-export.html', + .when('/realms/:realm/clients/:client/saml/:keyType/export/:attribute', { + templateUrl : resourceUrl + '/partials/client-saml-key-export.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationCertificateExportCtrl' + controller : 'ClientCertificateExportCtrl' }) - .when('/realms/:realm/applications/:application/roles', { - templateUrl : resourceUrl + '/partials/application-role-list.html', + .when('/realms/:realm/clients/:client/roles', { + templateUrl : resourceUrl + '/partials/client-role-list.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); }, - roles : function(ApplicationRoleListLoader) { - return ApplicationRoleListLoader(); + roles : function(ClientRoleListLoader) { + return ClientRoleListLoader(); } }, - controller : 'ApplicationRoleListCtrl' + controller : 'ClientRoleListCtrl' }) - .when('/realms/:realm/applications/:application/revocation', { - templateUrl : resourceUrl + '/partials/application-revocation.html', + .when('/realms/:realm/clients/:client/revocation', { + templateUrl : resourceUrl + '/partials/client-revocation.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationRevocationCtrl' + controller : 'ClientRevocationCtrl' }) - .when('/realms/:realm/applications/:application/scope-mappings', { - templateUrl : resourceUrl + '/partials/application-scope-mappings.html', + .when('/realms/:realm/clients/:client/scope-mappings', { + templateUrl : resourceUrl + '/partials/client-scope-mappings.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); }, - applications : function(ApplicationListLoader) { - return ApplicationListLoader(); + clients : function(ClientListLoader) { + return ClientListLoader(); } }, - controller : 'ApplicationScopeMappingCtrl' + controller : 'ClientScopeMappingCtrl' }) - .when('/realms/:realm/applications/:application/installation', { - templateUrl : resourceUrl + '/partials/application-installation.html', + .when('/realms/:realm/clients/:client/installation', { + templateUrl : resourceUrl + '/partials/client-installation.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); } }, - controller : 'ApplicationInstallationCtrl' + controller : 'ClientInstallationCtrl' }) - .when('/create/application/:realm', { - templateUrl : resourceUrl + '/partials/application-detail.html', + .when('/create/client/:realm', { + templateUrl : resourceUrl + '/partials/client-detail.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - applications : function(ApplicationListLoader) { - return ApplicationListLoader(); + clients : function(ClientListLoader) { + return ClientListLoader(); }, - application : function() { + client : function() { return {}; }, serverInfo : function(ServerInfoLoader) { return ServerInfoLoader(); } }, - controller : 'ApplicationDetailCtrl' + controller : 'ClientDetailCtrl' }) - .when('/realms/:realm/applications/:application', { - templateUrl : resourceUrl + '/partials/application-detail.html', + .when('/realms/:realm/clients/:client', { + templateUrl : resourceUrl + '/partials/client-detail.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - applications : function(ApplicationListLoader) { - return ApplicationListLoader(); + clients : function(ClientListLoader) { + return ClientListLoader(); }, - application : function(ApplicationLoader) { - return ApplicationLoader(); + client : function(ClientLoader) { + return ClientLoader(); }, serverInfo : function(ServerInfoLoader) { return ServerInfoLoader(); } }, - controller : 'ApplicationDetailCtrl' + controller : 'ClientDetailCtrl' }) - .when('/realms/:realm/applications', { - templateUrl : resourceUrl + '/partials/application-list.html', + .when('/realms/:realm/clients', { + templateUrl : resourceUrl + '/partials/client-list.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - applications : function(ApplicationListLoader) { - return ApplicationListLoader(); + clients : function(ClientListLoader) { + return ClientListLoader(); }, serverInfo : function(ServerInfoLoader) { return ServerInfoLoader(); } }, - controller : 'ApplicationListCtrl' + controller : 'ClientListCtrl' }) - .when('/import/application/:realm', { - templateUrl : resourceUrl + '/partials/application-import.html', + .when('/import/client/:realm', { + templateUrl : resourceUrl + '/partials/client-import.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); @@ -739,7 +739,7 @@ module.config([ '$routeProvider', function($routeProvider) { return ServerInfoLoader(); } }, - controller : 'ApplicationImportCtrl' + controller : 'ClientImportCtrl' }) .when('/', { templateUrl : resourceUrl + '/partials/home.html', @@ -772,8 +772,8 @@ module.config([ '$routeProvider', function($routeProvider) { realm : function(RealmLoader) { return RealmLoader(); }, - stats : function(RealmApplicationSessionStatsLoader) { - return RealmApplicationSessionStatsLoader(); + stats : function(RealmClientSessionStatsLoader) { + return RealmClientSessionStatsLoader(); } }, controller : 'RealmSessionStatsCtrl' @@ -1353,12 +1353,12 @@ module.directive('kcNavigation', function ($compile, Notifications) { } }); -module.directive('kcNavigationApplication', function () { +module.directive('kcNavigationClient', function () { return { scope: true, restrict: 'E', replace: true, - templateUrl: resourceUrl + '/templates/kc-navigation-application.html' + templateUrl: resourceUrl + '/templates/kc-navigation-client.html' } }); diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/applications.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js similarity index 51% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/applications.js rename to forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js index 307f805deaf..2324d4876b3 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/applications.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js @@ -4,14 +4,10 @@ Array.prototype.remove = function(from, to) { return this.push.apply(this, rest); }; -module.controller('ApplicationRoleListCtrl', function($scope, $location, realm, application, roles) { +module.controller('ClientRoleListCtrl', function($scope, $location, realm, client, roles) { $scope.realm = realm; $scope.roles = roles; - $scope.application = application; - - for (var i = 0; i < roles.length; i++) { - console.log("role.id: " + roles[i].id + " role.name: " + roles[i].name); - } + $scope.client = client; $scope.$watch(function() { return $location.path(); @@ -20,17 +16,17 @@ module.controller('ApplicationRoleListCtrl', function($scope, $location, realm, }); }); -module.controller('ApplicationCredentialsCtrl', function($scope, $location, realm, application, ApplicationCredentials, Notifications) { +module.controller('ClientCredentialsCtrl', function($scope, $location, realm, client, ClientCredentials, Notifications) { $scope.realm = realm; - $scope.application = application; - var secret = ApplicationCredentials.get({ realm : realm.realm, application : application.id }, + $scope.client = client; + var secret = ClientCredentials.get({ realm : realm.realm, client : client.id }, function() { $scope.secret = secret.value; } ); $scope.changePassword = function() { - var secret = ApplicationCredentials.update({ realm : realm.realm, application : application.id }, + var secret = ClientCredentials.update({ realm : realm.realm, client : client.id }, function() { Notifications.success('The secret has been changed.'); $scope.secret = secret.value; @@ -49,107 +45,107 @@ module.controller('ApplicationCredentialsCtrl', function($scope, $location, real }); }); -module.controller('ApplicationIdentityProviderCtrl', function($scope, $location, $route, realm, application, Application, $location, Notifications) { +module.controller('ClientIdentityProviderCtrl', function($scope, $location, $route, realm, client, Client, $location, Notifications) { $scope.realm = realm; - $scope.application = angular.copy(application); + $scope.client = angular.copy(client); var length = 0; - if ($scope.application.identityProviders) { - length = $scope.application.identityProviders.length; + if ($scope.client.identityProviders) { + length = $scope.client.identityProviders.length; - for (i = 0; i < $scope.application.identityProviders.length; i++) { - var applicationProvider = $scope.application.identityProviders[i]; - if (applicationProvider.retrieveToken) { - applicationProvider.retrieveToken = applicationProvider.retrieveToken.toString(); + for (i = 0; i < $scope.client.identityProviders.length; i++) { + var clientProvider = $scope.client.identityProviders[i]; + if (clientProvider.retrieveToken) { + clientProvider.retrieveToken = clientProvider.retrieveToken.toString(); } } } else { - $scope.application.identityProviders = []; + $scope.client.identityProviders = []; } $scope.identityProviders = []; - var providersMissingInApp = []; + var providersMissingInClient = []; for (j = 0; j < realm.identityProviders.length; j++) { var identityProvider = realm.identityProviders[j]; - var applicationProvider = null; + var clientProvider = null; - for (i = 0; i < $scope.application.identityProviders.length; i++) { - applicationProvider = $scope.application.identityProviders[i]; + for (i = 0; i < $scope.client.identityProviders.length; i++) { + clientProvider = $scope.client.identityProviders[i]; - if (applicationProvider) { + if (clientProvider) { - if (applicationProvider.id == identityProvider.id) { + if (clientProvider.id == identityProvider.id) { $scope.identityProviders[i] = {}; $scope.identityProviders[i].identityProvider = identityProvider; - $scope.identityProviders[i].retrieveToken = applicationProvider.retrieveToken; + $scope.identityProviders[i].retrieveToken = clientProvider.retrieveToken; break; } - applicationProvider = null; + clientProvider = null; } } - if (applicationProvider == null) { - providersMissingInApp.push(identityProvider); + if (clientProvider == null) { + providersMissingInClient.push(identityProvider); } } - for (j = 0; j < providersMissingInApp.length; j++) { - var identityProvider = providersMissingInApp[j]; + for (j = 0; j < providersMissingInClient.length; j++) { + var identityProvider = providersMissingInClient[j]; var currentProvider = {}; currentProvider.identityProvider = identityProvider; currentProvider.retrieveToken = "false"; $scope.identityProviders.push(currentProvider); - var currentAppProvider = {}; - currentAppProvider.id = identityProvider.id; - currentAppProvider.retrieveToken = "false"; - $scope.application.identityProviders.push(currentAppProvider); + var currentClientProvider = {}; + currentClientProvider.id = identityProvider.id; + currentClientProvider.retrieveToken = "false"; + $scope.client.identityProviders.push(currentClientProvider); } - var oldCopy = angular.copy($scope.application); + var oldCopy = angular.copy($scope.client); $scope.save = function() { - Application.update({ + Client.update({ realm : realm.realm, - application : application.id - }, $scope.application, function() { + client : client.id + }, $scope.client, function() { $scope.changed = false; $route.reload(); - Notifications.success("Your changes have been saved to the application."); + Notifications.success("Your changes have been saved to the client."); }); }; $scope.reset = function() { - $scope.application = angular.copy(oldCopy); + $scope.client = angular.copy(oldCopy); $scope.changed = false; }; - $scope.$watch('application', function() { - if (!angular.equals($scope.application, oldCopy)) { + $scope.$watch('client', function() { + if (!angular.equals($scope.client, oldCopy)) { $scope.changed = true; } }, true); }); -module.controller('ApplicationSamlKeyCtrl', function($scope, $location, $http, $upload, realm, application, - ApplicationCertificate, ApplicationCertificateGenerate, - ApplicationCertificateDownload, Notifications) { +module.controller('ClientSamlKeyCtrl', function($scope, $location, $http, $upload, realm, client, + ClientCertificate, ClientCertificateGenerate, + ClientCertificateDownload, Notifications) { $scope.realm = realm; - $scope.application = application; + $scope.client = client; - var signingKeyInfo = ApplicationCertificate.get({ realm : realm.realm, application : application.id, attribute: 'saml.signing' }, + var signingKeyInfo = ClientCertificate.get({ realm : realm.realm, client : client.id, attribute: 'saml.signing' }, function() { $scope.signingKeyInfo = signingKeyInfo; } ); $scope.generateSigningKey = function() { - var keyInfo = ApplicationCertificateGenerate.generate({ realm : realm.realm, application : application.id, attribute: 'saml.signing' }, + var keyInfo = ClientCertificateGenerate.generate({ realm : realm.realm, client : client.id, attribute: 'saml.signing' }, function() { Notifications.success('Signing key has been regenerated.'); $scope.signingKeyInfo = keyInfo; @@ -161,21 +157,21 @@ module.controller('ApplicationSamlKeyCtrl', function($scope, $location, $http, $ }; $scope.importSigningKey = function() { - $location.url("/realms/" + realm.realm + "/applications/" + application.id + "/saml/Signing/import/saml.signing"); + $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/saml/Signing/import/saml.signing"); }; $scope.exportSigningKey = function() { - $location.url("/realms/" + realm.realm + "/applications/" + application.id + "/saml/Signing/export/saml.signing"); + $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/saml/Signing/export/saml.signing"); }; - var encryptionKeyInfo = ApplicationCertificate.get({ realm : realm.realm, application : application.id, attribute: 'saml.encryption' }, + var encryptionKeyInfo = ClientCertificate.get({ realm : realm.realm, client : client.id, attribute: 'saml.encryption' }, function() { $scope.encryptionKeyInfo = encryptionKeyInfo; } ); $scope.generateEncryptionKey = function() { - var keyInfo = ApplicationCertificateGenerate.generate({ realm : realm.realm, application : application.id, attribute: 'saml.encryption' }, + var keyInfo = ClientCertificateGenerate.generate({ realm : realm.realm, client : client.id, attribute: 'saml.encryption' }, function() { Notifications.success('Encryption key has been regenerated.'); $scope.encryptionKeyInfo = keyInfo; @@ -187,11 +183,11 @@ module.controller('ApplicationSamlKeyCtrl', function($scope, $location, $http, $ }; $scope.importEncryptionKey = function() { - $location.url("/realms/" + realm.realm + "/applications/" + application.id + "/saml/Encryption/import/saml.encryption"); + $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/saml/Encryption/import/saml.encryption"); }; $scope.exportEncryptionKey = function() { - $location.url("/realms/" + realm.realm + "/applications/" + application.id + "/saml/Encryption/export/saml.encryption"); + $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/saml/Encryption/export/saml.encryption"); }; @@ -202,14 +198,14 @@ module.controller('ApplicationSamlKeyCtrl', function($scope, $location, $http, $ }); }); -module.controller('ApplicationCertificateImportCtrl', function($scope, $location, $http, $upload, realm, application, $routeParams, - ApplicationCertificate, ApplicationCertificateGenerate, - ApplicationCertificateDownload, Notifications) { +module.controller('ClientCertificateImportCtrl', function($scope, $location, $http, $upload, realm, client, $routeParams, + ClientCertificate, ClientCertificateGenerate, + ClientCertificateDownload, Notifications) { var keyType = $routeParams.keyType; var attribute = $routeParams.attribute; $scope.realm = realm; - $scope.application = application; + $scope.client = client; $scope.keyType = keyType; $scope.files = []; @@ -234,7 +230,7 @@ module.controller('ApplicationCertificateImportCtrl', function($scope, $location for (var i = 0; i < $scope.files.length; i++) { var $file = $scope.files[i]; $scope.upload = $upload.upload({ - url: authUrl + '/admin/realms/' + realm.realm + '/applications-by-id/' + application.id + '/certificates/' + attribute + '/upload', + url: authUrl + '/admin/realms/' + realm.realm + '/clients-by-id/' + client.id + '/certificates/' + attribute + '/upload', // method: POST or PUT, // headers: {'headerKey': 'headerValue'}, withCredential: true, data: {keystoreFormat: $scope.uploadKeyFormat, @@ -247,11 +243,9 @@ module.controller('ApplicationCertificateImportCtrl', function($scope, $location //fileFormDataName: myFile, /* customize how data is added to formData. See #40#issuecomment-28612000 for example */ //formDataAppender: function(formData, key, val){} - }).progress(function(evt) { - console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total)); }).success(function(data, status, headers) { Notifications.success("Keystore uploaded successfully."); - $location.url("/realms/" + realm.realm + "/applications/" + application.id + "/saml/keys"); + $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/saml/keys"); }) .error(function() { Notifications.error("The key store can not be uploaded. Please verify the file."); @@ -268,16 +262,16 @@ module.controller('ApplicationCertificateImportCtrl', function($scope, $location }); }); -module.controller('ApplicationCertificateExportCtrl', function($scope, $location, $http, $upload, realm, application, $routeParams, - ApplicationCertificate, ApplicationCertificateGenerate, - ApplicationCertificateDownload, Notifications) { +module.controller('ClientCertificateExportCtrl', function($scope, $location, $http, $upload, realm, client, $routeParams, + ClientCertificate, ClientCertificateGenerate, + ClientCertificateDownload, Notifications) { var keyType = $routeParams.keyType; var attribute = $routeParams.attribute; $scope.realm = realm; - $scope.application = application; + $scope.client = client; $scope.keyType = keyType; var jks = { - keyAlias: application.name, + keyAlias: client.clientId, realmAlias: realm.realm }; @@ -286,7 +280,7 @@ module.controller('ApplicationCertificateExportCtrl', function($scope, $location "PKCS12" ]; - var keyInfo = ApplicationCertificate.get({ realm : realm.realm, application : application.id, attribute: attribute }, + var keyInfo = ClientCertificate.get({ realm : realm.realm, client : client.id, attribute: attribute }, function() { $scope.keyInfo = keyInfo; } @@ -296,17 +290,17 @@ module.controller('ApplicationCertificateExportCtrl', function($scope, $location $scope.download = function() { $http({ - url: authUrl + '/admin/realms/' + realm.realm + '/applications-by-id/' + application.id + '/certificates/' + attribute + '/download', + url: authUrl + '/admin/realms/' + realm.realm + '/clients-by-id/' + client.id + '/certificates/' + attribute + '/download', method: 'POST', responseType: 'arraybuffer', data: $scope.jks, headers: { 'Content-Type': 'application/json', - 'Accept': 'application/octet-stream' + 'Accept': 'client/octet-stream' } }).success(function(data){ var blob = new Blob([data], { - type: 'application/octet-stream' + type: 'client/octet-stream' }); var ext = ".jks"; if ($scope.jks.format == 'PKCS12') ext = ".p12"; @@ -323,18 +317,18 @@ module.controller('ApplicationCertificateExportCtrl', function($scope, $location }); }); -module.controller('ApplicationSessionsCtrl', function($scope, realm, sessionCount, application, - ApplicationUserSessions) { +module.controller('ClientSessionsCtrl', function($scope, realm, sessionCount, client, + ClientUserSessions) { $scope.realm = realm; $scope.count = sessionCount.count; $scope.sessions = []; - $scope.application = application; + $scope.client = client; $scope.page = 0; $scope.query = { realm : realm.realm, - application: $scope.application.id, + client: $scope.client.id, max : 5, first : 0 } @@ -365,17 +359,17 @@ module.controller('ApplicationSessionsCtrl', function($scope, realm, sessionCoun }; $scope.loadUsers = function() { - ApplicationUserSessions.query($scope.query, function(updated) { + ClientUserSessions.query($scope.query, function(updated) { $scope.sessions = updated; }) }; }); -module.controller('ApplicationRoleDetailCtrl', function($scope, realm, application, role, roles, applications, - Role, ApplicationRole, RoleById, RoleRealmComposites, RoleApplicationComposites, +module.controller('ClientRoleDetailCtrl', function($scope, realm, client, role, roles, clients, + Role, ClientRole, RoleById, RoleRealmComposites, RoleClientComposites, $http, $location, Dialog, Notifications) { $scope.realm = realm; - $scope.application = application; + $scope.client = client; $scope.role = angular.copy(role); $scope.create = !role.name; @@ -383,16 +377,16 @@ module.controller('ApplicationRoleDetailCtrl', function($scope, realm, applicati $scope.save = function() { if ($scope.create) { - ApplicationRole.save({ + ClientRole.save({ realm: realm.realm, - application : application.id + client : client.id }, $scope.role, function (data, headers) { $scope.changed = false; role = angular.copy($scope.role); - ApplicationRole.get({ realm: realm.realm, application : application.id, role: role.name }, function(role) { + ClientRole.get({ realm: realm.realm, client : client.id, role: role.name }, function(role) { var id = role.id; - $location.url("/realms/" + realm.realm + "/applications/" + application.id + "/roles/" + id); + $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/roles/" + id); Notifications.success("The role has been created."); }); }); @@ -405,30 +399,30 @@ module.controller('ApplicationRoleDetailCtrl', function($scope, realm, applicati Dialog.confirmDelete($scope.role.name, 'role', function() { $scope.role.$remove({ realm : realm.realm, - application : application.id, + client : client.id, role : $scope.role.id }, function() { - $location.url("/realms/" + realm.realm + "/applications/" + application.id + "/roles"); + $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/roles"); Notifications.success("The role has been deleted."); }); }); }; $scope.cancel = function () { - $location.url("/realms/" + realm.realm + "/applications/" + application.id + "/roles"); + $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/roles"); }; - roleControl($scope, realm, role, roles, applications, - ApplicationRole, RoleById, RoleRealmComposites, RoleApplicationComposites, + roleControl($scope, realm, role, roles, clients, + ClientRole, RoleById, RoleRealmComposites, RoleClientComposites, $http, $location, Notifications, Dialog); }); -module.controller('ApplicationImportCtrl', function($scope, $location, $upload, realm, serverInfo, Notifications) { +module.controller('ClientImportCtrl', function($scope, $location, $upload, realm, serverInfo, Notifications) { $scope.realm = realm; - $scope.configFormats = serverInfo.applicationImporters; + $scope.configFormats = serverInfo.clientImporters; $scope.configFormat = null; $scope.files = []; @@ -446,7 +440,7 @@ module.controller('ApplicationImportCtrl', function($scope, $location, $upload, for (var i = 0; i < $scope.files.length; i++) { var $file = $scope.files[i]; $scope.upload = $upload.upload({ - url: authUrl + '/admin/realms/' + realm.realm + '/application-importers/' + $scope.configFormat.id + '/upload', + url: authUrl + '/admin/realms/' + realm.realm + '/client-importers/' + $scope.configFormat.id + '/upload', // method: POST or PUT, // headers: {'headerKey': 'headerValue'}, withCredential: true, data: {myObj: ""}, @@ -455,11 +449,9 @@ module.controller('ApplicationImportCtrl', function($scope, $location, $upload, //fileFormDataName: myFile, /* customize how data is added to formData. See #40#issuecomment-28612000 for example */ //formDataAppender: function(formData, key, val){} - }).progress(function(evt) { - console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total)); }).success(function(data, status, headers) { Notifications.success("Uploaded successfully."); - $location.url("/realms/" + realm.realm + "/applications"); + $location.url("/realms/" + realm.realm + "/clients"); }) .error(function() { Notifications.error("The file can not be uploaded. Please verify the file."); @@ -477,10 +469,10 @@ module.controller('ApplicationImportCtrl', function($scope, $location, $upload, }); -module.controller('ApplicationListCtrl', function($scope, realm, applications, Application, serverInfo, $location) { +module.controller('ClientListCtrl', function($scope, realm, clients, Client, serverInfo, $location) { $scope.realm = realm; - $scope.applications = applications; - $scope.importButton = serverInfo.applicationImporters.length > 0; + $scope.clients = clients; + $scope.importButton = serverInfo.clientImporters.length > 0; $scope.$watch(function() { return $location.path(); }, function() { @@ -488,10 +480,9 @@ module.controller('ApplicationListCtrl', function($scope, realm, applications, A }); }); -module.controller('ApplicationInstallationCtrl', function($scope, realm, application, ApplicationInstallation,ApplicationInstallationJBoss, $http, $routeParams) { - console.log('ApplicationInstallationCtrl'); +module.controller('ClientInstallationCtrl', function($scope, realm, client, ClientInstallation,ClientInstallationJBoss, $http, $routeParams) { $scope.realm = realm; - $scope.application = application; + $scope.client = client; $scope.installation = null; $scope.download = null; $scope.configFormat = null; @@ -503,14 +494,14 @@ module.controller('ApplicationInstallationCtrl', function($scope, realm, applica $scope.changeFormat = function() { if ($scope.configFormat == "keycloak.json") { - var url = ApplicationInstallation.url({ realm: $routeParams.realm, application: $routeParams.application }); + var url = ClientInstallation.url({ realm: $routeParams.realm, client: $routeParams.client }); $http.get(url).success(function(data) { var tmp = angular.fromJson(data); $scope.installation = angular.toJson(tmp, true); $scope.type = 'application/json'; }) } else if ($scope.configFormat == "Wildfly/JBoss Subsystem XML") { - var url = ApplicationInstallationJBoss.url({ realm: $routeParams.realm, application: $routeParams.application }); + var url = ClientInstallationJBoss.url({ realm: $routeParams.realm, client: $routeParams.client }); $http.get(url).success(function(data) { $scope.installation = data; $scope.type = 'text/xml'; @@ -523,9 +514,7 @@ module.controller('ApplicationInstallationCtrl', function($scope, realm, applica } }); -module.controller('ApplicationDetailCtrl', function($scope, realm, application, serverInfo, Application, $location, Dialog, Notifications) { - console.log('ApplicationDetailCtrl'); - +module.controller('ClientDetailCtrl', function($scope, realm, client, serverInfo, Client, $location, Dialog, Notifications) { $scope.accessTypes = [ "confidential", "public", @@ -548,7 +537,7 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application, ]; $scope.realm = realm; - $scope.create = !application.name; + $scope.create = !client.clientId; $scope.samlAuthnStatement = false; $scope.samlMultiValuedRoles = false; $scope.samlServerSignature = false; @@ -558,43 +547,43 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application, $scope.samlForcePostBinding = false; $scope.samlForceNameIdFormat = false; if (!$scope.create) { - if (!application.attributes) { - application.attributes = {}; + if (!client.attributes) { + client.attributes = {}; } - $scope.application= angular.copy(application); + $scope.client= angular.copy(client); $scope.accessType = $scope.accessTypes[0]; - if (application.bearerOnly) { + if (client.bearerOnly) { $scope.accessType = $scope.accessTypes[2]; - } else if (application.publicClient) { + } else if (client.publicClient) { $scope.accessType = $scope.accessTypes[1]; } - if (application.protocol) { - $scope.protocol = $scope.protocols[$scope.protocols.indexOf(application.protocol)]; + if (client.protocol) { + $scope.protocol = $scope.protocols[$scope.protocols.indexOf(client.protocol)]; } else { $scope.protocol = $scope.protocols[0]; } - if (application.attributes['saml.signature.algorithm'] == 'RSA_SHA1') { + if (client.attributes['saml.signature.algorithm'] == 'RSA_SHA1') { $scope.signatureAlgorithm = $scope.signatureAlgorithms[0]; - } else if (application.attributes['saml.signature.algorithm'] == 'RSA_SHA256') { + } else if (client.attributes['saml.signature.algorithm'] == 'RSA_SHA256') { $scope.signatureAlgorithm = $scope.signatureAlgorithms[1]; - } else if (application.attributes['saml.signature.algorithm'] == 'RSA_SHA512') { + } else if (client.attributes['saml.signature.algorithm'] == 'RSA_SHA512') { $scope.signatureAlgorithm = $scope.signatureAlgorithms[2]; - } else if (application.attributes['saml.signature.algorithm'] == 'DSA_SHA1') { + } else if (client.attributes['saml.signature.algorithm'] == 'DSA_SHA1') { $scope.signatureAlgorithm = $scope.signatureAlgorithms[3]; } - if (application.attributes['saml_name_id_format'] == 'unspecified') { + if (client.attributes['saml_name_id_format'] == 'unspecified') { $scope.nameIdFormat = $scope.nameIdFormats[0]; - } else if (application.attributes['saml_name_id_format'] == 'email') { + } else if (client.attributes['saml_name_id_format'] == 'email') { $scope.nameIdFormat = $scope.nameIdFormats[1]; - } else if (application.attributes['saml_name_id_format'] == 'transient') { + } else if (client.attributes['saml_name_id_format'] == 'transient') { $scope.nameIdFormat = $scope.nameIdFormats[2]; - } else if (application.attributes['saml_name_id_format'] == 'persistent') { + } else if (client.attributes['saml_name_id_format'] == 'persistent') { $scope.nameIdFormat = $scope.nameIdFormats[3]; } } else { - $scope.application = { enabled: true, attributes: {}}; - $scope.application.redirectUris = []; + $scope.client = { enabled: true, attributes: {}}; + $scope.client.redirectUris = []; $scope.accessType = $scope.accessTypes[0]; $scope.protocol = $scope.protocols[0]; $scope.signatureAlgorithm = $scope.signatureAlgorithms[1]; @@ -603,58 +592,58 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application, $scope.samlForceNameIdFormat = false; } - if ($scope.application.attributes["saml.server.signature"]) { - if ($scope.application.attributes["saml.server.signature"] == "true") { + if ($scope.client.attributes["saml.server.signature"]) { + if ($scope.client.attributes["saml.server.signature"] == "true") { $scope.samlServerSignature = true; } else { $scope.samlServerSignature = false; } } - if ($scope.application.attributes["saml.assertion.signature"]) { - if ($scope.application.attributes["saml.assertion.signature"] == "true") { + if ($scope.client.attributes["saml.assertion.signature"]) { + if ($scope.client.attributes["saml.assertion.signature"] == "true") { $scope.samlAssertionSignature = true; } else { $scope.samlAssertionSignature = false; } } - if ($scope.application.attributes["saml.client.signature"]) { - if ($scope.application.attributes["saml.client.signature"] == "true") { + if ($scope.client.attributes["saml.client.signature"]) { + if ($scope.client.attributes["saml.client.signature"] == "true") { $scope.samlClientSignature = true; } else { $scope.samlClientSignature = false; } } - if ($scope.application.attributes["saml.encrypt"]) { - if ($scope.application.attributes["saml.encrypt"] == "true") { + if ($scope.client.attributes["saml.encrypt"]) { + if ($scope.client.attributes["saml.encrypt"] == "true") { $scope.samlEncrypt = true; } else { $scope.samlEncrypt = false; } } - if ($scope.application.attributes["saml.authnstatement"]) { - if ($scope.application.attributes["saml.authnstatement"] == "true") { + if ($scope.client.attributes["saml.authnstatement"]) { + if ($scope.client.attributes["saml.authnstatement"] == "true") { $scope.samlAuthnStatement = true; } else { $scope.samlAuthnStatement = false; } } - if ($scope.application.attributes["saml_force_name_id_format"]) { - if ($scope.application.attributes["saml_force_name_id_format"] == "true") { + if ($scope.client.attributes["saml_force_name_id_format"]) { + if ($scope.client.attributes["saml_force_name_id_format"] == "true") { $scope.samlForceNameIdFormat = true; } else { $scope.samlForceNameIdFormat = false; } } - if ($scope.application.attributes["saml.multivalued.roles"]) { - if ($scope.application.attributes["saml.multivalued.roles"] == "true") { + if ($scope.client.attributes["saml.multivalued.roles"]) { + if ($scope.client.attributes["saml.multivalued.roles"] == "true") { $scope.samlMultiValuedRoles = true; } else { $scope.samlMultiValuedRoles = false; } } - if ($scope.application.attributes["saml.force.post.binding"]) { - if ($scope.application.attributes["saml.force.post.binding"] == "true") { + if ($scope.client.attributes["saml.force.post.binding"]) { + if ($scope.client.attributes["saml.force.post.binding"] == "true") { $scope.samlForcePostBinding = true; } else { $scope.samlForcePostBinding = false; @@ -667,31 +656,31 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application, $scope.changeAccessType = function() { if ($scope.accessType == "confidential") { - $scope.application.bearerOnly = false; - $scope.application.publicClient = false; + $scope.client.bearerOnly = false; + $scope.client.publicClient = false; } else if ($scope.accessType == "public") { - $scope.application.bearerOnly = false; - $scope.application.publicClient = true; + $scope.client.bearerOnly = false; + $scope.client.publicClient = true; } else if ($scope.accessType == "bearer-only") { - $scope.application.bearerOnly = true; - $scope.application.publicClient = false; + $scope.client.bearerOnly = true; + $scope.client.publicClient = false; } }; $scope.changeProtocol = function() { if ($scope.protocol == "openid-connect") { - $scope.application.protocol = "openid-connect"; + $scope.client.protocol = "openid-connect"; } else if ($scope.accessType == "saml") { - $scope.application.protocol = "saml"; + $scope.client.protocol = "saml"; } }; $scope.changeAlgorithm = function() { - $scope.application.attributes['saml.signature.algorithm'] = $scope.signatureAlgorithm; + $scope.client.attributes['saml.signature.algorithm'] = $scope.signatureAlgorithm; }; $scope.changeNameIdFormat = function() { - $scope.application.attributes['saml_name_id_format'] = $scope.nameIdFormat; + $scope.client.attributes['saml_name_id_format'] = $scope.nameIdFormat; }; $scope.$watch(function() { @@ -700,125 +689,125 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application, $scope.path = $location.path().substring(1).split("/"); }); - $scope.$watch('application', function() { - if (!angular.equals($scope.application, application)) { + $scope.$watch('client', function() { + if (!angular.equals($scope.client, client)) { $scope.changed = true; } }, true); $scope.deleteWebOrigin = function(index) { - $scope.application.webOrigins.splice(index, 1); + $scope.client.webOrigins.splice(index, 1); } $scope.addWebOrigin = function() { - $scope.application.webOrigins.push($scope.newWebOrigin); + $scope.client.webOrigins.push($scope.newWebOrigin); $scope.newWebOrigin = ""; } $scope.deleteRedirectUri = function(index) { - $scope.application.redirectUris.splice(index, 1); + $scope.client.redirectUris.splice(index, 1); } $scope.addRedirectUri = function() { - $scope.application.redirectUris.push($scope.newRedirectUri); + $scope.client.redirectUris.push($scope.newRedirectUri); $scope.newRedirectUri = ""; } $scope.save = function() { if ($scope.samlServerSignature == true) { - $scope.application.attributes["saml.server.signature"] = "true"; + $scope.client.attributes["saml.server.signature"] = "true"; } else { - $scope.application.attributes["saml.server.signature"] = "false"; + $scope.client.attributes["saml.server.signature"] = "false"; } if ($scope.samlAssertionSignature == true) { - $scope.application.attributes["saml.assertion.signature"] = "true"; + $scope.client.attributes["saml.assertion.signature"] = "true"; } else { - $scope.application.attributes["saml.assertion.signature"] = "false"; + $scope.client.attributes["saml.assertion.signature"] = "false"; } if ($scope.samlClientSignature == true) { - $scope.application.attributes["saml.client.signature"] = "true"; + $scope.client.attributes["saml.client.signature"] = "true"; } else { - $scope.application.attributes["saml.client.signature"] = "false"; + $scope.client.attributes["saml.client.signature"] = "false"; } if ($scope.samlEncrypt == true) { - $scope.application.attributes["saml.encrypt"] = "true"; + $scope.client.attributes["saml.encrypt"] = "true"; } else { - $scope.application.attributes["saml.encrypt"] = "false"; + $scope.client.attributes["saml.encrypt"] = "false"; } if ($scope.samlAuthnStatement == true) { - $scope.application.attributes["saml.authnstatement"] = "true"; + $scope.client.attributes["saml.authnstatement"] = "true"; } else { - $scope.application.attributes["saml.authnstatement"] = "false"; + $scope.client.attributes["saml.authnstatement"] = "false"; } if ($scope.samlForceNameIdFormat == true) { - $scope.application.attributes["saml_force_name_id_format"] = "true"; + $scope.client.attributes["saml_force_name_id_format"] = "true"; } else { - $scope.application.attributes["saml_force_name_id_format"] = "false"; + $scope.client.attributes["saml_force_name_id_format"] = "false"; } if ($scope.samlMultiValuedRoles == true) { - $scope.application.attributes["saml.multivalued.roles"] = "true"; + $scope.client.attributes["saml.multivalued.roles"] = "true"; } else { - $scope.application.attributes["saml.multivalued.roles"] = "false"; + $scope.client.attributes["saml.multivalued.roles"] = "false"; } if ($scope.samlForcePostBinding == true) { - $scope.application.attributes["saml.force.post.binding"] = "true"; + $scope.client.attributes["saml.force.post.binding"] = "true"; } else { - $scope.application.attributes["saml.force.post.binding"] = "false"; + $scope.client.attributes["saml.force.post.binding"] = "false"; } - $scope.application.protocol = $scope.protocol; - $scope.application.attributes['saml.signature.algorithm'] = $scope.signatureAlgorithm; - $scope.application.attributes['saml_name_id_format'] = $scope.nameIdFormat; + $scope.client.protocol = $scope.protocol; + $scope.client.attributes['saml.signature.algorithm'] = $scope.signatureAlgorithm; + $scope.client.attributes['saml_name_id_format'] = $scope.nameIdFormat; - if ($scope.application.protocol != 'saml' && !$scope.application.bearerOnly && (!$scope.application.redirectUris || $scope.application.redirectUris.length == 0)) { + if ($scope.client.protocol != 'saml' && !$scope.client.bearerOnly && (!$scope.client.redirectUris || $scope.client.redirectUris.length == 0)) { Notifications.error("You must specify at least one redirect uri"); } else { if ($scope.create) { - Application.save({ + Client.save({ realm: realm.realm, - application: '' - }, $scope.application, function (data, headers) { + client: '' + }, $scope.client, function (data, headers) { $scope.changed = false; var l = headers().location; var id = l.substring(l.lastIndexOf("/") + 1); - $location.url("/realms/" + realm.realm + "/applications/" + id); - Notifications.success("The application has been created."); + $location.url("/realms/" + realm.realm + "/clients/" + id); + Notifications.success("The client has been created."); }); } else { - Application.update({ + Client.update({ realm : realm.realm, - application : application.id - }, $scope.application, function() { + client : client.id + }, $scope.client, function() { $scope.changed = false; - application = angular.copy($scope.application); - $location.url("/realms/" + realm.realm + "/applications/" + application.id); - Notifications.success("Your changes have been saved to the application."); + client = angular.copy($scope.client); + $location.url("/realms/" + realm.realm + "/clients/" + client.id); + Notifications.success("Your changes have been saved to the client."); }); } } }; $scope.reset = function() { - $scope.application = angular.copy(application); + $scope.client = angular.copy(client); $scope.changed = false; }; $scope.cancel = function() { - $location.url("/realms/" + realm.realm + "/applications"); + $location.url("/realms/" + realm.realm + "/clients"); }; $scope.remove = function() { - Dialog.confirmDelete($scope.application.name, 'application', function() { - $scope.application.$remove({ + Dialog.confirmDelete($scope.client.clientId, 'client', function() { + $scope.client.$remove({ realm : realm.realm, - application : $scope.application.id + client : $scope.client.id }, function() { - $location.url("/realms/" + realm.realm + "/applications"); - Notifications.success("The application has been deleted."); + $location.url("/realms/" + realm.realm + "/clients"); + Notifications.success("The client has been deleted."); }); }); }; @@ -826,33 +815,32 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application, }); -module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm, application, applications, Notifications, - Application, - ApplicationRealmScopeMapping, ApplicationApplicationScopeMapping, ApplicationRole, - ApplicationAvailableRealmScopeMapping, ApplicationAvailableApplicationScopeMapping, - ApplicationCompositeRealmScopeMapping, ApplicationCompositeApplicationScopeMapping) { +module.controller('ClientScopeMappingCtrl', function($scope, $http, realm, client, clients, Notifications, + Client, + ClientRealmScopeMapping, ClientClientScopeMapping, ClientRole, + ClientAvailableRealmScopeMapping, ClientAvailableClientScopeMapping, + ClientCompositeRealmScopeMapping, ClientCompositeClientScopeMapping) { $scope.realm = realm; - $scope.application = angular.copy(application); + $scope.client = angular.copy(client); $scope.selectedRealmRoles = []; $scope.selectedRealmMappings = []; $scope.realmMappings = []; - $scope.applications = applications; - $scope.applicationRoles = []; - $scope.applicationComposite = []; - $scope.selectedApplicationRoles = []; - $scope.selectedApplicationMappings = []; - $scope.applicationMappings = []; + $scope.clients = clients; + $scope.clientRoles = []; + $scope.clientComposite = []; + $scope.selectedClientRoles = []; + $scope.selectedClientMappings = []; + $scope.clientMappings = []; $scope.dummymodel = []; $scope.changeFullScopeAllowed = function() { - console.log('change full scope'); - Application.update({ + Client.update({ realm : realm.realm, - application : application.id - }, $scope.application, function() { + client : client.id + }, $scope.client, function() { $scope.changed = false; - application = angular.copy($scope.application); + client = angular.copy($scope.client); updateRealmRoles(); Notifications.success("Scope mappings updated."); }); @@ -861,30 +849,29 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm, function updateRealmRoles() { - $scope.realmRoles = ApplicationAvailableRealmScopeMapping.query({realm : realm.realm, application : application.id}); - $scope.realmMappings = ApplicationRealmScopeMapping.query({realm : realm.realm, application : application.id}); - $scope.realmComposite = ApplicationCompositeRealmScopeMapping.query({realm : realm.realm, application : application.id}); + $scope.realmRoles = ClientAvailableRealmScopeMapping.query({realm : realm.realm, client : client.id}); + $scope.realmMappings = ClientRealmScopeMapping.query({realm : realm.realm, client : client.id}); + $scope.realmComposite = ClientCompositeRealmScopeMapping.query({realm : realm.realm, client : client.id}); } - function updateAppRoles() { - if ($scope.targetApp) { - console.debug($scope.targetApp.name); - $scope.applicationRoles = ApplicationAvailableApplicationScopeMapping.query({realm : realm.realm, application : application.id, targetApp : $scope.targetApp.id}); - $scope.applicationMappings = ApplicationApplicationScopeMapping.query({realm : realm.realm, application : application.id, targetApp : $scope.targetApp.id}); - $scope.applicationComposite = ApplicationCompositeApplicationScopeMapping.query({realm : realm.realm, application : application.id, targetApp : $scope.targetApp.id}); + function updateClientRoles() { + if ($scope.targetClient) { + $scope.clientRoles = ClientAvailableClientScopeMapping.query({realm : realm.realm, client : client.id, targetClient : $scope.targetClient.id}); + $scope.clientMappings = ClientClientScopeMapping.query({realm : realm.realm, client : client.id, targetClient : $scope.targetClient.id}); + $scope.clientComposite = ClientCompositeClientScopeMapping.query({realm : realm.realm, client : client.id, targetClient : $scope.targetClient.id}); } else { - $scope.applicationRoles = null; - $scope.applicationMappings = null; - $scope.applicationComposite = null; + $scope.clientRoles = null; + $scope.clientMappings = null; + $scope.clientComposite = null; } } - $scope.changeApplication = function() { - updateAppRoles(); + $scope.changeClient = function() { + updateClientRoles(); }; $scope.addRealmRole = function() { - $http.post(authUrl + '/admin/realms/' + realm.realm + '/applications-by-id/' + application.id + '/scope-mappings/realm', + $http.post(authUrl + '/admin/realms/' + realm.realm + '/clients-by-id/' + client.id + '/scope-mappings/realm', $scope.selectedRealmRoles).success(function() { updateRealmRoles(); Notifications.success("Scope mappings updated."); @@ -892,25 +879,25 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm, }; $scope.deleteRealmRole = function() { - $http.delete(authUrl + '/admin/realms/' + realm.realm + '/applications-by-id/' + application.id + '/scope-mappings/realm', + $http.delete(authUrl + '/admin/realms/' + realm.realm + '/clients-by-id/' + client.id + '/scope-mappings/realm', {data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function () { updateRealmRoles(); Notifications.success("Scope mappings updated."); }); }; - $scope.addApplicationRole = function() { - $http.post(authUrl + '/admin/realms/' + realm.realm + '/applications-by-id/' + application.id + '/scope-mappings/applications-by-id/' + $scope.targetApp.id, - $scope.selectedApplicationRoles).success(function () { - updateAppRoles(); + $scope.addClientRole = function() { + $http.post(authUrl + '/admin/realms/' + realm.realm + '/clients-by-id/' + client.id + '/scope-mappings/clients-by-id/' + $scope.targetClient.id, + $scope.selectedClientRoles).success(function () { + updateClientRoles(); Notifications.success("Scope mappings updated."); }); }; - $scope.deleteApplicationRole = function() { - $http.delete(authUrl + '/admin/realms/' + realm.realm + '/applications-by-id/' + application.id + '/scope-mappings/applications-by-id/' + $scope.targetApp.id, - {data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(function () { - updateAppRoles(); + $scope.deleteClientRole = function() { + $http.delete(authUrl + '/admin/realms/' + realm.realm + '/clients-by-id/' + client.id + '/scope-mappings/clients-by-id/' + $scope.targetClient.id, + {data : $scope.selectedClientMappings, headers : {"content-type" : "application/json"}}).success(function () { + updateClientRoles(); Notifications.success("Scope mappings updated."); }); }; @@ -918,45 +905,45 @@ module.controller('ApplicationScopeMappingCtrl', function($scope, $http, realm, updateRealmRoles(); }); -module.controller('ApplicationRevocationCtrl', function($scope, realm, application, Application, ApplicationPushRevocation, $location, Dialog, Notifications) { +module.controller('ClientRevocationCtrl', function($scope, realm, client, Client, ClientPushRevocation, $location, Dialog, Notifications) { $scope.realm = realm; - $scope.application = application; + $scope.client = client; var setNotBefore = function() { - if ($scope.application.notBefore == 0) { + if ($scope.client.notBefore == 0) { $scope.notBefore = "None"; } else { - $scope.notBefore = new Date($scope.application.notBefore * 1000); + $scope.notBefore = new Date($scope.client.notBefore * 1000); } }; setNotBefore(); var refresh = function() { - Application.get({ realm : realm.realm, application: $scope.application.id }, function(updated) { - $scope.application = updated; + Client.get({ realm : realm.realm, client: $scope.client.id }, function(updated) { + $scope.client = updated; setNotBefore(); }) }; $scope.clear = function() { - $scope.application.notBefore = 0; - Application.update({ realm : realm.realm, application: application.id}, $scope.application, function () { + $scope.client.notBefore = 0; + Client.update({ realm : realm.realm, client: client.id}, $scope.client, function () { $scope.notBefore = "None"; - Notifications.success('Not Before cleared for application.'); + Notifications.success('Not Before cleared for client.'); refresh(); }); } $scope.setNotBeforeNow = function() { - $scope.application.notBefore = new Date().getTime()/1000; - Application.update({ realm : realm.realm, application: $scope.application.id}, $scope.application, function () { - Notifications.success('Not Before set for application.'); + $scope.client.notBefore = new Date().getTime()/1000; + Client.update({ realm : realm.realm, client: $scope.client.id}, $scope.client, function () { + Notifications.success('Not Before set for client.'); refresh(); }); } $scope.pushRevocation = function() { - ApplicationPushRevocation.save({realm : realm.realm, application: $scope.application.id}, function (globalReqResult) { + ClientPushRevocation.save({realm : realm.realm, client: $scope.client.id}, function (globalReqResult) { var successCount = globalReqResult.successRequests ? globalReqResult.successRequests.length : 0; var failedCount = globalReqResult.failedRequests ? globalReqResult.failedRequests.length : 0; @@ -973,32 +960,32 @@ module.controller('ApplicationRevocationCtrl', function($scope, realm, applicati }); -module.controller('ApplicationClusteringCtrl', function($scope, application, Application, ApplicationTestNodesAvailable, realm, $location, $route, Notifications, TimeUnit) { - $scope.application = application; +module.controller('ClientClusteringCtrl', function($scope, client, Client, ClientTestNodesAvailable, realm, $location, $route, Notifications, TimeUnit) { + $scope.client = client; $scope.realm = realm; - var oldCopy = angular.copy($scope.application); + var oldCopy = angular.copy($scope.client); $scope.changed = false; - $scope.$watch('application', function() { - if (!angular.equals($scope.application, oldCopy)) { + $scope.$watch('client', function() { + if (!angular.equals($scope.client, oldCopy)) { $scope.changed = true; } }, true); - $scope.application.nodeReRegistrationTimeoutUnit = TimeUnit.autoUnit(application.nodeReRegistrationTimeout); - $scope.application.nodeReRegistrationTimeout = TimeUnit.toUnit(application.nodeReRegistrationTimeout, $scope.application.nodeReRegistrationTimeoutUnit); - $scope.$watch('application.nodeReRegistrationTimeoutUnit', function(to, from) { - $scope.application.nodeReRegistrationTimeout = TimeUnit.convert($scope.application.nodeReRegistrationTimeout, from, to); + $scope.client.nodeReRegistrationTimeoutUnit = TimeUnit.autoUnit(client.nodeReRegistrationTimeout); + $scope.client.nodeReRegistrationTimeout = TimeUnit.toUnit(client.nodeReRegistrationTimeout, $scope.client.nodeReRegistrationTimeoutUnit); + $scope.$watch('client.nodeReRegistrationTimeoutUnit', function(to, from) { + $scope.client.nodeReRegistrationTimeout = TimeUnit.convert($scope.client.nodeReRegistrationTimeout, from, to); }); $scope.save = function() { - var appCopy = angular.copy($scope.application); - delete appCopy['nodeReRegistrationTimeoutUnit']; - appCopy.nodeReRegistrationTimeout = TimeUnit.toSeconds($scope.application.nodeReRegistrationTimeout, $scope.application.nodeReRegistrationTimeoutUnit) - Application.update({ realm : realm.realm, application : application.id }, appCopy, function () { + var clientCopy = angular.copy($scope.client); + delete clientCopy['nodeReRegistrationTimeoutUnit']; + clientCopy.nodeReRegistrationTimeout = TimeUnit.toSeconds($scope.client.nodeReRegistrationTimeout, $scope.client.nodeReRegistrationTimeoutUnit) + Client.update({ realm : realm.realm, client : client.id }, clientCopy, function () { $route.reload(); - Notifications.success('Your changes have been saved to the application.'); + Notifications.success('Your changes have been saved to the client.'); }); }; @@ -1007,8 +994,7 @@ module.controller('ApplicationClusteringCtrl', function($scope, application, App }; $scope.testNodesAvailable = function() { - console.log('testNodesAvailable'); - ApplicationTestNodesAvailable.get({ realm : realm.realm, application : application.id }, function(globalReqResult) { + ClientTestNodesAvailable.get({ realm : realm.realm, client : client.id }, function(globalReqResult) { $route.reload(); var successCount = globalReqResult.successRequests ? globalReqResult.successRequests.length : 0; @@ -1025,12 +1011,12 @@ module.controller('ApplicationClusteringCtrl', function($scope, application, App }); }; - if (application.registeredNodes) { + if (client.registeredNodes) { var nodeRegistrations = []; - for (node in application.registeredNodes) { + for (node in client.registeredNodes) { reg = { host: node, - lastRegistration: new Date(application.registeredNodes[node] * 1000) + lastRegistration: new Date(client.registeredNodes[node] * 1000) } nodeRegistrations.push(reg); } @@ -1039,24 +1025,22 @@ module.controller('ApplicationClusteringCtrl', function($scope, application, App }; }); -module.controller('ApplicationClusteringNodeCtrl', function($scope, application, Application, ApplicationClusterNode, realm, $location, $routeParams, Notifications) { - $scope.application = application; +module.controller('ClientClusteringNodeCtrl', function($scope, client, Client, ClientClusterNode, realm, $location, $routeParams, Notifications) { + $scope.client = client; $scope.realm = realm; $scope.create = !$routeParams.node; $scope.save = function() { - console.log('registerNode: ' + $scope.node.host); - ApplicationClusterNode.save({ realm : realm.realm, application : application.id , node: $scope.node.host }, function() { + ClientClusterNode.save({ realm : realm.realm, client : client.id , node: $scope.node.host }, function() { Notifications.success('Node ' + $scope.node.host + ' registered successfully.'); - $location.url('/realms/' + realm.realm + '/applications/' + application.id + '/clustering'); + $location.url('/realms/' + realm.realm + '/clients/' + client.id + '/clustering'); }); } $scope.unregisterNode = function() { - console.log('unregisterNode: ' + $scope.node.host); - ApplicationClusterNode.remove({ realm : realm.realm, application : application.id , node: $scope.node.host }, function() { + ClientClusterNode.remove({ realm : realm.realm, client : client.id , node: $scope.node.host }, function() { Notifications.success('Node ' + $scope.node.host + ' unregistered successfully.'); - $location.url('/realms/' + realm.realm + '/applications/' + application.id + '/clustering'); + $location.url('/realms/' + realm.realm + '/clients/' + client.id + '/clustering'); }); } @@ -1064,7 +1048,7 @@ module.controller('ApplicationClusteringNodeCtrl', function($scope, application, $scope.node = {} $scope.registered = false; } else { - var lastRegTime = application.registeredNodes[$routeParams.node]; + var lastRegTime = client.registeredNodes[$routeParams.node]; if (lastRegTime) { $scope.registered = true; @@ -1082,16 +1066,16 @@ module.controller('ApplicationClusteringNodeCtrl', function($scope, application, } }); -module.controller('ApplicationProtocolMapperListCtrl', function($scope, realm, application, serverInfo, - ApplicationProtocolMappersByProtocol, +module.controller('ClientProtocolMapperListCtrl', function($scope, realm, client, serverInfo, + ClientProtocolMappersByProtocol, $http, $location, Dialog, Notifications) { $scope.realm = realm; - $scope.application = application; - if (application.protocol == null) { - application.protocol = 'openid-connect'; + $scope.client = client; + if (client.protocol == null) { + client.protocol = 'openid-connect'; } - var protocolMappers = serverInfo.protocolMapperTypes[application.protocol]; + var protocolMappers = serverInfo.protocolMapperTypes[client.protocol]; var mapperTypes = {}; for (var i = 0; i < protocolMappers.length; i++) { mapperTypes[protocolMappers[i].id] = protocolMappers[i]; @@ -1100,22 +1084,22 @@ module.controller('ApplicationProtocolMapperListCtrl', function($scope, realm, a var updateMappers = function() { - $scope.mappers = ApplicationProtocolMappersByProtocol.query({realm : realm.realm, application : application.id, protocol : application.protocol}); + $scope.mappers = ClientProtocolMappersByProtocol.query({realm : realm.realm, client : client.id, protocol : client.protocol}); }; updateMappers(); }); -module.controller('AddBuiltinProtocolMapperCtrl', function($scope, realm, application, serverInfo, - ApplicationProtocolMappersByProtocol, +module.controller('AddBuiltinProtocolMapperCtrl', function($scope, realm, client, serverInfo, + ClientProtocolMappersByProtocol, $http, $location, Dialog, Notifications) { $scope.realm = realm; - $scope.application = application; - if (application.protocol == null) { - application.protocol = 'openid-connect'; + $scope.client = client; + if (client.protocol == null) { + client.protocol = 'openid-connect'; } - var protocolMappers = serverInfo.protocolMapperTypes[application.protocol]; + var protocolMappers = serverInfo.protocolMapperTypes[client.protocol]; var mapperTypes = {}; for (var i = 0; i < protocolMappers.length; i++) { mapperTypes[protocolMappers[i].id] = protocolMappers[i]; @@ -1126,21 +1110,17 @@ module.controller('AddBuiltinProtocolMapperCtrl', function($scope, realm, applic var updateMappers = function() { - var appMappers = ApplicationProtocolMappersByProtocol.query({realm : realm.realm, application : application.id, protocol : application.protocol}, function() { - var builtinMappers = serverInfo.builtinProtocolMappers[application.protocol]; - for (var i = 0; i < appMappers.length; i++) { + var clientMappers = ClientProtocolMappersByProtocol.query({realm : realm.realm, client : client.id, protocol : client.protocol}, function() { + var builtinMappers = serverInfo.builtinProtocolMappers[client.protocol]; + for (var i = 0; i < clientMappers.length; i++) { for (var j = 0; j < builtinMappers.length; j++) { - if (builtinMappers[j].name == appMappers[i].name - && builtinMappers[j].protocolMapper == appMappers[i].protocolMapper) { - console.log('removing: ' + builtinMappers[j].name); + if (builtinMappers[j].name == clientMappers[i].name + && builtinMappers[j].protocolMapper == clientMappers[i].protocolMapper) { builtinMappers.splice(j, 1); break; } } } - for (var j = 0; j < builtinMappers.length; j++) { - console.log('builtin left: ' + builtinMappers[j].name); - } $scope.mappers = builtinMappers; for (var i = 0; i < $scope.mappers.length; i++) { $scope.mappers[i].isChecked = false; @@ -1160,32 +1140,32 @@ module.controller('AddBuiltinProtocolMapperCtrl', function($scope, realm, applic toAdd.push($scope.mappers[i]); } } - $http.post(authUrl + '/admin/realms/' + realm.realm + '/applications-by-id/' + application.id + '/protocol-mappers/add-models', + $http.post(authUrl + '/admin/realms/' + realm.realm + '/clients-by-id/' + client.id + '/protocol-mappers/add-models', toAdd).success(function() { Notifications.success("Mappers added"); - $location.url('/realms/' + realm.realm + '/applications/' + application.id + '/mappers'); + $location.url('/realms/' + realm.realm + '/clients/' + client.id + '/mappers'); }).error(function() { Notifications.error("Error adding mappers"); - $location.url('/realms/' + realm.realm + '/applications/' + application.id + '/mappers'); + $location.url('/realms/' + realm.realm + '/clients/' + client.id + '/mappers'); }); }; }); -module.controller('ApplicationProtocolMapperCtrl', function($scope, realm, serverInfo, application, mapper, ApplicationProtocolMapper, Notifications, Dialog, $location) { +module.controller('ClientProtocolMapperCtrl', function($scope, realm, serverInfo, client, mapper, ClientProtocolMapper, Notifications, Dialog, $location) { $scope.realm = realm; - $scope.application = application; + $scope.client = client; $scope.create = false; - if (application.protocol == null) { - application.protocol = 'openid-connect'; + if (client.protocol == null) { + client.protocol = 'openid-connect'; } - $scope.protocol = application.protocol; + $scope.protocol = client.protocol; $scope.mapper = angular.copy(mapper); $scope.changed = false; $scope.boolval = true; $scope.boolvalId = 'boolval'; - var protocolMappers = serverInfo.protocolMapperTypes[application.protocol]; + var protocolMappers = serverInfo.protocolMapperTypes[client.protocol]; for (var i = 0; i < protocolMappers.length; i++) { if (protocolMappers[i].id == mapper.protocolMapper) { $scope.mapperType = protocolMappers[i]; @@ -1204,14 +1184,14 @@ module.controller('ApplicationProtocolMapperCtrl', function($scope, realm, serve }, true); $scope.save = function() { - ApplicationProtocolMapper.update({ + ClientProtocolMapper.update({ realm : realm.realm, - application: application.id, + client: client.id, id : mapper.id }, $scope.mapper, function() { $scope.changed = false; mapper = angular.copy($scope.mapper); - $location.url("/realms/" + realm.realm + '/applications/' + application.id + "/mappers/" + mapper.id); + $location.url("/realms/" + realm.realm + '/clients/' + client.id + "/mappers/" + mapper.id); Notifications.success("Your changes have been saved."); }); }; @@ -1228,25 +1208,25 @@ module.controller('ApplicationProtocolMapperCtrl', function($scope, realm, serve $scope.remove = function() { Dialog.confirmDelete($scope.mapper.name, 'mapper', function() { - ApplicationProtocolMapper.remove({ realm: realm.realm, application: application.id, id : $scope.mapper.id }, function() { + ClientProtocolMapper.remove({ realm: realm.realm, client: client.id, id : $scope.mapper.id }, function() { Notifications.success("The mapper has been deleted."); - $location.url("/realms/" + realm.realm + '/applications/' + application.id + "/mappers"); + $location.url("/realms/" + realm.realm + '/clients/' + client.id + "/mappers"); }); }); }; }); -module.controller('ApplicationProtocolMapperCreateCtrl', function($scope, realm, serverInfo, application, ApplicationProtocolMapper, Notifications, Dialog, $location) { +module.controller('ClientProtocolMapperCreateCtrl', function($scope, realm, serverInfo, client, ClientProtocolMapper, Notifications, Dialog, $location) { $scope.realm = realm; - $scope.application = application; + $scope.client = client; $scope.create = true; - if (application.protocol == null) { - application.protocol = 'openid-connect'; + if (client.protocol == null) { + client.protocol = 'openid-connect'; } - var protocol = application.protocol; + var protocol = client.protocol; $scope.protocol = protocol; - $scope.mapper = { protocol : application.protocol, config: {}}; + $scope.mapper = { protocol : client.protocol, config: {}}; $scope.mapperTypes = serverInfo.protocolMapperTypes[protocol]; $scope.$watch(function() { @@ -1257,12 +1237,12 @@ module.controller('ApplicationProtocolMapperCreateCtrl', function($scope, realm, $scope.save = function() { $scope.mapper.protocolMapper = $scope.mapperType.id; - ApplicationProtocolMapper.save({ - realm : realm.realm, application: application.id + ClientProtocolMapper.save({ + realm : realm.realm, client: client.id }, $scope.mapper, function(data, headers) { var l = headers().location; var id = l.substring(l.lastIndexOf("/") + 1); - $location.url("/realms/" + realm.realm + '/applications/' + application.id + "/mappers/" + id); + $location.url("/realms/" + realm.realm + '/clients/' + client.id + "/mappers/" + id); Notifications.success("Mapper has been created."); }); }; diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js index 750d4825475..97c1bdaa7a1 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js @@ -476,7 +476,7 @@ module.controller('RealmRequiredCredentialsCtrl', function($scope, Realm, realm, }; }); -module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, applications, roles, Notifications, ApplicationRole, Application) { +module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, clients, roles, Notifications, ClientRole, Client) { console.log('RealmDefaultRolesCtrl'); @@ -486,17 +486,17 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, appli $scope.selectedRealmRoles = []; $scope.selectedRealmDefRoles = []; - $scope.applications = angular.copy(applications); - for (var i = 0; i < applications.length; i++) { - if (applications[i].name == 'account') { - $scope.application = $scope.applications[i]; + $scope.clients = angular.copy(clients); + for (var i = 0; i < clients.length; i++) { + if (clients[i].name == 'account') { + $scope.client = $scope.clients[i]; break; } } - $scope.availableAppRoles = []; - $scope.selectedAppRoles = []; - $scope.selectedAppDefRoles = []; + $scope.availableClientRoles = []; + $scope.selectedClientRoles = []; + $scope.selectedClientDefRoles = []; if (!$scope.realm.hasOwnProperty('defaultRoles') || $scope.realm.defaultRoles === null) { $scope.realm.defaultRoles = []; @@ -550,81 +550,81 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, appli }); }; - $scope.changeApplication = function () { + $scope.changeClient = function () { - $scope.selectedAppRoles = []; - $scope.selectedAppDefRoles = []; + $scope.selectedClientRoles = []; + $scope.selectedClientDefRoles = []; - // Populate available roles for selected application - if ($scope.application) { - var appDefaultRoles = ApplicationRole.query({realm: $scope.realm.realm, application: $scope.application.id}, function () { + // Populate available roles for selected client + if ($scope.client) { + var appDefaultRoles = ClientRole.query({realm: $scope.realm.realm, client: $scope.client.id}, function () { - if (!$scope.application.hasOwnProperty('defaultRoles') || $scope.application.defaultRoles === null) { - $scope.application.defaultRoles = []; + if (!$scope.client.hasOwnProperty('defaultRoles') || $scope.client.defaultRoles === null) { + $scope.client.defaultRoles = []; } - $scope.availableAppRoles = []; + $scope.availableClientRoles = []; for (var i = 0; i < appDefaultRoles.length; i++) { var roleName = appDefaultRoles[i].name; - if ($scope.application.defaultRoles.indexOf(roleName) < 0) { - $scope.availableAppRoles.push(roleName); + if ($scope.client.defaultRoles.indexOf(roleName) < 0) { + $scope.availableClientRoles.push(roleName); } } }); } else { - $scope.availableAppRoles = null; + $scope.availableClientRoles = null; } }; - $scope.addAppDefaultRole = function () { + $scope.addClientDefaultRole = function () { // Remove selected roles from the app available roles and add them to app default roles (move from left to right). - for (var i = 0; i < $scope.selectedAppRoles.length; i++) { - var role = $scope.selectedAppRoles[i]; + for (var i = 0; i < $scope.selectedClientRoles.length; i++) { + var role = $scope.selectedClientRoles[i]; - var idx = $scope.application.defaultRoles.indexOf(role); + var idx = $scope.client.defaultRoles.indexOf(role); if (idx < 0) { - $scope.application.defaultRoles.push(role); + $scope.client.defaultRoles.push(role); } - idx = $scope.availableAppRoles.indexOf(role); + idx = $scope.availableClientRoles.indexOf(role); if (idx != -1) { - $scope.availableAppRoles.splice(idx, 1); + $scope.availableClientRoles.splice(idx, 1); } } - // Update/save the selected application with new default roles. - Application.update({ + // Update/save the selected client with new default roles. + Client.update({ realm: $scope.realm.realm, - application: $scope.application.id - }, $scope.application, function () { - Notifications.success("Your changes have been saved to the application."); + client: $scope.client.id + }, $scope.client, function () { + Notifications.success("Your changes have been saved to the client."); }); }; - $scope.rmAppDefaultRole = function () { + $scope.rmClientDefaultRole = function () { // Remove selected roles from the app default roles and add them to app available roles (move from right to left). - for (var i = 0; i < $scope.selectedAppDefRoles.length; i++) { - var role = $scope.selectedAppDefRoles[i]; - var idx = $scope.application.defaultRoles.indexOf(role); + for (var i = 0; i < $scope.selectedClientDefRoles.length; i++) { + var role = $scope.selectedClientDefRoles[i]; + var idx = $scope.client.defaultRoles.indexOf(role); if (idx != -1) { - $scope.application.defaultRoles.splice(idx, 1); + $scope.client.defaultRoles.splice(idx, 1); } - idx = $scope.availableAppRoles.indexOf(role); + idx = $scope.availableClientRoles.indexOf(role); if (idx < 0) { - $scope.availableAppRoles.push(role); + $scope.availableClientRoles.push(role); } } - // Update/save the selected application with new default roles. - Application.update({ + // Update/save the selected client with new default roles. + Client.update({ realm: $scope.realm.realm, - application: $scope.application.id - }, $scope.application, function () { - Notifications.success("Your changes have been saved to the application."); + client: $scope.client.id + }, $scope.client, function () { + Notifications.success("Your changes have been saved to the client."); }); }; @@ -848,7 +848,7 @@ module.controller('RealmIdentityProviderCtrl', function($scope, $filter, $upload alias : $scope.identityProvider.alias }, function() { $location.url("/realms/" + realm.realm + "/identity-provider-settings"); - Notifications.success("The application has been deleted."); + Notifications.success("The client has been deleted."); }); }); }; @@ -1008,7 +1008,7 @@ module.controller('RealmKeysDetailCtrl', function($scope, Realm, realm, $http, $ }; }); -module.controller('RealmSessionStatsCtrl', function($scope, realm, stats, RealmApplicationSessionStats, RealmLogoutAll, Notifications) { +module.controller('RealmSessionStatsCtrl', function($scope, realm, stats, RealmClientSessionStats, RealmLogoutAll, Notifications) { $scope.realm = realm; $scope.stats = stats; @@ -1073,7 +1073,7 @@ module.controller('RealmRevocationCtrl', function($scope, Realm, RealmPushRevoca var msgStart = successCount>0 ? 'Successfully push notBefore to: ' + globalReqResult.successRequests + ' . ' : ''; Notifications.error(msgStart + 'Failed to push notBefore to: ' + globalReqResult.failedRequests + '. Verify availability of failed hosts and try again'); } else { - Notifications.success('Successfully push notBefore to all configured applications'); + Notifications.success('Successfully push notBefore to all configured clients'); } }); } @@ -1094,8 +1094,8 @@ module.controller('RoleListCtrl', function($scope, $location, realm, roles) { }); -module.controller('RoleDetailCtrl', function($scope, realm, role, roles, applications, - Role, ApplicationRole, RoleById, RoleRealmComposites, RoleApplicationComposites, +module.controller('RoleDetailCtrl', function($scope, realm, role, roles, clients, + Role, ClientRole, RoleById, RoleRealmComposites, RoleClientComposites, $http, $location, Dialog, Notifications) { $scope.realm = realm; $scope.role = angular.copy(role); @@ -1141,8 +1141,8 @@ module.controller('RoleDetailCtrl', function($scope, realm, role, roles, applica - roleControl($scope, realm, role, roles, applications, - ApplicationRole, RoleById, RoleRealmComposites, RoleApplicationComposites, + roleControl($scope, realm, role, roles, clients, + ClientRole, RoleById, RoleRealmComposites, RoleClientComposites, $http, $location, Notifications, Dialog); }); diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js index 3d50839a9ca..30003bd05a0 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js @@ -1,17 +1,17 @@ -module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, applications, Notifications, RealmRoleMapping, - ApplicationRoleMapping, AvailableRealmRoleMapping, AvailableApplicationRoleMapping, - CompositeRealmRoleMapping, CompositeApplicationRoleMapping) { +module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, clients, Notifications, RealmRoleMapping, + ClientRoleMapping, AvailableRealmRoleMapping, AvailableClientRoleMapping, + CompositeRealmRoleMapping, CompositeClientRoleMapping) { $scope.realm = realm; $scope.user = user; $scope.selectedRealmRoles = []; $scope.selectedRealmMappings = []; $scope.realmMappings = []; - $scope.applications = applications; - $scope.applicationRoles = []; - $scope.applicationComposite = []; - $scope.selectedApplicationRoles = []; - $scope.selectedApplicationMappings = []; - $scope.applicationMappings = []; + $scope.clients = clients; + $scope.clientRoles = []; + $scope.clientComposite = []; + $scope.selectedClientRoles = []; + $scope.selectedClientMappings = []; + $scope.clientMappings = []; $scope.dummymodel = []; $scope.realmMappings = RealmRoleMapping.query({realm : realm.realm, userId : user.username}); @@ -26,13 +26,13 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, ap $scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.username}); $scope.selectedRealmMappings = []; $scope.selectRealmRoles = []; - if ($scope.application) { + if ($scope.client) { console.log('load available'); - $scope.applicationComposite = CompositeApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.applicationRoles = AvailableApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.applicationMappings = ApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.selectedApplicationRoles = []; - $scope.selectedApplicationMappings = []; + $scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.selectedClientRoles = []; + $scope.selectedClientMappings = []; } Notifications.success("Role mappings updated."); @@ -47,57 +47,57 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, ap $scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.username}); $scope.selectedRealmMappings = []; $scope.selectRealmRoles = []; - if ($scope.application) { + if ($scope.client) { console.log('load available'); - $scope.applicationComposite = CompositeApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.applicationRoles = AvailableApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.applicationMappings = ApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.selectedApplicationRoles = []; - $scope.selectedApplicationMappings = []; + $scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.selectedClientRoles = []; + $scope.selectedClientMappings = []; } Notifications.success("Role mappings updated."); }); }; - $scope.addApplicationRole = function() { - $http.post(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/applications-by-id/' + $scope.application.id, - $scope.selectedApplicationRoles).success(function() { - $scope.applicationMappings = ApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.applicationRoles = AvailableApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.applicationComposite = CompositeApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.selectedApplicationRoles = []; - $scope.selectedApplicationMappings = []; + $scope.addClientRole = function() { + $http.post(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/clients-by-id/' + $scope.client.id, + $scope.selectedClientRoles).success(function() { + $scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.selectedClientRoles = []; + $scope.selectedClientMappings = []; Notifications.success("Role mappings updated."); }); }; - $scope.deleteApplicationRole = function() { - $http.delete(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/applications-by-id/' + $scope.application.id, - {data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(function() { - $scope.applicationMappings = ApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.applicationRoles = AvailableApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.applicationComposite = CompositeApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.selectedApplicationRoles = []; - $scope.selectedApplicationMappings = []; + $scope.deleteClientRole = function() { + $http.delete(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/clients-by-id/' + $scope.client.id, + {data : $scope.selectedClientMappings, headers : {"content-type" : "application/json"}}).success(function() { + $scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.selectedClientRoles = []; + $scope.selectedClientMappings = []; Notifications.success("Role mappings updated."); }); }; - $scope.changeApplication = function() { - console.log('changeApplication'); - if ($scope.application) { + $scope.changeClient = function() { + console.log('changeClient'); + if ($scope.client) { console.log('load available'); - $scope.applicationComposite = CompositeApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.applicationRoles = AvailableApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); - $scope.applicationMappings = ApplicationRoleMapping.query({realm : realm.realm, userId : user.username, application : $scope.application.id}); + $scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); + $scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id}); } else { - $scope.applicationRoles = null; - $scope.applicationMappings = null; - $scope.applicationComposite = null; + $scope.clientRoles = null; + $scope.clientMappings = null; + $scope.clientComposite = null; } - $scope.selectedApplicationRoles = []; - $scope.selectedApplicationMappings = []; + $scope.selectedClientRoles = []; + $scope.selectedClientMappings = []; }; @@ -111,7 +111,7 @@ module.controller('UserSessionsCtrl', function($scope, realm, user, sessions, Us $scope.logoutAll = function() { UserLogout.save({realm : realm.realm, user: user.username}, function () { - Notifications.success('Logged out user in all applications'); + Notifications.success('Logged out user in all clients'); UserSessions.query({realm: realm.realm, user: user.username}, function(updated) { $scope.sessions = updated; }) diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/loaders.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/loaders.js index 7223ae55920..b6e05419995 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/loaders.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/loaders.js @@ -71,19 +71,19 @@ module.factory('RealmSessionStatsLoader', function(Loader, RealmSessionStats, $r }); }); -module.factory('RealmApplicationSessionStatsLoader', function(Loader, RealmApplicationSessionStats, $route, $q) { - return Loader.query(RealmApplicationSessionStats, function() { +module.factory('RealmClientSessionStatsLoader', function(Loader, RealmClientSessionStats, $route, $q) { + return Loader.query(RealmClientSessionStats, function() { return { realm : $route.current.params.realm } }); }); -module.factory('ApplicationProtocolMapperLoader', function(Loader, ApplicationProtocolMapper, $route, $q) { - return Loader.get(ApplicationProtocolMapper, function() { +module.factory('ClientProtocolMapperLoader', function(Loader, ClientProtocolMapper, $route, $q) { + return Loader.get(ClientProtocolMapper, function() { return { realm : $route.current.params.realm, - application : $route.current.params.application, + client : $route.current.params.client, id: $route.current.params.id } }); @@ -164,74 +164,74 @@ module.factory('RoleListLoader', function(Loader, Role, $route, $q) { }); }); -module.factory('ApplicationRoleLoader', function(Loader, RoleById, $route, $q) { +module.factory('ClientRoleLoader', function(Loader, RoleById, $route, $q) { return Loader.get(RoleById, function() { return { realm : $route.current.params.realm, - application : $route.current.params.application, + client : $route.current.params.client, role : $route.current.params.role } }); }); -module.factory('ApplicationSessionStatsLoader', function(Loader, ApplicationSessionStats, $route, $q) { - return Loader.get(ApplicationSessionStats, function() { +module.factory('ClientSessionStatsLoader', function(Loader, ClientSessionStats, $route, $q) { + return Loader.get(ClientSessionStats, function() { return { realm : $route.current.params.realm, - application : $route.current.params.application + client : $route.current.params.client } }); }); -module.factory('ApplicationSessionCountLoader', function(Loader, ApplicationSessionCount, $route, $q) { - return Loader.get(ApplicationSessionCount, function() { +module.factory('ClientSessionCountLoader', function(Loader, ClientSessionCount, $route, $q) { + return Loader.get(ClientSessionCount, function() { return { realm : $route.current.params.realm, - application : $route.current.params.application + client : $route.current.params.client } }); }); -module.factory('ApplicationClaimsLoader', function(Loader, ApplicationClaims, $route, $q) { - return Loader.get(ApplicationClaims, function() { +module.factory('ClientClaimsLoader', function(Loader, ClientClaims, $route, $q) { + return Loader.get(ClientClaims, function() { return { realm : $route.current.params.realm, - application : $route.current.params.application + client : $route.current.params.client } }); }); -module.factory('ApplicationInstallationLoader', function(Loader, ApplicationInstallation, $route, $q) { - return Loader.get(ApplicationInstallation, function() { +module.factory('ClientInstallationLoader', function(Loader, ClientInstallation, $route, $q) { + return Loader.get(ClientInstallation, function() { return { realm : $route.current.params.realm, - application : $route.current.params.application + client : $route.current.params.client } }); }); -module.factory('ApplicationRoleListLoader', function(Loader, ApplicationRole, $route, $q) { - return Loader.query(ApplicationRole, function() { +module.factory('ClientRoleListLoader', function(Loader, ClientRole, $route, $q) { + return Loader.query(ClientRole, function() { return { realm : $route.current.params.realm, - application : $route.current.params.application + client : $route.current.params.client } }); }); -module.factory('ApplicationLoader', function(Loader, Application, $route, $q) { - return Loader.get(Application, function() { +module.factory('ClientLoader', function(Loader, Client, $route, $q) { + return Loader.get(Client, function() { return { realm : $route.current.params.realm, - application : $route.current.params.application + client : $route.current.params.client } }); }); -module.factory('ApplicationListLoader', function(Loader, Application, $route, $q) { - return Loader.query(Application, function() { +module.factory('ClientListLoader', function(Loader, Client, $route, $q) { + return Loader.query(Client, function() { return { realm : $route.current.params.realm } @@ -240,7 +240,7 @@ module.factory('ApplicationListLoader', function(Loader, Application, $route, $q module.factory('RoleMappingLoader', function(Loader, RoleMapping, $route, $q) { - var realm = $route.current.params.realm || $route.current.params.application; + var realm = $route.current.params.realm || $route.current.params.client; return Loader.query(RoleMapping, function() { return { diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js index 805bc01319d..da0b2eb1a79 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js @@ -190,10 +190,10 @@ module.factory('ServerInfo', function($resource) { -module.factory('ApplicationProtocolMapper', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/protocol-mappers/models/:id', { +module.factory('ClientProtocolMapper', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/protocol-mappers/models/:id', { realm : '@realm', - application: '@application', + client: '@client', id : "@id" }, { update : { @@ -324,72 +324,72 @@ module.factory('AvailableRealmRoleMapping', function($resource) { }); -module.factory('ApplicationRoleMapping', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/users/:userId/role-mappings/applications-by-id/:application', { +module.factory('ClientRoleMapping', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/users/:userId/role-mappings/clients-by-id/:client', { realm : '@realm', userId : '@userId', - application : "@application" + client : "@client" }); }); -module.factory('AvailableApplicationRoleMapping', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/users/:userId/role-mappings/applications-by-id/:application/available', { +module.factory('AvailableClientRoleMapping', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/users/:userId/role-mappings/clients-by-id/:client/available', { realm : '@realm', userId : '@userId', - application : "@application" + client : "@client" }); }); -module.factory('CompositeApplicationRoleMapping', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/users/:userId/role-mappings/applications-by-id/:application/composite', { +module.factory('CompositeClientRoleMapping', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/users/:userId/role-mappings/clients-by-id/:client/composite', { realm : '@realm', userId : '@userId', - application : "@application" + client : "@client" }); }); -module.factory('ApplicationRealmScopeMapping', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/scope-mappings/realm', { +module.factory('ClientRealmScopeMapping', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/scope-mappings/realm', { realm : '@realm', - application : '@application' + client : '@client' }); }); -module.factory('ApplicationAvailableRealmScopeMapping', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/scope-mappings/realm/available', { +module.factory('ClientAvailableRealmScopeMapping', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/scope-mappings/realm/available', { realm : '@realm', - application : '@application' + client : '@client' }); }); -module.factory('ApplicationCompositeRealmScopeMapping', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/scope-mappings/realm/composite', { +module.factory('ClientCompositeRealmScopeMapping', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/scope-mappings/realm/composite', { realm : '@realm', - application : '@application' + client : '@client' }); }); -module.factory('ApplicationApplicationScopeMapping', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/scope-mappings/applications-by-id/:targetApp', { +module.factory('ClientClientScopeMapping', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/scope-mappings/clients-by-id/:targetClient', { realm : '@realm', - application : '@application', - targetApp : '@targetApp' + client : '@client', + targetClient : '@targetClient' }); }); -module.factory('ApplicationAvailableApplicationScopeMapping', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/scope-mappings/applications-by-id/:targetApp/available', { +module.factory('ClientAvailableClientScopeMapping', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/scope-mappings/clients-by-id/:targetClient/available', { realm : '@realm', - application : '@application', - targetApp : '@targetApp' + client : '@client', + targetClient : '@targetClient' }); }); -module.factory('ApplicationCompositeApplicationScopeMapping', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/scope-mappings/applications-by-id/:targetApp/composite', { +module.factory('ClientCompositeClientScopeMapping', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/scope-mappings/clients-by-id/:targetClient/composite', { realm : '@realm', - application : '@application', - targetApp : '@targetApp' + client : '@client', + targetClient : '@targetClient' }); }); @@ -420,24 +420,24 @@ module.factory('RealmSessionStats', function($resource) { }); }); -module.factory('RealmApplicationSessionStats', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/application-by-id-session-stats', { +module.factory('RealmClientSessionStats', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/client-by-id-session-stats', { realm : '@realm' }); }); -module.factory('RoleApplicationComposites', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/roles-by-id/:role/composites/applications-by-id/:application', { +module.factory('RoleClientComposites', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/roles-by-id/:role/composites/clients-by-id/:client', { realm : '@realm', role : '@role', - application : "@application" + client : "@client" }); }); -function roleControl($scope, realm, role, roles, applications, - ApplicationRole, RoleById, RoleRealmComposites, RoleApplicationComposites, +function roleControl($scope, realm, role, roles, clients, + ClientRole, RoleById, RoleRealmComposites, RoleClientComposites, $http, $location, Notifications, Dialog) { $scope.$watch(function () { @@ -476,11 +476,11 @@ function roleControl($scope, realm, role, roles, applications, $scope.selectedRealmRoles = []; $scope.selectedRealmMappings = []; $scope.realmMappings = []; - $scope.applications = applications; - $scope.applicationRoles = []; - $scope.selectedApplicationRoles = []; - $scope.selectedApplicationMappings = []; - $scope.applicationMappings = []; + $scope.clients = clients; + $scope.clientRoles = []; + $scope.selectedClientRoles = []; + $scope.selectedClientMappings = []; + $scope.clientMappings = []; for (var j = 0; j < $scope.realmRoles.length; j++) { if ($scope.realmRoles[j].id == role.id) { @@ -540,61 +540,61 @@ function roleControl($scope, realm, role, roles, applications, }); }; - $scope.addApplicationRole = function() { + $scope.addClientRole = function() { $scope.compositeSwitchDisabled=true; $http.post(authUrl + '/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites', - $scope.selectedApplicationRoles).success(function() { - for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) { - var role = $scope.selectedApplicationRoles[i]; - var idx = $scope.applicationRoles.indexOf($scope.selectedApplicationRoles[i]); + $scope.selectedClientRoles).success(function() { + for (var i = 0; i < $scope.selectedClientRoles.length; i++) { + var role = $scope.selectedClientRoles[i]; + var idx = $scope.clientRoles.indexOf($scope.selectedClientRoles[i]); if (idx != -1) { - $scope.applicationRoles.splice(idx, 1); - $scope.applicationMappings.push(role); + $scope.clientRoles.splice(idx, 1); + $scope.clientMappings.push(role); } } - $scope.selectedApplicationRoles = []; + $scope.selectedClientRoles = []; }); }; - $scope.deleteApplicationRole = function() { + $scope.deleteClientRole = function() { $scope.compositeSwitchDisabled=true; $http.delete(authUrl + '/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites', - {data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(function() { - for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) { - var role = $scope.selectedApplicationMappings[i]; - var idx = $scope.applicationMappings.indexOf($scope.selectedApplicationMappings[i]); + {data : $scope.selectedClientMappings, headers : {"content-type" : "application/json"}}).success(function() { + for (var i = 0; i < $scope.selectedClientMappings.length; i++) { + var role = $scope.selectedClientMappings[i]; + var idx = $scope.clientMappings.indexOf($scope.selectedClientMappings[i]); if (idx != -1) { - $scope.applicationMappings.splice(idx, 1); - $scope.applicationRoles.push(role); + $scope.clientMappings.splice(idx, 1); + $scope.clientRoles.push(role); } } - $scope.selectedApplicationMappings = []; + $scope.selectedClientMappings = []; }); }; - $scope.changeApplication = function() { - $scope.applicationRoles = ApplicationRole.query({realm : realm.realm, application : $scope.compositeApp.id}, function() { - $scope.applicationMappings = RoleApplicationComposites.query({realm : realm.realm, role : role.id, application : $scope.compositeApp.id}, function(){ - for (var i = 0; i < $scope.applicationMappings.length; i++) { - var role = $scope.applicationMappings[i]; - for (var j = 0; j < $scope.applicationRoles.length; j++) { - var realmRole = $scope.applicationRoles[j]; + $scope.changeClient = function() { + $scope.clientRoles = ClientRole.query({realm : realm.realm, client : $scope.compositeClient.id}, function() { + $scope.clientMappings = RoleClientComposites.query({realm : realm.realm, role : role.id, client : $scope.compositeClient.id}, function(){ + for (var i = 0; i < $scope.clientMappings.length; i++) { + var role = $scope.clientMappings[i]; + for (var j = 0; j < $scope.clientRoles.length; j++) { + var realmRole = $scope.clientRoles[j]; if (realmRole.id == role.id) { - var idx = $scope.applicationRoles.indexOf(realmRole); + var idx = $scope.clientRoles.indexOf(realmRole); if (idx != -1) { - $scope.applicationRoles.splice(idx, 1); + $scope.clientRoles.splice(idx, 1); break; } } } } }); - for (var j = 0; j < $scope.applicationRoles.length; j++) { - if ($scope.applicationRoles[j] == role.id) { - var appRole = $scope.applicationRoles[j]; - var idx = $scope.applicationRoles.indexof(appRole); - $scope.applicationRoles.splice(idx, 1); + for (var j = 0; j < $scope.clientRoles.length; j++) { + if ($scope.clientRoles[j] == role.id) { + var appRole = $scope.clientRoles[j]; + var idx = $scope.clientRoles.indexof(appRole); + $scope.clientRoles.splice(idx, 1); break; } } @@ -630,10 +630,10 @@ module.factory('RoleById', function($resource) { }); }); -module.factory('ApplicationRole', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/roles/:role', { +module.factory('ClientRole', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/roles/:role', { realm : '@realm', - application : "@application", + client : "@client", role : '@role' }, { update : { @@ -642,10 +642,10 @@ module.factory('ApplicationRole', function($resource) { }); }); -module.factory('ApplicationClaims', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/claims', { +module.factory('ClientClaims', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/claims', { realm : '@realm', - application : "@application" + client : "@client" }, { update : { method : 'PUT' @@ -653,52 +653,52 @@ module.factory('ApplicationClaims', function($resource) { }); }); -module.factory('ApplicationProtocolMappersByProtocol', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/protocol-mappers/protocol/:protocol', { +module.factory('ClientProtocolMappersByProtocol', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/protocol-mappers/protocol/:protocol', { realm : '@realm', - application : "@application", + client : "@client", protocol : "@protocol" }); }); -module.factory('ApplicationSessionStats', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/session-stats', { +module.factory('ClientSessionStats', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/session-stats', { realm : '@realm', - application : "@application" + client : "@client" }); }); -module.factory('ApplicationSessionStatsWithUsers', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/session-stats?users=true', { +module.factory('ClientSessionStatsWithUsers', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/session-stats?users=true', { realm : '@realm', - application : "@application" + client : "@client" }); }); -module.factory('ApplicationSessionCount', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/session-count', { +module.factory('ClientSessionCount', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/session-count', { realm : '@realm', - application : "@application" + client : "@client" }); }); -module.factory('ApplicationUserSessions', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/user-sessions', { +module.factory('ClientUserSessions', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/user-sessions', { realm : '@realm', - application : "@application" + client : "@client" }); }); -module.factory('ApplicationLogoutAll', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/logout-all', { +module.factory('ClientLogoutAll', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/logout-all', { realm : '@realm', - application : "@application" + client : "@client" }); }); -module.factory('ApplicationLogoutUser', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/logout-user/:user', { +module.factory('ClientLogoutUser', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/logout-user/:user', { realm : '@realm', - application : "@application", + client : "@client", user : "@user" }); }); @@ -708,39 +708,39 @@ module.factory('RealmLogoutAll', function($resource) { }); }); -module.factory('ApplicationPushRevocation', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/push-revocation', { +module.factory('ClientPushRevocation', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/push-revocation', { realm : '@realm', - application : "@application" + client : "@client" }); }); -module.factory('ApplicationClusterNode', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/nodes/:node', { +module.factory('ClientClusterNode', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/nodes/:node', { realm : '@realm', - application : "@application" + client : "@client" }); }); -module.factory('ApplicationTestNodesAvailable', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/test-nodes-available', { +module.factory('ClientTestNodesAvailable', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/test-nodes-available', { realm : '@realm', - application : "@application" + client : "@client" }); }); -module.factory('ApplicationCertificate', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/certificates/:attribute', { +module.factory('ClientCertificate', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/certificates/:attribute', { realm : '@realm', - application : "@application", + client : "@client", attribute: "@attribute" }); }); -module.factory('ApplicationCertificateGenerate', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/certificates/:attribute/generate', { +module.factory('ClientCertificateGenerate', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/certificates/:attribute/generate', { realm : '@realm', - application : "@application", + client : "@client", attribute: "@attribute" }, { @@ -750,10 +750,10 @@ module.factory('ApplicationCertificateGenerate', function($resource) { }); }); -module.factory('ApplicationCertificateDownload', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/certificates/:attribute/download', { +module.factory('ClientCertificateDownload', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/certificates/:attribute/download', { realm : '@realm', - application : "@application", + client : "@client", attribute: "@attribute" }, { @@ -764,10 +764,10 @@ module.factory('ApplicationCertificateDownload', function($resource) { }); }); -module.factory('Application', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application', { +module.factory('Client', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client', { realm : '@realm', - application : '@application' + client : '@client' }, { update : { method : 'PUT' @@ -775,29 +775,29 @@ module.factory('Application', function($resource) { }); }); -module.factory('ApplicationInstallation', function($resource) { - var url = authUrl + '/admin/realms/:realm/applications-by-id/:application/installation/json'; +module.factory('ClientInstallation', function($resource) { + var url = authUrl + '/admin/realms/:realm/clients-by-id/:client/installation/json'; return { url : function(parameters) { - return url.replace(':realm', parameters.realm).replace(':application', parameters.application); + return url.replace(':realm', parameters.realm).replace(':client', parameters.client); } } }); -module.factory('ApplicationInstallationJBoss', function($resource) { - var url = authUrl + '/admin/realms/:realm/applications-by-id/:application/installation/jboss'; +module.factory('ClientInstallationJBoss', function($resource) { + var url = authUrl + '/admin/realms/:realm/clients-by-id/:client/installation/jboss'; return { url : function(parameters) { - return url.replace(':realm', parameters.realm).replace(':application', parameters.application); + return url.replace(':realm', parameters.realm).replace(':client', parameters.client); } } }); -module.factory('ApplicationCredentials', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/client-secret', { +module.factory('ClientCredentials', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/client-secret', { realm : '@realm', - application : '@application' + client : '@client' }, { update : { method : 'POST' @@ -805,10 +805,10 @@ module.factory('ApplicationCredentials', function($resource) { }); }); -module.factory('ApplicationOrigins', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/applications-by-id/:application/allowed-origins', { +module.factory('ClientOrigins', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/clients-by-id/:client/allowed-origins', { realm : '@realm', - application : '@application' + client : '@client' }, { update : { method : 'PUT', @@ -822,8 +822,8 @@ module.factory('Current', function(Realm, $route) { current.realms = {}; current.realm = null; - current.applications = {}; - current.application = null; + current.clients = {}; + current.client = null; current.refresh = function() { current.realm = null; diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-list.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-list.html deleted file mode 100755 index 92bb4af983d..00000000000 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-list.html +++ /dev/null @@ -1,59 +0,0 @@ -
-
-

-
-

{{realm.realm}} Applications

- - - - - - - - - - - - - - - - - - - - - -
-
- - -
-
- Import - Create -
-
Application NameEnabledBase URL
{{app.name}}{{app.enabled}} - {{app.baseUrl}} - Not defined -
No applications available
- -
-
\ No newline at end of file diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-clustering-node.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-clustering-node.html similarity index 79% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-clustering-node.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-clustering-node.html index 3c4f6145e18..d959154e169 100644 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-clustering-node.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-clustering-node.html @@ -1,14 +1,14 @@
- +
-

{{application.name}} Clustering

+

{{client.clientId}} Clustering

Cluster node on host {{node.host}} not registered!

diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-clustering.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-clustering.html similarity index 78% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-clustering.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-clustering.html index dd5316e0a45..cedd87d551c 100644 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-clustering.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-clustering.html @@ -1,13 +1,13 @@
- +
-

{{application.name}} Clustering

+

{{client.clientId}} Clustering

Basic configuration
@@ -17,12 +17,12 @@
- + @@ -30,7 +30,7 @@
- +
@@ -46,7 +46,7 @@
Register node manually + tooltip-placement="bottom" href="#/register-node/realms/{{realm.realm}}/clients/{{client.id}}/clustering">Register node manually
@@ -57,7 +57,7 @@ - {{node.host}} + {{node.host}} {{node.lastRegistration}} diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-credentials.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-credentials.html similarity index 71% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-credentials.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-credentials.html index f8cc47acfba..fdb8ceeae33 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-credentials.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-credentials.html @@ -1,14 +1,14 @@
- +
-

{{application.name}} Credentials

- +

{{client.clientId}} Credentials

+
Client Secret
@@ -18,7 +18,7 @@
-
+
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-detail.html similarity index 79% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-detail.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-detail.html index 9c0a2c5959d..aa3d9baa53c 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-detail.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-detail.html @@ -1,46 +1,46 @@
- +
-

{{application.name}} Application Settings

-

{{realm.realm}} Add Application

+

{{client.clientId}} Client Settings

+

{{realm.realm}} Add Client

* Required fields

- +
- +
- +
- +
- +
- +
- +
@@ -69,7 +69,7 @@
- +
@@ -129,9 +129,9 @@
- +
- +
@@ -153,9 +153,9 @@
-
+
-
+
@@ -169,7 +169,7 @@
+ data-ng-class="{'input-below':client.redirectUris.length}" /> @@ -177,33 +177,33 @@
-
+
+ data-ng-model="client.baseUrl">
- +
+ data-ng-model="client.adminUrl">
- +
+ data-ng-model="client.adminUrl">
-
+
-
+
@@ -217,7 +217,7 @@
+ data-ng-class="{'input-below':client.webOrigins.length}" /> @@ -231,30 +231,30 @@
- +
- +
- +
- +
- +
- +
- +
- +
@@ -265,7 +265,7 @@
- +
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-identity-provider.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-identity-provider.html similarity index 57% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-identity-provider.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-identity-provider.html index f4473bf8fa1..c24ec4e654e 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-identity-provider.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-identity-provider.html @@ -1,20 +1,20 @@
- +
-

{{application.name}} Identity Provider Settings

+

{{client.clientId}} Identity Provider Settings

{{identityProvider.identityProvider.name}} -
- +
+
- +
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-import.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-import.html similarity index 87% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-import.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-import.html index 4399d3c78ef..1efd3be6d9e 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-import.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-import.html @@ -1,11 +1,11 @@

-

{{application.name}} Application Import

+

{{client.clientId}} Client Import

diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-installation.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-installation.html similarity index 73% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-installation.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-installation.html index 5a98483923b..134376ea2d9 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-installation.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-installation.html @@ -1,14 +1,14 @@
- +
-

{{application.name}} Adapter Installation

+

{{client.clientId}} Adapter Installation

diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-keys.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-keys.html similarity index 92% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-keys.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-keys.html index 1acaa543978..e789df5626a 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-keys.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-keys.html @@ -1,13 +1,13 @@
- +
-

{{application.name}} Key Pair and Certificate

+

{{client.clientId}} Key Pair and Certificate

Import Keys and Cert @@ -62,7 +62,7 @@
- Download Keys and Cert + Download Keys and Cert
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-list.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-list.html new file mode 100755 index 00000000000..52cf833ab43 --- /dev/null +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-list.html @@ -0,0 +1,47 @@ +
+
+

+
+

{{realm.realm}} Clients

+ + + + + + + + + + + + + + + + + + + + +
+
+ + +
+
+ Import + Create +
+
Client IDEnabledBase URL
{{client.clientId}}{{client.enabled}} + {{client.baseUrl}} + Not defined +
No clients available
+ +
+
\ No newline at end of file diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-mappers-add.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-mappers-add.html similarity index 80% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-mappers-add.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-mappers-add.html index 07ec62c6264..c111c3be26c 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-mappers-add.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-mappers-add.html @@ -1,14 +1,14 @@
- +
-

{{realm.realm}} Add Builtin Protocol Mappers

+

{{realm.realm}} Add Builtin Protocol Mappers

diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-mappers.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-mappers.html similarity index 65% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-mappers.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-mappers.html index c9c14fede42..343a6225255 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-mappers.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-mappers.html @@ -1,13 +1,13 @@
- +
-

{{realm.realm}} {{application.name}} {{application.protocol}} Protocol Mappers

+

{{realm.realm}} {{client.clientId}} {{client.protocol}} Protocol Mappers

@@ -21,8 +21,8 @@ @@ -34,7 +34,7 @@ - + diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-revocation.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-revocation.html similarity index 71% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-revocation.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-revocation.html index cfd17cd741b..22087c23bad 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-revocation.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-revocation.html @@ -1,13 +1,13 @@
- +
-

{{application.name}} Revocation Policies

+

{{client.clientId}} Revocation Policies

@@ -15,7 +15,7 @@
- +
@@ -23,7 +23,7 @@ -
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-role-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-role-detail.html similarity index 72% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-role-detail.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-role-detail.html index 9729b945a0f..d57ab3f99ba 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-role-detail.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-role-detail.html @@ -1,23 +1,23 @@
- +
-

{{application.name}} {{role.name}} Application Role

-

{{application.name}} Add Application Role

+

{{client.clientId}} {{role.name}} Client Role

+

{{client.clientId}} Add Client Role

* Required fields

@@ -81,45 +81,45 @@
-
- Composite Application Roles +
+ Composite Client Roles
- +
- +
-
-
+
+
- - + ng-model="selectedClientRoles" + ng-options="r.name for r in clientRoles">
- -
- - + ng-model="selectedClientMappings" + ng-options="r.name for r in clientMappings">
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-role-list.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-role-list.html similarity index 79% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-role-list.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-role-list.html index b2dc8508583..f996169d89d 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-role-list.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-role-list.html @@ -1,20 +1,20 @@
- +
-

{{application.name}} Application Roles

+

{{client.clientId}} Client Roles

{{mapper.name}}{{mapper.name}} {{mapperTypes[mapper.protocolMapper].category}} {{mapperTypes[mapper.protocolMapper].name}}
@@ -52,12 +52,12 @@ --> - + - +
{{role.name}}{{role.name}} {{role.composite}} {{role.description}}
No application roles availableNo client roles available
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-saml-key-export.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-saml-key-export.html similarity index 85% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-saml-key-export.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-saml-key-export.html index 24316120602..1f29c0543ea 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-saml-key-export.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-saml-key-export.html @@ -1,14 +1,14 @@
- +
-

{{application.name}} SAML {{keyType}} Key Export

+

{{client.clientId}} SAML {{keyType}} Key Export

diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-saml-key-import.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-saml-key-import.html similarity index 85% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-saml-key-import.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-saml-key-import.html index 63e5a968d73..3a26937fd76 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-saml-key-import.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-saml-key-import.html @@ -1,14 +1,14 @@
- +
-

{{application.name}} SAML {{keyType}} Key Import

+

{{client.clientId}} SAML {{keyType}} Key Import

diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-saml-keys.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-saml-keys.html similarity index 86% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-saml-keys.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-saml-keys.html index 5d9ba63782f..206ce66366d 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-saml-keys.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-saml-keys.html @@ -1,15 +1,15 @@
- +
-

{{application.name}} SAML Keys

+

{{client.clientId}} SAML Keys

-
+
Signing Key
@@ -35,7 +35,7 @@
-
+
Encryption Key
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-scope-mappings.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-scope-mappings.html similarity index 66% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-scope-mappings.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-scope-mappings.html index ce693c1e3b3..6339f4efc79 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-scope-mappings.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-scope-mappings.html @@ -1,28 +1,28 @@
- +
-

{{application.name}} Scope Mappings

+

{{client.clientId}} Scope Mappings

- +
-
+
Realm Roles
@@ -66,56 +66,56 @@
-
- Application Roles +
+ Client Roles
- +
- +
-
+
- - + ng-model="selectedClientRoles" + ng-options="r.name for r in clientRoles">
- -
- - + ng-model="selectedClientMappings" + ng-options="r.name for r in clientMappings">
-
- - + ng-options="r.name for r in clientComposite">
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-sessions.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-sessions.html similarity index 78% rename from forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-sessions.html rename to forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-sessions.html index 3284c3ac5f6..2df97f6108d 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/application-sessions.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/client-sessions.html @@ -1,13 +1,13 @@
- +
-

{{application.name}} Active Sessions

+

{{client.clientId}} Active Sessions

@@ -15,7 +15,7 @@
- +
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/protocol-mapper-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/protocol-mapper-detail.html index aed7f506c65..03a52bb85ea 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/protocol-mapper-detail.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/protocol-mapper-detail.html @@ -1,18 +1,18 @@
- +

{{mapper.name}} Protocol Mapper

diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-cache-settings.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-cache-settings.html index 2567173017d..e4a134c17d6 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-cache-settings.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-cache-settings.html @@ -12,7 +12,7 @@
- +
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-default-roles.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-default-roles.html index d2207f732d8..f03349ea820 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-default-roles.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-default-roles.html @@ -40,45 +40,45 @@
-
- Application Default Roles +
+ Client Default Roles
- +
- +
-
+
- - + ng-model="selectedClientRoles" + ng-options="r for r in availableClientRoles">
- -
- - + ng-model="selectedClientDefRoles" + ng-options="r for r in client.defaultRoles">
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html index 80f8e13a7d0..ae5b53a0a55 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html @@ -17,7 +17,7 @@
- +
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-oidc.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-oidc.html index d093744fe1c..67b0a68fe12 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-oidc.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-oidc.html @@ -98,7 +98,7 @@
- +
@@ -108,7 +108,7 @@ Show Secret Hide Secret
- +
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html index 809984bcfe7..dd0709392ad 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html @@ -25,7 +25,7 @@
- +
@@ -35,7 +35,7 @@ Show Secret Hide Secret
- +
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-stackoverflow-ext.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-stackoverflow-ext.html index 86516dfaaa9..07a0e604e18 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-stackoverflow-ext.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-stackoverflow-ext.html @@ -3,5 +3,5 @@
- +
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-menu.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-menu.html index 00d2e31b3b5..4c60b0271b7 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-menu.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-menu.html @@ -4,12 +4,12 @@ || path[2] == 'login-settings' || path[2] == 'theme-settings' || path[2] == 'cache-settings' - || path[2] == 'keys-settings' || path[2] == 'smtp-settings' || path[2] == 'ldap-settings' || path[2] == 'auth-settings') && path[3] != 'applications') && 'active'"> + || path[2] == 'keys-settings' || path[2] == 'smtp-settings' || path[2] == 'ldap-settings' || path[2] == 'auth-settings') && path[3] != 'clients') && 'active'"> Settings
  • Users
  • -
  • Clients
  • -
  • Roles
  • +
  • Clients
  • +
  • Roles
  • Sessions and Tokens
  • Security Defenses
  • Events
  • diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-tokens.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-tokens.html index 2f30127aef2..eb519ee9b32 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-tokens.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-tokens.html @@ -90,8 +90,7 @@
    - -
    +
    diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-detail.html index d5be190d096..412c8a09bad 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-detail.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-detail.html @@ -74,45 +74,45 @@
    -
    - Composite Application Roles +
    + Composite Client Roles
    -
    -
    +
    - - + ng-model="selectedClientRoles" + ng-options="r.name for r in clientRoles">
    - -
    - - + ng-model="selectedClientMappings" + ng-options="r.name for r in clientMappings">
    diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html index 0ae08be3747..314212bd29a 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html @@ -63,56 +63,56 @@
    -
    - Application Roles +
    + Client Roles
    - +
    - +
    -
    +
    - - + ng-model="selectedClientRoles" + ng-options="r.name for r in clientRoles">
    - -
    - - + ng-model="selectedClientMappings" + ng-options="r.name for r in clientMappings">
    -
    - - + ng-options="r.name for r in clientComposite">
    diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/session-realm.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/session-realm.html index 1394703e15d..2535b46f263 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/session-realm.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/session-realm.html @@ -18,13 +18,13 @@ - Application + Client Active Sessions - {{data.name}} + {{data.clientId}} {{data.active}} diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/session-revocation.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/session-revocation.html index 79007bc1dc1..f84c5ae914d 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/session-revocation.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/session-revocation.html @@ -23,7 +23,7 @@ -
    diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-sessions.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-sessions.html index f3de7e404df..9db3f7de09b 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-sessions.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-sessions.html @@ -27,8 +27,7 @@ IP Address Started Last Access - Applications - OAuth Clients + Clients Action @@ -38,16 +37,11 @@ {{session.start | date:'medium'}} {{session.lastAccess | date:'medium'}} -
    - {{name}} + - - - logout diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/templates/kc-navigation-application.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/templates/kc-navigation-application.html deleted file mode 100755 index 49949d9c60d..00000000000 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/templates/kc-navigation-application.html +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/templates/kc-navigation-client.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/templates/kc-navigation-client.html new file mode 100755 index 00000000000..9794e388f3d --- /dev/null +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/templates/kc-navigation-client.html @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/integration/adapter-core/src/main/java/org/keycloak/adapters/ServerRequest.java b/integration/adapter-core/src/main/java/org/keycloak/adapters/ServerRequest.java index 27a29495200..701dc097f45 100755 --- a/integration/adapter-core/src/main/java/org/keycloak/adapters/ServerRequest.java +++ b/integration/adapter-core/src/main/java/org/keycloak/adapters/ServerRequest.java @@ -102,8 +102,8 @@ public class ServerRequest { formparams.add(new BasicNameValuePair(OAuth2Constants.CODE, code)); formparams.add(new BasicNameValuePair(OAuth2Constants.REDIRECT_URI, redirectUri)); if (sessionId != null) { - formparams.add(new BasicNameValuePair(AdapterConstants.APPLICATION_SESSION_STATE, sessionId)); - formparams.add(new BasicNameValuePair(AdapterConstants.APPLICATION_SESSION_HOST, HostUtils.getHostName())); + formparams.add(new BasicNameValuePair(AdapterConstants.CLIENT_SESSION_STATE, sessionId)); + formparams.add(new BasicNameValuePair(AdapterConstants.CLIENT_SESSION_HOST, HostUtils.getHostName())); } HttpResponse response = null; HttpPost post = new HttpPost(tokenUrl); @@ -237,7 +237,7 @@ public class ServerRequest { } List formparams = new ArrayList(); - formparams.add(new BasicNameValuePair(AdapterConstants.APPLICATION_CLUSTER_HOST, host)); + formparams.add(new BasicNameValuePair(AdapterConstants.CLIENT_CLUSTER_HOST, host)); HttpPost post = new HttpPost(endpointUrl); 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 ad0c51e14cf..9cc51f375cd 100755 --- a/model/api/src/main/java/org/keycloak/models/ClientModel.java +++ b/model/api/src/main/java/org/keycloak/models/ClientModel.java @@ -62,7 +62,7 @@ public interface ClientModel extends RoleContainerModel { void updateDefaultRoles(String[] defaultRoles); - Set getApplicationScopeMappings(ClientModel client); + Set getClientScopeMappings(ClientModel client); boolean isBearerOnly(); void setBearerOnly(boolean only); 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 7374d7bc5b0..edba3e32849 100755 --- a/model/api/src/main/java/org/keycloak/models/Constants.java +++ b/model/api/src/main/java/org/keycloak/models/Constants.java @@ -5,9 +5,9 @@ package org.keycloak.models; * @version $Revision: 1 $ */ public interface Constants { - String ADMIN_CONSOLE_APPLICATION = "security-admin-console"; + String ADMIN_CONSOLE_CLIENT_ID = "security-admin-console"; - String ACCOUNT_MANAGEMENT_APP = "account"; + String ACCOUNT_MANAGEMENT_CLIENT_ID = "account"; String INSTALLED_APP_URN = "urn:ietf:wg:oauth:2.0:oob"; String INSTALLED_APP_URL = "http://localhost"; diff --git a/model/api/src/main/java/org/keycloak/models/RealmModel.java b/model/api/src/main/java/org/keycloak/models/RealmModel.java index 0272500d2c9..17c88ea76e7 100755 --- a/model/api/src/main/java/org/keycloak/models/RealmModel.java +++ b/model/api/src/main/java/org/keycloak/models/RealmModel.java @@ -232,9 +232,9 @@ public interface RealmModel extends RoleContainerModel { void setEnabledEventTypes(Set enabledEventTypes); - ClientModel getMasterAdminApp(); + ClientModel getMasterAdminClient(); - void setMasterAdminApp(ClientModel app); + void setMasterAdminClient(ClientModel client); boolean isIdentityFederationEnabled(); diff --git a/model/api/src/main/java/org/keycloak/models/UserModel.java b/model/api/src/main/java/org/keycloak/models/UserModel.java index 9055e7c4c17..770cf03a8aa 100755 --- a/model/api/src/main/java/org/keycloak/models/UserModel.java +++ b/model/api/src/main/java/org/keycloak/models/UserModel.java @@ -66,7 +66,7 @@ public interface UserModel { void updateCredentialDirectly(UserCredentialValueModel cred); Set getRealmRoleMappings(); - Set getApplicationRoleMappings(ClientModel app); + Set getClientRoleMappings(ClientModel app); boolean hasRole(RoleModel role); void grantRole(RoleModel role); Set getRoleMappings(); 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 c8a976100a0..ae26387baba 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 @@ -533,7 +533,7 @@ public class RepresentationToModel { if (resourceRep.isFullScopeAllowed() != null) { client.setFullScopeAllowed(resourceRep.isFullScopeAllowed()); } else { - client.setFullScopeAllowed(true); + client.setFullScopeAllowed(!client.isConsentRequired()); } if (resourceRep.getNodeReRegistrationTimeout() != null) { client.setNodeReRegistrationTimeout(resourceRep.getNodeReRegistrationTimeout()); diff --git a/model/api/src/main/java/org/keycloak/models/utils/UserModelDelegate.java b/model/api/src/main/java/org/keycloak/models/utils/UserModelDelegate.java index 40665e36cc5..0e84ca9ca4e 100755 --- a/model/api/src/main/java/org/keycloak/models/utils/UserModelDelegate.java +++ b/model/api/src/main/java/org/keycloak/models/utils/UserModelDelegate.java @@ -152,8 +152,8 @@ public class UserModelDelegate implements UserModel { } @Override - public Set getApplicationRoleMappings(ClientModel app) { - return delegate.getApplicationRoleMappings(app); + public Set getClientRoleMappings(ClientModel app) { + return delegate.getClientRoleMappings(app); } @Override 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 85d9efc9a0f..e40d25182cb 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 @@ -565,7 +565,7 @@ public class ClientAdapter implements ClientModel { } @Override - public Set getApplicationScopeMappings(ClientModel client) { + public Set getClientScopeMappings(ClientModel client) { Set allScopes = client.getScopeMappings(); Set appRoles = new HashSet(); diff --git a/model/file/src/main/java/org/keycloak/models/file/adapter/RealmAdapter.java b/model/file/src/main/java/org/keycloak/models/file/adapter/RealmAdapter.java index 57e1620bfc2..31b4bfc869c 100755 --- a/model/file/src/main/java/org/keycloak/models/file/adapter/RealmAdapter.java +++ b/model/file/src/main/java/org/keycloak/models/file/adapter/RealmAdapter.java @@ -959,22 +959,22 @@ public class RealmAdapter implements RealmModel { } @Override - public ClientModel getMasterAdminApp() { + public ClientModel getMasterAdminClient() { return this.masterAdminApp; } @Override - public void setMasterAdminApp(ClientModel app) { - if (app == null) { + public void setMasterAdminClient(ClientModel client) { + if (client == null) { realm.setAdminAppId(null); this.masterAdminApp = null; } else { - String appId = app.getId(); + String appId = client.getId(); if (appId == null) { throw new IllegalStateException("Master Admin app not initialized."); } realm.setAdminAppId(appId); - this.masterAdminApp = app; + this.masterAdminApp = client; } } diff --git a/model/file/src/main/java/org/keycloak/models/file/adapter/UserAdapter.java b/model/file/src/main/java/org/keycloak/models/file/adapter/UserAdapter.java index 00b6af8403c..e9ba84ab01d 100755 --- a/model/file/src/main/java/org/keycloak/models/file/adapter/UserAdapter.java +++ b/model/file/src/main/java/org/keycloak/models/file/adapter/UserAdapter.java @@ -325,7 +325,7 @@ public class UserAdapter implements UserModel, Comparable { } @Override - public Set getApplicationRoleMappings(ClientModel app) { + public Set getClientRoleMappings(ClientModel app) { Set result = new HashSet(); for (RoleModel role : allRoles) { 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 0dc490d12c3..42d41538dbb 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 @@ -377,7 +377,7 @@ public class ClientAdapter implements ClientModel { } @Override - public Set getApplicationScopeMappings(ClientModel client) { + public Set getClientScopeMappings(ClientModel client) { Set roleMappings = client.getScopeMappings(); Set appRoles = new HashSet(); diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/RealmAdapter.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/RealmAdapter.java index 1e51a0cee1c..f2532af4b3e 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/RealmAdapter.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/RealmAdapter.java @@ -11,7 +11,6 @@ import org.keycloak.models.RequiredCredentialModel; import org.keycloak.models.RoleModel; import org.keycloak.models.UserFederationProviderModel; import org.keycloak.models.cache.entities.CachedRealm; -import org.keycloak.models.entities.IdentityProviderMapperEntity; import org.keycloak.models.utils.KeycloakModelUtils; import java.security.Key; @@ -752,14 +751,14 @@ public class RealmAdapter implements RealmModel { } @Override - public ClientModel getMasterAdminApp() { + public ClientModel getMasterAdminClient() { return cacheSession.getRealm(Config.getAdminRealm()).getClientById(cached.getMasterAdminApp()); } @Override - public void setMasterAdminApp(ClientModel app) { + public void setMasterAdminClient(ClientModel client) { getDelegateForUpdate(); - updated.setMasterAdminApp(app); + updated.setMasterAdminClient(client); } @Override diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/UserAdapter.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/UserAdapter.java index e65983769df..2087fc20ea7 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/UserAdapter.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/UserAdapter.java @@ -219,8 +219,8 @@ public class UserAdapter implements UserModel { } @Override - public Set getApplicationRoleMappings(ClientModel app) { - if (updated != null) return updated.getApplicationRoleMappings(app); + public Set getClientRoleMappings(ClientModel app) { + if (updated != null) return updated.getClientRoleMappings(app); Set roleMappings = getRoleMappings(); Set appMappings = new HashSet(); for (RoleModel role : roleMappings) { diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java index baafe4346e0..d302c48979d 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java @@ -155,7 +155,7 @@ public class CachedRealm { eventsListeners.addAll(model.getEventsListeners()); enabledEventTypes.addAll(model.getEnabledEventTypes()); defaultRoles.addAll(model.getDefaultRoles()); - masterAdminApp = model.getMasterAdminApp().getId(); + masterAdminApp = model.getMasterAdminClient().getId(); for (RoleModel role : model.getRoles()) { realmRoles.put(role.getName(), role.getId()); 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 0bf53efaca6..90e83f4c89c 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 @@ -625,7 +625,7 @@ public class ClientAdapter implements ClientModel { } @Override - public Set getApplicationScopeMappings(ClientModel client) { + public Set getClientScopeMappings(ClientModel client) { Set roleMappings = client.getScopeMappings(); Set appRoles = new HashSet(); 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 2df2bf2b517..4370165ff5e 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 @@ -1065,13 +1065,13 @@ public class RealmAdapter implements RealmModel { } @Override - public ClientModel getMasterAdminApp() { + public ClientModel getMasterAdminClient() { return new ClientAdapter(this, em, session, realm.getMasterAdminApp()); } @Override - public void setMasterAdminApp(ClientModel app) { - ClientEntity appEntity = app!=null ? em.getReference(ClientEntity.class, app.getId()) : null; + public void setMasterAdminClient(ClientModel client) { + ClientEntity appEntity = client !=null ? em.getReference(ClientEntity.class, client.getId()) : null; realm.setMasterAdminApp(appEntity); em.flush(); } 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 c0263ed700b..a51d0de21be 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 @@ -363,7 +363,7 @@ public class UserAdapter implements UserModel { } @Override - public Set getApplicationRoleMappings(ClientModel app) { + public Set getClientRoleMappings(ClientModel app) { Set roleMappings = getRoleMappings(); Set roles = new HashSet(); 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 0867ce10b8d..a2e1fa04d2e 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 @@ -575,7 +575,7 @@ public class ClientAdapter extends AbstractMongoAdapter imple } @Override - public Set getApplicationScopeMappings(ClientModel client) { + public Set getClientScopeMappings(ClientModel client) { Set result = new HashSet(); List roles = MongoModelUtils.getAllScopesOfClient(client, invocationContext); diff --git a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java index 64b5c41c8cb..d7a534a9a5a 100755 --- a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java +++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java @@ -978,14 +978,14 @@ public class RealmAdapter extends AbstractMongoAdapter impleme } @Override - public ClientModel getMasterAdminApp() { + public ClientModel getMasterAdminClient() { MongoClientEntity appData = getMongoStore().loadEntity(MongoClientEntity.class, realm.getAdminAppId(), invocationContext); return appData != null ? new ClientAdapter(session, this, appData, invocationContext) : null; } @Override - public void setMasterAdminApp(ClientModel app) { - String adminAppId = app != null ? app.getId() : null; + public void setMasterAdminClient(ClientModel client) { + String adminAppId = client != null ? client.getId() : null; realm.setAdminAppId(adminAppId); updateRealm(); } diff --git a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/UserAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/UserAdapter.java index 6e7994abaa0..874f7d8159a 100755 --- a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/UserAdapter.java +++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/UserAdapter.java @@ -316,7 +316,7 @@ public class UserAdapter extends AbstractMongoAdapter implement } @Override - public Set getApplicationRoleMappings(ClientModel app) { + public Set getClientRoleMappings(ClientModel app) { Set result = new HashSet(); List roles = MongoModelUtils.getAllRolesOfUser(this, invocationContext); diff --git a/saml/saml-protocol/src/main/java/org/keycloak/protocol/saml/EntityDescriptorImporter.java b/saml/saml-protocol/src/main/java/org/keycloak/protocol/saml/EntityDescriptorImporter.java index 32f0990d6c2..1ad72bfd394 100755 --- a/saml/saml-protocol/src/main/java/org/keycloak/protocol/saml/EntityDescriptorImporter.java +++ b/saml/saml-protocol/src/main/java/org/keycloak/protocol/saml/EntityDescriptorImporter.java @@ -1,6 +1,6 @@ package org.keycloak.protocol.saml; -import org.keycloak.exportimport.ApplicationImporter; +import org.keycloak.exportimport.ClientImporter; import org.keycloak.models.RealmModel; import org.keycloak.services.resources.admin.RealmAuth; @@ -8,7 +8,7 @@ import org.keycloak.services.resources.admin.RealmAuth; * @author Bill Burke * @version $Revision: 1 $ */ -public class EntityDescriptorImporter implements ApplicationImporter { +public class EntityDescriptorImporter implements ClientImporter { @Override public Object createJaxrsService(RealmModel realm, RealmAuth auth) { return new EntityDescriptorImporterService(realm, auth); diff --git a/saml/saml-protocol/src/main/java/org/keycloak/protocol/saml/EntityDescriptorImporterFactory.java b/saml/saml-protocol/src/main/java/org/keycloak/protocol/saml/EntityDescriptorImporterFactory.java index 51644d904a0..14af68569d8 100755 --- a/saml/saml-protocol/src/main/java/org/keycloak/protocol/saml/EntityDescriptorImporterFactory.java +++ b/saml/saml-protocol/src/main/java/org/keycloak/protocol/saml/EntityDescriptorImporterFactory.java @@ -1,8 +1,8 @@ package org.keycloak.protocol.saml; import org.keycloak.Config; -import org.keycloak.exportimport.ApplicationImporter; -import org.keycloak.exportimport.ApplicationImporterFactory; +import org.keycloak.exportimport.ClientImporter; +import org.keycloak.exportimport.ClientImporterFactory; import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSessionFactory; @@ -10,14 +10,14 @@ import org.keycloak.models.KeycloakSessionFactory; * @author Bill Burke * @version $Revision: 1 $ */ -public class EntityDescriptorImporterFactory implements ApplicationImporterFactory { +public class EntityDescriptorImporterFactory implements ClientImporterFactory { @Override public String getDisplayName() { return "SAML 2.0 Entity Descriptor"; } @Override - public ApplicationImporter create(KeycloakSession session) { + public ClientImporter create(KeycloakSession session) { return new EntityDescriptorImporter(); } diff --git a/saml/saml-protocol/src/main/resources/META-INF/services/org.keycloak.exportimport.ApplicationImporterFactory b/saml/saml-protocol/src/main/resources/META-INF/services/org.keycloak.exportimport.ClientImporterFactory similarity index 100% rename from saml/saml-protocol/src/main/resources/META-INF/services/org.keycloak.exportimport.ApplicationImporterFactory rename to saml/saml-protocol/src/main/resources/META-INF/services/org.keycloak.exportimport.ClientImporterFactory diff --git a/services/src/main/java/org/keycloak/exportimport/ApplicationImportSpi.java b/services/src/main/java/org/keycloak/exportimport/ClientImportSpi.java similarity index 71% rename from services/src/main/java/org/keycloak/exportimport/ApplicationImportSpi.java rename to services/src/main/java/org/keycloak/exportimport/ClientImportSpi.java index 4493b19e22b..6fe071e5368 100755 --- a/services/src/main/java/org/keycloak/exportimport/ApplicationImportSpi.java +++ b/services/src/main/java/org/keycloak/exportimport/ClientImportSpi.java @@ -7,20 +7,20 @@ import org.keycloak.provider.Spi; /** * @author Marek Posolda */ -public class ApplicationImportSpi implements Spi { +public class ClientImportSpi implements Spi { @Override public String getName() { - return "application-import"; + return "client-import"; } @Override public Class getProviderClass() { - return ApplicationImporter.class; + return ClientImporter.class; } @Override public Class getProviderFactoryClass() { - return ApplicationImporterFactory.class; + return ClientImporterFactory.class; } } diff --git a/services/src/main/java/org/keycloak/exportimport/ApplicationImporter.java b/services/src/main/java/org/keycloak/exportimport/ClientImporter.java similarity index 67% rename from services/src/main/java/org/keycloak/exportimport/ApplicationImporter.java rename to services/src/main/java/org/keycloak/exportimport/ClientImporter.java index f4c526ef403..3d236fb16ef 100755 --- a/services/src/main/java/org/keycloak/exportimport/ApplicationImporter.java +++ b/services/src/main/java/org/keycloak/exportimport/ClientImporter.java @@ -5,11 +5,11 @@ import org.keycloak.provider.Provider; import org.keycloak.services.resources.admin.RealmAuth; /** - * Provider plugin interface for importing applications from an arbitrary configuration format + * Provider plugin interface for importing clients from an arbitrary configuration format * * @author Bill Burke * @version $Revision: 1 $ */ -public interface ApplicationImporter extends Provider { +public interface ClientImporter extends Provider { public Object createJaxrsService(RealmModel realm, RealmAuth auth); } diff --git a/services/src/main/java/org/keycloak/exportimport/ApplicationImporterFactory.java b/services/src/main/java/org/keycloak/exportimport/ClientImporterFactory.java similarity index 52% rename from services/src/main/java/org/keycloak/exportimport/ApplicationImporterFactory.java rename to services/src/main/java/org/keycloak/exportimport/ClientImporterFactory.java index b73e2e68c37..e70bbfaea4c 100755 --- a/services/src/main/java/org/keycloak/exportimport/ApplicationImporterFactory.java +++ b/services/src/main/java/org/keycloak/exportimport/ClientImporterFactory.java @@ -3,11 +3,11 @@ package org.keycloak.exportimport; import org.keycloak.provider.ProviderFactory; /** - * Provider plugin interface for importing applications from an arbitrary configuration format + * Provider plugin interface for importing clients from an arbitrary configuration format * * @author Bill Burke * @version $Revision: 1 $ */ -public interface ApplicationImporterFactory extends ProviderFactory { +public interface ClientImporterFactory extends ProviderFactory { public String getDisplayName(); } diff --git a/services/src/main/java/org/keycloak/protocol/oidc/TokenManager.java b/services/src/main/java/org/keycloak/protocol/oidc/TokenManager.java index 6a27c5580bc..8d9ab8c7ea7 100755 --- a/services/src/main/java/org/keycloak/protocol/oidc/TokenManager.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/TokenManager.java @@ -260,12 +260,12 @@ public class TokenManager { for (Map.Entry entry : token.getResourceAccess().entrySet()) { AccessToken.Access appAccess = newToken.getResourceAccess(entry.getKey()); if (appAccess == null && !entry.getValue().getRoles().isEmpty()) { - throw new OAuthErrorException(OAuthErrorException.INVALID_SCOPE, "User or application no longer has role permissions for application key: " + entry.getKey()); + throw new OAuthErrorException(OAuthErrorException.INVALID_SCOPE, "User or client no longer has role permissions for client key: " + entry.getKey()); } for (String roleName : entry.getValue().getRoles()) { if (!appAccess.getRoles().contains(roleName)) { - throw new OAuthErrorException(OAuthErrorException.INVALID_SCOPE, "User no long has permission for application role " + roleName); + throw new OAuthErrorException(OAuthErrorException.INVALID_SCOPE, "User no long has permission for client role " + roleName); } } } diff --git a/services/src/main/java/org/keycloak/protocol/oidc/endpoints/LogoutEndpoint.java b/services/src/main/java/org/keycloak/protocol/oidc/endpoints/LogoutEndpoint.java index 582de3825fc..5bab0e0d11e 100755 --- a/services/src/main/java/org/keycloak/protocol/oidc/endpoints/LogoutEndpoint.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/endpoints/LogoutEndpoint.java @@ -145,9 +145,9 @@ public class LogoutEndpoint { * authenticate the client if it is not public. * * If the client is a confidential client - * you must include the client-id (application name or oauth client name) and secret in an Basic Auth Authorization header. + * you must include the client-id and secret in an Basic Auth Authorization header. * - * If the client is a public client, then you must include a "client_id" form parameter with the app's or oauth client's name. + * If the client is a public client, then you must include a "client_id" form parameter. * * returns 204 if successful, 400 if not with a json error response. * diff --git a/services/src/main/java/org/keycloak/protocol/oidc/endpoints/TokenEndpoint.java b/services/src/main/java/org/keycloak/protocol/oidc/endpoints/TokenEndpoint.java index 331dbec7a7c..60b1b98db64 100755 --- a/services/src/main/java/org/keycloak/protocol/oidc/endpoints/TokenEndpoint.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/endpoints/TokenEndpoint.java @@ -231,15 +231,15 @@ public class TokenEndpoint { throw new ErrorResponseException("invalid_grant", "Session not active", Response.Status.BAD_REQUEST); } - String adapterSessionId = formParams.getFirst(AdapterConstants.APPLICATION_SESSION_STATE); + String adapterSessionId = formParams.getFirst(AdapterConstants.CLIENT_SESSION_STATE); if (adapterSessionId != null) { - String adapterSessionHost = formParams.getFirst(AdapterConstants.APPLICATION_SESSION_HOST); + String adapterSessionHost = formParams.getFirst(AdapterConstants.CLIENT_SESSION_HOST); logger.debugf("Adapter Session '%s' saved in ClientSession for client '%s'. Host is '%s'", adapterSessionId, client.getClientId(), adapterSessionHost); - event.detail(AdapterConstants.APPLICATION_SESSION_STATE, adapterSessionId); - clientSession.setNote(AdapterConstants.APPLICATION_SESSION_STATE, adapterSessionId); - event.detail(AdapterConstants.APPLICATION_SESSION_HOST, adapterSessionHost); - clientSession.setNote(AdapterConstants.APPLICATION_SESSION_HOST, adapterSessionHost); + event.detail(AdapterConstants.CLIENT_SESSION_STATE, adapterSessionId); + clientSession.setNote(AdapterConstants.CLIENT_SESSION_STATE, adapterSessionId); + event.detail(AdapterConstants.CLIENT_SESSION_HOST, adapterSessionHost); + clientSession.setNote(AdapterConstants.CLIENT_SESSION_HOST, adapterSessionHost); } AccessToken token = tokenManager.createClientAccessToken(session, accessCode.getRequestedRoles(), realm, client, user, userSession, clientSession); diff --git a/services/src/main/java/org/keycloak/protocol/oidc/endpoints/ValidateTokenEndpoint.java b/services/src/main/java/org/keycloak/protocol/oidc/endpoints/ValidateTokenEndpoint.java index 31499d1bd13..249aa30ddb0 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc/endpoints/ValidateTokenEndpoint.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/endpoints/ValidateTokenEndpoint.java @@ -88,7 +88,7 @@ public class ValidateTokenEndpoint { error.put(OAuth2Constants.ERROR, e.getError()); if (e.getDescription() != null) error.put(OAuth2Constants.ERROR_DESCRIPTION, e.getDescription()); event.error(Errors.INVALID_TOKEN); - return Response.status(Response.Status.BAD_REQUEST).entity(error).type("application/json").build(); + return Response.status(Response.Status.BAD_REQUEST).entity(error).type(MediaType.APPLICATION_JSON_TYPE).build(); } event.success(); diff --git a/services/src/main/java/org/keycloak/protocol/oidc/mappers/HardcodedRole.java b/services/src/main/java/org/keycloak/protocol/oidc/mappers/HardcodedRole.java index 088389fbecb..4bed115f056 100755 --- a/services/src/main/java/org/keycloak/protocol/oidc/mappers/HardcodedRole.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/mappers/HardcodedRole.java @@ -30,7 +30,7 @@ public class HardcodedRole extends AbstractOIDCProtocolMapper implements OIDCAcc property = new ConfigProperty(); property.setName(ROLE_CONFIG); property.setLabel("Role"); - property.setHelpText("Role you want added to the token. To specify an application role the syntax is appname.approle, i.e. myapp.myrole"); + property.setHelpText("Role you want added to the token. To specify a client role the syntax is clientId.clientRole, i.e. myapp.myrole"); property.setType(ConfigProperty.STRING_TYPE); configProperties.add(property); } diff --git a/services/src/main/java/org/keycloak/protocol/oidc/mappers/RoleNameMapper.java b/services/src/main/java/org/keycloak/protocol/oidc/mappers/RoleNameMapper.java index 1e5784cce75..14c68d67ccd 100755 --- a/services/src/main/java/org/keycloak/protocol/oidc/mappers/RoleNameMapper.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/mappers/RoleNameMapper.java @@ -33,7 +33,7 @@ public class RoleNameMapper extends AbstractOIDCProtocolMapper implements OIDCAc property = new ConfigProperty(); property.setName(ROLE_CONFIG); property.setLabel("Role"); - property.setHelpText("Role name you want changed. To reference an application role the syntax is appname.approle, i.e. myapp.myrole"); + property.setHelpText("Role name you want changed. To reference an client role the syntax is clientId.clientRole, i.e. myapp.myrole"); property.setType(ConfigProperty.STRING_TYPE); configProperties.add(property); property = new ConfigProperty(); diff --git a/services/src/main/java/org/keycloak/protocol/oidc/utils/AuthorizeClientUtil.java b/services/src/main/java/org/keycloak/protocol/oidc/utils/AuthorizeClientUtil.java index 4b97c972998..a8a9e2a4951 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc/utils/AuthorizeClientUtil.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/utils/AuthorizeClientUtil.java @@ -10,6 +10,7 @@ import org.keycloak.models.RealmModel; import org.keycloak.util.BasicAuthHelper; import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import java.util.HashMap; @@ -39,7 +40,7 @@ public class AuthorizeClientUtil { Map error = new HashMap(); error.put(OAuth2Constants.ERROR, "invalid_client"); error.put(OAuth2Constants.ERROR_DESCRIPTION, "Could not find client"); - throw new BadRequestException("Could not find client", Response.status(Response.Status.BAD_REQUEST).entity(error).type("application/json").build()); + throw new BadRequestException("Could not find client", Response.status(Response.Status.BAD_REQUEST).entity(error).type(MediaType.APPLICATION_JSON_TYPE).build()); } event.client(client_id); @@ -50,7 +51,7 @@ public class AuthorizeClientUtil { error.put(OAuth2Constants.ERROR, "invalid_client"); error.put(OAuth2Constants.ERROR_DESCRIPTION, "Could not find client"); event.error(Errors.CLIENT_NOT_FOUND); - throw new BadRequestException("Could not find client", Response.status(Response.Status.BAD_REQUEST).entity(error).type("application/json").build()); + throw new BadRequestException("Could not find client", Response.status(Response.Status.BAD_REQUEST).entity(error).type(MediaType.APPLICATION_JSON_TYPE).build()); } if (!client.isEnabled()) { @@ -58,7 +59,7 @@ public class AuthorizeClientUtil { error.put(OAuth2Constants.ERROR, "invalid_client"); error.put(OAuth2Constants.ERROR_DESCRIPTION, "Client is not enabled"); event.error(Errors.CLIENT_DISABLED); - throw new BadRequestException("Client is not enabled", Response.status(Response.Status.BAD_REQUEST).entity(error).type("application/json").build()); + throw new BadRequestException("Client is not enabled", Response.status(Response.Status.BAD_REQUEST).entity(error).type(MediaType.APPLICATION_JSON_TYPE).build()); } if (!client.isPublicClient()) { @@ -66,7 +67,7 @@ public class AuthorizeClientUtil { Map error = new HashMap(); error.put(OAuth2Constants.ERROR, "unauthorized_client"); event.error(Errors.INVALID_CLIENT_CREDENTIALS); - throw new BadRequestException("Unauthorized Client", Response.status(Response.Status.BAD_REQUEST).entity(error).type("application/json").build()); + throw new BadRequestException("Unauthorized Client", Response.status(Response.Status.BAD_REQUEST).entity(error).type(MediaType.APPLICATION_JSON_TYPE).build()); } } diff --git a/services/src/main/java/org/keycloak/services/ErrorResponseException.java b/services/src/main/java/org/keycloak/services/ErrorResponseException.java index bf9f2784298..0dd3e13b8de 100644 --- a/services/src/main/java/org/keycloak/services/ErrorResponseException.java +++ b/services/src/main/java/org/keycloak/services/ErrorResponseException.java @@ -6,6 +6,7 @@ import org.keycloak.models.RealmModel; import org.keycloak.services.resources.flows.Flows; import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.util.HashMap; @@ -33,7 +34,7 @@ public class ErrorResponseException extends WebApplicationException { if (errorDescription != null) { e.put(OAuth2Constants.ERROR_DESCRIPTION, errorDescription); } - return Response.status(status).entity(e).type("application/json").build(); + return Response.status(status).entity(e).type(MediaType.APPLICATION_JSON_TYPE).build(); } } diff --git a/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java b/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java index 3caa7139aef..8760ff01b33 100755 --- a/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java +++ b/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java @@ -71,7 +71,7 @@ public class ApplianceBootstrap { RoleModel adminRole = realm.getRole(AdminRoles.ADMIN); adminUser.grantRole(adminRole); - ClientModel accountApp = realm.getClientNameMap().get(Constants.ACCOUNT_MANAGEMENT_APP); + ClientModel accountApp = realm.getClientNameMap().get(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID); for (String r : accountApp.getDefaultRoles()) { adminUser.grantRole(accountApp.getRole(r)); } diff --git a/services/src/main/java/org/keycloak/services/managers/Auth.java b/services/src/main/java/org/keycloak/services/managers/Auth.java index ecaf0d95482..8d76e56cb61 100755 --- a/services/src/main/java/org/keycloak/services/managers/Auth.java +++ b/services/src/main/java/org/keycloak/services/managers/Auth.java @@ -80,7 +80,7 @@ public class Auth { return false; } - public boolean hasAppRole(ClientModel app, String role) { + public boolean hasClientRole(ClientModel app, String role) { if (cookie) { return user.hasRole(app.getRole(role)); } else { @@ -91,7 +91,7 @@ public class Auth { public boolean hasOneOfAppRole(ClientModel app, String... roles) { for (String r : roles) { - if (hasAppRole(app, r)) { + if (hasClientRole(app, r)) { return true; } } 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 4a03c26dbde..53b460a04c2 100755 --- a/services/src/main/java/org/keycloak/services/managers/RealmManager.java +++ b/services/src/main/java/org/keycloak/services/managers/RealmManager.java @@ -18,7 +18,7 @@ import org.keycloak.models.UserModel; import org.keycloak.models.UserSessionProvider; import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.models.utils.RepresentationToModel; -import org.keycloak.representations.idm.ApplicationRepresentation; +import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.RealmEventsConfigRepresentation; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.timer.TimerProvider; @@ -90,8 +90,8 @@ public class RealmManager { } protected void setupAdminConsole(RealmModel realm) { - ClientModel adminConsole = realm.getClientByClientId(Constants.ADMIN_CONSOLE_APPLICATION); - if (adminConsole == null) adminConsole = new ClientManager(this).createClient(realm, Constants.ADMIN_CONSOLE_APPLICATION); + ClientModel adminConsole = realm.getClientByClientId(Constants.ADMIN_CONSOLE_CLIENT_ID); + if (adminConsole == null) adminConsole = new ClientManager(this).createClient(realm, Constants.ADMIN_CONSOLE_CLIENT_ID); String baseUrl = contextPath + "/admin/" + realm.getName() + "/console"; adminConsole.setBaseUrl(baseUrl + "/index.html"); adminConsole.setEnabled(true); @@ -103,18 +103,18 @@ public class RealmManager { if (realm.getName().equals(Config.getAdminRealm())) { adminRole = realm.getRole(AdminRoles.ADMIN); } else { - String realmAdminApplicationName = getRealmAdminApplicationName(realm); - ClientModel realmAdminApp = realm.getClientByClientId(realmAdminApplicationName); + String realmAdminApplicationClientId = getRealmAdminClientId(realm); + ClientModel realmAdminApp = realm.getClientByClientId(realmAdminApplicationClientId); adminRole = realmAdminApp.getRole(AdminRoles.REALM_ADMIN); } adminConsole.addScopeMapping(adminRole); } - public String getRealmAdminApplicationName(RealmModel realm) { + public String getRealmAdminClientId(RealmModel realm) { return "realm-management"; } - public String getRealmAdminApplicationName(RealmRepresentation realm) { + public String getRealmAdminClientId(RealmRepresentation realm) { return "realm-management"; } @@ -139,7 +139,7 @@ public class RealmManager { boolean removed = model.removeRealm(realm.getId()); if (removed) { - new ClientManager(this).removeClient(getKeycloakAdminstrationRealm(), realm.getMasterAdminApp()); + new ClientManager(this).removeClient(getKeycloakAdminstrationRealm(), realm.getMasterAdminClient()); UserSessionProvider sessions = session.sessions(); if (sessions != null) { @@ -176,18 +176,18 @@ public class RealmManager { ClientManager clientManager = new ClientManager(new RealmManager(session)); - String realmAdminApplicationName = getRealmAdminApplicationName(realm); - ClientModel realmAdminApp = realm.getClientByClientId(realmAdminApplicationName); - if (realmAdminApp == null) { - realmAdminApp = clientManager.createClient(realm, realmAdminApplicationName); + String realmAdminClientId = getRealmAdminClientId(realm); + ClientModel realmAdminClient = realm.getClientByClientId(realmAdminClientId); + if (realmAdminClient == null) { + realmAdminClient = clientManager.createClient(realm, realmAdminClientId); } - RoleModel adminRole = realmAdminApp.addRole(AdminRoles.REALM_ADMIN); - adminRole.setDescription("${role_"+AdminRoles.REALM_ADMIN+"}"); - realmAdminApp.setBearerOnly(true); - realmAdminApp.setFullScopeAllowed(false); + RoleModel adminRole = realmAdminClient.addRole(AdminRoles.REALM_ADMIN); + adminRole.setDescription("${role_" + AdminRoles.REALM_ADMIN + "}"); + realmAdminClient.setBearerOnly(true); + realmAdminClient.setFullScopeAllowed(false); for (String r : AdminRoles.ALL_REALM_ROLES) { - RoleModel role = realmAdminApp.addRole(r); + RoleModel role = realmAdminClient.addRole(r); role.setDescription("${role_"+r+"}"); adminRole.addCompositeRole(role); } @@ -195,19 +195,19 @@ public class RealmManager { private void setupAccountManagement(RealmModel realm) { - ClientModel application = realm.getClientNameMap().get(Constants.ACCOUNT_MANAGEMENT_APP); - if (application == null) { - application = new ClientManager(this).createClient(realm, Constants.ACCOUNT_MANAGEMENT_APP); - application.setEnabled(true); - application.setFullScopeAllowed(false); + ClientModel client = realm.getClientNameMap().get(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID); + if (client == null) { + client = new ClientManager(this).createClient(realm, Constants.ACCOUNT_MANAGEMENT_CLIENT_ID); + client.setEnabled(true); + client.setFullScopeAllowed(false); String base = contextPath + "/realms/" + realm.getName() + "/account"; String redirectUri = base + "/*"; - application.addRedirectUri(redirectUri); - application.setBaseUrl(base); + client.addRedirectUri(redirectUri); + client.setBaseUrl(base); for (String role : AccountRoles.ALL) { - application.addDefaultRole(role); - application.getRole(role).setDescription("${role_"+role+"}"); + client.addDefaultRole(role); + client.getRole(role).setDescription("${role_"+role+"}"); } } } @@ -224,9 +224,9 @@ public class RealmManager { setupRealmDefaults(realm); setupMasterAdminManagement(realm); - if (!hasRealmAdminManagementApp(rep)) setupRealmAdminManagement(realm); - if (!hasAccountManagementApp(rep)) setupAccountManagement(realm); - if (!hasAdminConsoleApp(rep)) setupAdminConsole(realm); + if (!hasRealmAdminManagementClient(rep)) setupRealmAdminManagement(realm); + if (!hasAccountManagementClient(rep)) setupAccountManagement(realm); + if (!hasAdminConsoleClient(rep)) setupAdminConsole(realm); RepresentationToModel.importRealm(session, rep, realm); @@ -239,30 +239,30 @@ public class RealmManager { return realm; } - private boolean hasRealmAdminManagementApp(RealmRepresentation rep) { - if (rep.getApplications() == null) return false; - for (ApplicationRepresentation app : rep.getApplications()) { - if (app.getName().equals(getRealmAdminApplicationName(rep))) { + private boolean hasRealmAdminManagementClient(RealmRepresentation rep) { + if (rep.getClients() == null) return false; + for (ClientRepresentation clientRep : rep.getClients()) { + if (clientRep.getClientId().equals(getRealmAdminClientId(rep))) { return true; } } return false; } - private boolean hasAccountManagementApp(RealmRepresentation rep) { - if (rep.getApplications() == null) return false; - for (ApplicationRepresentation app : rep.getApplications()) { - if (app.getName().equals(Constants.ACCOUNT_MANAGEMENT_APP)) { + private boolean hasAccountManagementClient(RealmRepresentation rep) { + if (rep.getClients() == null) return false; + for (ClientRepresentation clientRep : rep.getClients()) { + if (clientRep.getClientId().equals(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID)) { return true; } } return false; } - private boolean hasAdminConsoleApp(RealmRepresentation rep) { - if (rep.getApplications() == null) return false; - for (ApplicationRepresentation app : rep.getApplications()) { - if (app.getName().equals(Constants.ADMIN_CONSOLE_APPLICATION)) { + private boolean hasAdminConsoleClient(RealmRepresentation rep) { + if (rep.getClients() == null) return false; + for (ClientRepresentation clientRep : rep.getClients()) { + if (clientRep.getClientId().equals(Constants.ADMIN_CONSOLE_CLIENT_ID)) { return true; } } diff --git a/services/src/main/java/org/keycloak/services/managers/ResourceAdminManager.java b/services/src/main/java/org/keycloak/services/managers/ResourceAdminManager.java index fa219d67255..ac64cbc5b00 100755 --- a/services/src/main/java/org/keycloak/services/managers/ResourceAdminManager.java +++ b/services/src/main/java/org/keycloak/services/managers/ResourceAdminManager.java @@ -42,7 +42,7 @@ import java.util.Set; */ public class ResourceAdminManager { protected static Logger logger = Logger.getLogger(ResourceAdminManager.class); - private static final String APPLICATION_SESSION_HOST_PROPERTY = "${application.session.host}"; + private static final String CLIENT_SESSION_HOST_PROPERTY = "${application.session.host}"; public static ApacheHttpClient4Executor createExecutor() { HttpClient client = new HttpClientBuilder() @@ -57,13 +57,13 @@ public class ResourceAdminManager { } - public static String getManagementUrl(URI requestUri, ClientModel application) { - String mgmtUrl = application.getManagementUrl(); + public static String getManagementUrl(URI requestUri, ClientModel client) { + String mgmtUrl = client.getManagementUrl(); if (mgmtUrl == null || mgmtUrl.equals("")) { return null; } - // this is to support relative admin urls when keycloak and applications are deployed on the same machine + // this is to support relative admin urls when keycloak and clients are deployed on the same machine String absoluteURI = ResolveRelative.resolveRelativeUri(requestUri, mgmtUrl); // this is for resolving URI like "http://${jboss.host.name}:8080/..." in order to send request to same machine and avoid request to LB in cluster environment @@ -72,13 +72,13 @@ public class ResourceAdminManager { // For non-cluster setup, return just single configured managementUrls // For cluster setup, return the management Urls corresponding to all registered cluster nodes - private List getAllManagementUrls(URI requestUri, ClientModel application) { - String baseMgmtUrl = getManagementUrl(requestUri, application); + private List getAllManagementUrls(URI requestUri, ClientModel client) { + String baseMgmtUrl = getManagementUrl(requestUri, client); if (baseMgmtUrl == null) { return Collections.emptyList(); } - Set registeredNodesHosts = new ClientManager().validateRegisteredNodes(application); + Set registeredNodesHosts = new ClientManager().validateRegisteredNodes(client); // No-cluster setup if (registeredNodesHosts.isEmpty()) { @@ -128,7 +128,7 @@ public class ResourceAdminManager { } } - public void logoutUserFromApplication(URI requestUri, RealmModel realm, ClientModel resource, UserModel user, KeycloakSession session) { + public void logoutUserFromClient(URI requestUri, RealmModel realm, ClientModel resource, UserModel user, KeycloakSession session) { ApacheHttpClient4Executor executor = createExecutor(); try { @@ -163,9 +163,9 @@ public class ResourceAdminManager { if (clientSessions != null && clientSessions.size() > 0) { adapterSessionIds = new MultivaluedHashMap(); for (ClientSessionModel clientSession : clientSessions) { - String adapterSessionId = clientSession.getNote(AdapterConstants.APPLICATION_SESSION_STATE); + String adapterSessionId = clientSession.getNote(AdapterConstants.CLIENT_SESSION_STATE); if (adapterSessionId != null) { - String host = clientSession.getNote(AdapterConstants.APPLICATION_SESSION_HOST); + String host = clientSession.getNote(AdapterConstants.CLIENT_SESSION_HOST); adapterSessionIds.add(host, adapterSessionId); } if (clientSession.getUserSession() != null) userSessions.add(clientSession.getUserSession().getId()); @@ -177,13 +177,13 @@ public class ResourceAdminManager { return false; } - if (managementUrl.contains(APPLICATION_SESSION_HOST_PROPERTY)) { + if (managementUrl.contains(CLIENT_SESSION_HOST_PROPERTY)) { boolean allPassed = true; // Send logout separately to each host (needed for single-sign-out in cluster for non-distributable apps - KEYCLOAK-748) for (Map.Entry> entry : adapterSessionIds.entrySet()) { String host = entry.getKey(); List sessionIds = entry.getValue(); - String currentHostMgmtUrl = managementUrl.replace(APPLICATION_SESSION_HOST_PROPERTY, host); + String currentHostMgmtUrl = managementUrl.replace(CLIENT_SESSION_HOST_PROPERTY, host); allPassed = sendLogoutRequest(realm, resource, sessionIds, userSessions, client, 0, currentHostMgmtUrl) && allPassed; } @@ -215,7 +215,7 @@ public class ResourceAdminManager { GlobalRequestResult finalResult = new GlobalRequestResult(); for (ClientModel resource : resources) { - GlobalRequestResult currentResult = logoutApplication(requestUri, realm, resource, executor, realm.getNotBefore()); + GlobalRequestResult currentResult = logoutClient(requestUri, realm, resource, executor, realm.getNotBefore()); finalResult.addAll(currentResult); } return finalResult; @@ -224,25 +224,25 @@ public class ResourceAdminManager { } } - public GlobalRequestResult logoutApplication(URI requestUri, RealmModel realm, ClientModel resource) { + public GlobalRequestResult logoutClient(URI requestUri, RealmModel realm, ClientModel resource) { ApacheHttpClient4Executor executor = createExecutor(); try { resource.setNotBefore(Time.currentTime()); - return logoutApplication(requestUri, realm, resource, executor, resource.getNotBefore()); + return logoutClient(requestUri, realm, resource, executor, resource.getNotBefore()); } finally { executor.getHttpClient().getConnectionManager().shutdown(); } } - protected GlobalRequestResult logoutApplication(URI requestUri, RealmModel realm, ClientModel resource, ApacheHttpClient4Executor executor, int notBefore) { + protected GlobalRequestResult logoutClient(URI requestUri, RealmModel realm, ClientModel resource, ApacheHttpClient4Executor executor, int notBefore) { List mgmtUrls = getAllManagementUrls(requestUri, resource); if (mgmtUrls.isEmpty()) { - logger.debug("No management URL or no registered cluster nodes for the application " + resource.getClientId()); + logger.debug("No management URL or no registered cluster nodes for the client " + resource.getClientId()); return new GlobalRequestResult(); } - if (logger.isDebugEnabled()) logger.debug("Send logoutApplication for URLs: " + mgmtUrls); + if (logger.isDebugEnabled()) logger.debug("Send logoutClient for URLs: " + mgmtUrls); // Propagate this to all hosts GlobalRequestResult result = new GlobalRequestResult(); @@ -265,7 +265,7 @@ public class ResourceAdminManager { try { response = request.body(MediaType.TEXT_PLAIN_TYPE, token).post(); } catch (Exception e) { - logger.warn("Logout for application '" + resource.getClientId() + "' failed", e); + logger.warn("Logout for client '" + resource.getClientId() + "' failed", e); return false; } try { @@ -282,8 +282,8 @@ public class ResourceAdminManager { try { GlobalRequestResult finalResult = new GlobalRequestResult(); - for (ClientModel application : realm.getClients()) { - GlobalRequestResult currentResult = pushRevocationPolicy(requestUri, realm, application, realm.getNotBefore(), executor); + for (ClientModel client : realm.getClients()) { + GlobalRequestResult currentResult = pushRevocationPolicy(requestUri, realm, client, realm.getNotBefore(), executor); finalResult.addAll(currentResult); } return finalResult; @@ -292,11 +292,11 @@ public class ResourceAdminManager { } } - public GlobalRequestResult pushApplicationRevocationPolicy(URI requestUri, RealmModel realm, ClientModel application) { + public GlobalRequestResult pushClientRevocationPolicy(URI requestUri, RealmModel realm, ClientModel client) { ApacheHttpClient4Executor executor = createExecutor(); try { - return pushRevocationPolicy(requestUri, realm, application, application.getNotBefore(), executor); + return pushRevocationPolicy(requestUri, realm, client, client.getNotBefore(), executor); } finally { executor.getHttpClient().getConnectionManager().shutdown(); } @@ -306,7 +306,7 @@ public class ResourceAdminManager { protected GlobalRequestResult pushRevocationPolicy(URI requestUri, RealmModel realm, ClientModel resource, int notBefore, ApacheHttpClient4Executor executor) { List mgmtUrls = getAllManagementUrls(requestUri, resource); if (mgmtUrls.isEmpty()) { - logger.debugf("No management URL or no registered cluster nodes for the application %s", resource.getClientId()); + logger.debugf("No management URL or no registered cluster nodes for the client %s", resource.getClientId()); return new GlobalRequestResult(); } @@ -345,10 +345,10 @@ public class ResourceAdminManager { } } - public GlobalRequestResult testNodesAvailability(URI requestUri, RealmModel realm, ClientModel application) { - List mgmtUrls = getAllManagementUrls(requestUri, application); + public GlobalRequestResult testNodesAvailability(URI requestUri, RealmModel realm, ClientModel client) { + List mgmtUrls = getAllManagementUrls(requestUri, client); if (mgmtUrls.isEmpty()) { - logger.debug("No management URL or no registered cluster nodes for the application " + application.getClientId()); + logger.debug("No management URL or no registered cluster nodes for the application " + client.getClientId()); return new GlobalRequestResult(); } @@ -360,7 +360,7 @@ public class ResourceAdminManager { // Propagate this to all hosts GlobalRequestResult result = new GlobalRequestResult(); for (String mgmtUrl : mgmtUrls) { - if (sendTestNodeAvailabilityRequest(realm, application, executor, mgmtUrl)) { + if (sendTestNodeAvailabilityRequest(realm, client, executor, mgmtUrl)) { result.addSuccessRequest(mgmtUrl); } else { result.addFailedRequest(mgmtUrl); @@ -372,11 +372,11 @@ public class ResourceAdminManager { } } - protected boolean sendTestNodeAvailabilityRequest(RealmModel realm, ClientModel application, ApacheHttpClient4Executor client, String managementUrl) { - TestAvailabilityAction adminAction = new TestAvailabilityAction(TokenIdGenerator.generateId(), Time.currentTime() + 30, application.getClientId()); + protected boolean sendTestNodeAvailabilityRequest(RealmModel realm, ClientModel client, ApacheHttpClient4Executor httpClient, String managementUrl) { + TestAvailabilityAction adminAction = new TestAvailabilityAction(TokenIdGenerator.generateId(), Time.currentTime() + 30, client.getClientId()); String token = new TokenManager().encodeToken(realm, adminAction); - logger.debugv("testNodes availability resource: {0} url: {1}", application.getClientId(), managementUrl); - ClientRequest request = client.createRequest(UriBuilder.fromUri(managementUrl).path(AdapterConstants.K_TEST_AVAILABLE).build().toString()); + logger.debugv("testNodes availability resource: {0} url: {1}", client.getClientId(), managementUrl); + ClientRequest request = httpClient.createRequest(UriBuilder.fromUri(managementUrl).path(AdapterConstants.K_TEST_AVAILABLE).build().toString()); ClientResponse response; try { response = request.body(MediaType.TEXT_PLAIN_TYPE, token).post(); 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 d3e979ba20c..71fb570adb2 100755 --- a/services/src/main/java/org/keycloak/services/resources/AccountService.java +++ b/services/src/main/java/org/keycloak/services/resources/AccountService.java @@ -131,16 +131,16 @@ public class AccountService { private KeycloakSession session; private final AppAuthManager authManager; - private final ClientModel application; + private final ClientModel client; private EventBuilder event; private AccountProvider account; private Auth auth; private EventStoreProvider eventStore; private String stateChecker; - public AccountService(RealmModel realm, ClientModel application, EventBuilder event) { + public AccountService(RealmModel realm, ClientModel client, EventBuilder event) { this.realm = realm; - this.application = application; + this.client = client; this.event = event; this.authManager = new AppAuthManager(); } @@ -152,11 +152,11 @@ public class AccountService { AuthenticationManager.AuthResult authResult = authManager.authenticateBearerToken(session, realm, uriInfo, clientConnection, headers); if (authResult != null) { - auth = new Auth(realm, authResult.getToken(), authResult.getUser(), application, authResult.getSession(), false); + auth = new Auth(realm, authResult.getToken(), authResult.getUser(), client, authResult.getSession(), false); } else { authResult = authManager.authenticateIdentityCookie(session, realm, uriInfo, clientConnection, headers); if (authResult != null) { - auth = new Auth(realm, authResult.getToken(), authResult.getUser(), application, authResult.getSession(), true); + auth = new Auth(realm, authResult.getToken(), authResult.getUser(), client, authResult.getSession(), true); Cookie cookie = headers.getCookies().get(KEYCLOAK_STATE_CHECKER); if (cookie != null) { stateChecker = cookie.getValue(); @@ -193,14 +193,14 @@ public class AccountService { if (userSession != null) { boolean associated = false; for (ClientSessionModel c : userSession.getClientSessions()) { - if (c.getClient().equals(application)) { + if (c.getClient().equals(client)) { auth.setClientSession(c); associated = true; break; } } if (!associated) { - ClientSessionModel clientSession = session.sessions().createClientSession(realm, application); + ClientSessionModel clientSession = session.sessions().createClientSession(realm, client); clientSession.setUserSession(userSession); auth.setClientSession(clientSession); } @@ -737,7 +737,7 @@ public class AccountService { logger.debug("realm not enabled"); throw new ForbiddenException(); } - if (!application.isEnabled()) { + if (!client.isEnabled()) { logger.debug("account management app not enabled"); throw new ForbiddenException(); } @@ -766,7 +766,7 @@ public class AccountService { String authUrl = OIDCLoginProtocolService.authUrl(uriInfo).build(realm.getName()).toString(); oauth.setAuthUrl(authUrl); - oauth.setClientId(Constants.ACCOUNT_MANAGEMENT_APP); + oauth.setClientId(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID); UriBuilder uriBuilder = Urls.accountPageBuilder(uriInfo.getBaseUri()).path(AccountService.class, "loginRedirect"); @@ -813,21 +813,21 @@ public class AccountService { String referrerUri = uriInfo.getQueryParameters().getFirst("referrer_uri"); - ClientModel application = realm.getClientByClientId(referrer); - if (application != null) { + ClientModel referrerClient = realm.getClientByClientId(referrer); + if (referrerClient != null) { if (referrerUri != null) { - referrerUri = RedirectUtils.verifyRedirectUri(uriInfo, referrerUri, realm, application); + referrerUri = RedirectUtils.verifyRedirectUri(uriInfo, referrerUri, realm, referrerClient); } else { - referrerUri = ResolveRelative.resolveRelativeUri(uriInfo.getRequestUri(), application.getBaseUrl()); + referrerUri = ResolveRelative.resolveRelativeUri(uriInfo.getRequestUri(), referrerClient.getBaseUrl()); } if (referrerUri != null) { return new String[]{referrer, referrerUri}; } } else if (referrerUri != null) { - ClientModel client = realm.getClientByClientId(referrer); + referrerClient = realm.getClientByClientId(referrer); if (client != null) { - referrerUri = RedirectUtils.verifyRedirectUri(uriInfo, referrerUri, realm, application); + referrerUri = RedirectUtils.verifyRedirectUri(uriInfo, referrerUri, realm, referrerClient); if (referrerUri != null) { return new String[]{referrer, referrerUri}; @@ -843,7 +843,7 @@ public class AccountService { throw new ForbiddenException(); } - if (!auth.hasAppRole(application, role)) { + if (!auth.hasClientRole(client, role)) { throw new ForbiddenException(); } } @@ -853,7 +853,7 @@ public class AccountService { throw new ForbiddenException(); } - if (!auth.hasOneOfAppRole(application, roles)) { + if (!auth.hasOneOfAppRole(client, roles)) { throw new ForbiddenException(); } } diff --git a/services/src/main/java/org/keycloak/services/resources/ClientsManagementService.java b/services/src/main/java/org/keycloak/services/resources/ClientsManagementService.java index beca17de430..1eb54800a48 100755 --- a/services/src/main/java/org/keycloak/services/resources/ClientsManagementService.java +++ b/services/src/main/java/org/keycloak/services/resources/ClientsManagementService.java @@ -24,6 +24,7 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; @@ -81,7 +82,7 @@ public class ClientsManagementService { } /** - * URL invoked by adapter to register new application cluster node. Each application cluster node will invoke this URL once it joins cluster + * URL invoked by adapter to register new client cluster node. Each application cluster node will invoke this URL once it joins cluster * * @param authorizationHeader * @param formData @@ -89,7 +90,7 @@ public class ClientsManagementService { */ @Path("register-node") @POST - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response registerNode(@HeaderParam(HttpHeaders.AUTHORIZATION) String authorizationHeader, final MultivaluedMap formData) { if (!checkSsl()) { throw new ForbiddenException("HTTPS required"); @@ -102,13 +103,13 @@ public class ClientsManagementService { throw new UnauthorizedException("Realm not enabled"); } - ClientModel application = authorizeApplication(authorizationHeader, formData); - String nodeHost = getApplicationClusterHost(formData); + ClientModel client = authorizeClient(authorizationHeader, formData); + String nodeHost = getClientClusterHost(formData); - event.client(application).detail(Details.NODE_HOST, nodeHost); - logger.debugf("Registering cluster host '%s' for client '%s'", nodeHost, application.getClientId()); + event.client(client).detail(Details.NODE_HOST, nodeHost); + logger.debugf("Registering cluster host '%s' for client '%s'", nodeHost, client.getClientId()); - application.registerNode(nodeHost, Time.currentTime()); + client.registerNode(nodeHost, Time.currentTime()); event.success(); @@ -117,7 +118,7 @@ public class ClientsManagementService { /** - * URL invoked by adapter to register new application cluster node. Each application cluster node will invoke this URL once it joins cluster + * URL invoked by adapter to register new client cluster node. Each application cluster node will invoke this URL once it joins cluster * * @param authorizationHeader * @param formData @@ -125,7 +126,7 @@ public class ClientsManagementService { */ @Path("unregister-node") @POST - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response unregisterNode(@HeaderParam(HttpHeaders.AUTHORIZATION) String authorizationHeader, final MultivaluedMap formData) { if (!checkSsl()) { throw new ForbiddenException("HTTPS required"); @@ -138,20 +139,20 @@ public class ClientsManagementService { throw new UnauthorizedException("Realm not enabled"); } - ClientModel application = authorizeApplication(authorizationHeader, formData); - String nodeHost = getApplicationClusterHost(formData); + ClientModel client = authorizeClient(authorizationHeader, formData); + String nodeHost = getClientClusterHost(formData); - event.client(application).detail(Details.NODE_HOST, nodeHost); - logger.debugf("Unregistering cluster host '%s' for client '%s'", nodeHost, application.getClientId()); + event.client(client).detail(Details.NODE_HOST, nodeHost); + logger.debugf("Unregistering cluster host '%s' for client '%s'", nodeHost, client.getClientId()); - application.unregisterNode(nodeHost); + client.unregisterNode(nodeHost); event.success(); return Response.noContent().build(); } - protected ClientModel authorizeApplication(String authorizationHeader, MultivaluedMap formData) { + protected ClientModel authorizeClient(String authorizationHeader, MultivaluedMap formData) { ClientModel client = AuthorizeClientUtil.authorizeClient(authorizationHeader, formData, event, realm); if (client.isPublicClient()) { @@ -159,31 +160,23 @@ public class ClientsManagementService { error.put(OAuth2Constants.ERROR, "invalid_client"); error.put(OAuth2Constants.ERROR_DESCRIPTION, "Public clients not allowed"); event.error(Errors.INVALID_CLIENT); - throw new BadRequestException("Public clients not allowed", javax.ws.rs.core.Response.status(javax.ws.rs.core.Response.Status.BAD_REQUEST).entity(error).type("application/json").build()); + throw new BadRequestException("Public clients not allowed", javax.ws.rs.core.Response.status(javax.ws.rs.core.Response.Status.BAD_REQUEST).entity(error).type(MediaType.APPLICATION_JSON_TYPE).build()); } - if (!(client instanceof ClientModel)) { - Map error = new HashMap(); - error.put(OAuth2Constants.ERROR, "invalid_client"); - error.put(OAuth2Constants.ERROR_DESCRIPTION, "Just applications are allowed"); - event.error(Errors.INVALID_CLIENT); - throw new BadRequestException("ust applications are allowed", javax.ws.rs.core.Response.status(javax.ws.rs.core.Response.Status.BAD_REQUEST).entity(error).type("application/json").build()); - } - - return (ClientModel)client; + return client; } - protected String getApplicationClusterHost(MultivaluedMap formData) { - String applicationClusterHost = formData.getFirst(AdapterConstants.APPLICATION_CLUSTER_HOST); - if (applicationClusterHost == null || applicationClusterHost.length() == 0) { + protected String getClientClusterHost(MultivaluedMap formData) { + String clientClusterHost = formData.getFirst(AdapterConstants.CLIENT_CLUSTER_HOST); + if (clientClusterHost == null || clientClusterHost.length() == 0) { Map error = new HashMap(); error.put(OAuth2Constants.ERROR, "invalid_request"); - error.put(OAuth2Constants.ERROR_DESCRIPTION, "application cluster host not specified"); + error.put(OAuth2Constants.ERROR_DESCRIPTION, "Client cluster host not specified"); event.error(Errors.INVALID_CODE); - throw new BadRequestException("Cluster host not specified", javax.ws.rs.core.Response.status(javax.ws.rs.core.Response.Status.BAD_REQUEST).entity(error).type("application/json").build()); + throw new BadRequestException("Cluster host not specified", javax.ws.rs.core.Response.status(javax.ws.rs.core.Response.Status.BAD_REQUEST).entity(error).type(MediaType.APPLICATION_JSON_TYPE).build()); } - return applicationClusterHost; + return clientClusterHost; } diff --git a/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java b/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java index a26b2794dc4..f8e5e8febc4 100755 --- a/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java +++ b/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java @@ -73,7 +73,7 @@ import java.util.Map; import static org.keycloak.models.AccountRoles.MANAGE_ACCOUNT; import static org.keycloak.models.ClientSessionModel.Action.AUTHENTICATE; -import static org.keycloak.models.Constants.ACCOUNT_MANAGEMENT_APP; +import static org.keycloak.models.Constants.ACCOUNT_MANAGEMENT_CLIENT_ID; import static org.keycloak.models.UserModel.RequiredAction.UPDATE_PROFILE; /** @@ -327,7 +327,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal return redirectToErrorPage(Messages.ACCOUNT_DISABLED); } - if (!authenticatedUser.hasRole(this.realmModel.getClientByClientId(ACCOUNT_MANAGEMENT_APP).getRole(MANAGE_ACCOUNT))) { + if (!authenticatedUser.hasRole(this.realmModel.getClientByClientId(ACCOUNT_MANAGEMENT_CLIENT_ID).getRole(MANAGE_ACCOUNT))) { fireErrorEvent(Errors.NOT_ALLOWED); return redirectToErrorPage(Messages.INSUFFICIENT_PERMISSION); } @@ -382,7 +382,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal return clientCode; } - throw new IdentityBrokerException("Invalid code, please login again through your application."); + throw new IdentityBrokerException("Invalid code, please login again through your client."); } private AuthenticationRequest createAuthenticationRequest(String providerId, ClientSessionCode clientSessionCode) { diff --git a/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java b/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java index b4c32842253..25beaa5f14b 100755 --- a/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java +++ b/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java @@ -14,6 +14,7 @@ import javax.ws.rs.OPTIONS; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; @@ -59,7 +60,7 @@ public class PublicRealmResource { */ @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public PublishedRealmRepresentation getRealm() { Cors.add(request).allowedOrigins(Cors.ACCESS_CONTROL_ALLOW_ORIGIN_WILDCARD).auth().build(response); return realmRep(realm, uriInfo); diff --git a/services/src/main/java/org/keycloak/services/resources/RealmsResource.java b/services/src/main/java/org/keycloak/services/resources/RealmsResource.java index 4989fbcdc42..571f111a8f8 100755 --- a/services/src/main/java/org/keycloak/services/resources/RealmsResource.java +++ b/services/src/main/java/org/keycloak/services/resources/RealmsResource.java @@ -157,16 +157,15 @@ public class RealmsResource { RealmManager realmManager = new RealmManager(session); RealmModel realm = locateRealm(name, realmManager); - ClientModel application = realm.getClientNameMap().get(Constants.ACCOUNT_MANAGEMENT_APP); - if (application == null || !application.isEnabled()) { + ClientModel client = realm.getClientNameMap().get(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID); + if (client == null || !client.isEnabled()) { logger.debug("account management not enabled"); throw new NotFoundException("account management not enabled"); } EventBuilder event = new EventBuilder(realm, session, clientConnection); - AccountService accountService = new AccountService(realm, application, event); + AccountService accountService = new AccountService(realm, client, event); ResteasyProviderFactory.getInstance().injectProperties(accountService); - //resourceContext.initResource(accountService); accountService.init(); return accountService; } @@ -177,7 +176,6 @@ public class RealmsResource { RealmModel realm = locateRealm(name, realmManager); PublicRealmResource realmResource = new PublicRealmResource(realm); ResteasyProviderFactory.getInstance().injectProperties(realmResource); - //resourceContext.initResource(realmResource); return realmResource; } @@ -188,7 +186,6 @@ public class RealmsResource { IdentityBrokerService brokerService = new IdentityBrokerService(realm); ResteasyProviderFactory.getInstance().injectProperties(brokerService); - //resourceContext.initResource(brokerService); brokerService.init(); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java b/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java index bfe70da898d..24d76b2873f 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java @@ -151,12 +151,12 @@ public class AdminConsole { */ @Path("config") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public ClientManager.InstallationAdapterConfig config() { - ClientModel consoleApp = realm.getClientByClientId(Constants.ADMIN_CONSOLE_APPLICATION); + ClientModel consoleApp = realm.getClientByClientId(Constants.ADMIN_CONSOLE_CLIENT_ID); if (consoleApp == null) { - throw new NotFoundException("Could not find admin console application"); + throw new NotFoundException("Could not find admin console client"); } return new ClientManager().toInstallationRepresentation(realm, consoleApp, keycloak.getBaseUri(uriInfo)); @@ -170,7 +170,7 @@ public class AdminConsole { */ @Path("whoami") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public Response whoAmI(final @Context HttpHeaders headers) { RealmManager realmManager = new RealmManager(session); @@ -208,7 +208,7 @@ public class AdminConsole { private void addRealmAccess(RealmModel realm, UserModel user, Map> realmAdminAccess) { RealmManager realmManager = new RealmManager(session); - ClientModel realmAdminApp = realm.getClientByClientId(realmManager.getRealmAdminApplicationName(realm)); + ClientModel realmAdminApp = realm.getClientByClientId(realmManager.getRealmAdminClientId(realm)); Set roles = realmAdminApp.getRoles(); for (RoleModel role : roles) { if (!user.hasRole(role)) continue; @@ -223,7 +223,7 @@ public class AdminConsole { private void addMasterRealmAccess(RealmModel masterRealm, UserModel user, Map> realmAdminAccess) { List realms = session.realms().getRealms(); for (RealmModel realm : realms) { - ClientModel realmAdminApp = realm.getMasterAdminApp(); + ClientModel realmAdminApp = realm.getMasterAdminClient(); Set roles = realmAdminApp.getRoles(); for (RoleModel role : roles) { if (!user.hasRole(role)) continue; diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ClientResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ClientResource.java index 8c689757ada..f0decf37fe0 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ClientResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ClientResource.java @@ -16,7 +16,6 @@ import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.models.utils.ModelToRepresentation; import org.keycloak.models.utils.RepresentationToModel; import org.keycloak.representations.adapters.action.GlobalRequestResult; -import org.keycloak.representations.idm.ApplicationRepresentation; import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.CredentialRepresentation; import org.keycloak.representations.idm.UserSessionRepresentation; @@ -49,7 +48,7 @@ import java.util.Map; import java.util.Set; /** - * Base resource class for managing one particular application of a realm. + * Base resource class for managing one particular client of a realm. * * @author Bill Burke * @version $Revision: 1 $ @@ -88,7 +87,7 @@ public class ClientResource { } /** - * Update the application. + * Update the client. * @param rep * @return */ @@ -107,7 +106,7 @@ public class ClientResource { /** - * Get representation of the application. + * Get representation of the client. * * @return */ @@ -132,7 +131,7 @@ public class ClientResource { /** - * Return keycloak.json file for this application to be used to configure the adapter of that application. + * Return keycloak.json file for this client to be used to configure the adapter of that client. * * @return * @throws IOException @@ -152,7 +151,7 @@ public class ClientResource { } /** - * Return XML that can be included in the JBoss/Wildfly Keycloak subsystem to configure the adapter of that application. + * Return XML that can be included in the JBoss/Wildfly Keycloak subsystem to configure the adapter of that client. * * @return * @throws IOException @@ -169,26 +168,26 @@ public class ClientResource { } /** - * Delete this application. + * Delete this client. * */ @DELETE @NoCache - public void deleteApplication() { + public void deleteClient() { auth.requireManage(); new ClientManager(new RealmManager(session)).removeClient(realm, client); } /** - * Generates a new secret for this application + * Generates a new secret for this client * * @return */ @Path("client-secret") @POST - @Produces("application/json") - @Consumes("application/json") + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) public CredentialRepresentation regenerateSecret() { auth.requireManage(); @@ -199,25 +198,25 @@ public class ClientResource { } /** - * Get the secret of this application + * Get the secret of this client * * @return */ @Path("client-secret") @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public CredentialRepresentation getClientSecret() { auth.requireView(); logger.debug("getClientSecret"); UserCredentialModel model = UserCredentialModel.secret(client.getSecret()); - if (model == null) throw new NotFoundException("Application does not have a secret"); + if (model == null) throw new NotFoundException("Client does not have a secret"); return ModelToRepresentation.toRepresentation(model); } /** - * Base path for managing the scope mappings for this application + * Base path for managing the scope mappings for this client * * @return */ @@ -233,14 +232,14 @@ public class ClientResource { /** * Returns set of allowed origin. This is used for CORS requests. Access tokens will have - * their allowedOrigins claim set to this value for tokens created for this application. + * their allowedOrigins claim set to this value for tokens created for this client. * * @return */ @Path("allowed-origins") @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Set getAllowedOrigins() { auth.requireView(); @@ -250,13 +249,13 @@ public class ClientResource { /** * Change the set of allowed origins. This is used for CORS requests. Access tokens will have - * their allowedOrigins claim set to this value for tokens created for this application. + * their allowedOrigins claim set to this value for tokens created for this client. * * @param allowedOrigins */ @Path("allowed-origins") @PUT - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void updateAllowedOrigins(Set allowedOrigins) { auth.requireManage(); @@ -266,13 +265,13 @@ public class ClientResource { /** * Remove set of allowed origins from current allowed origins list. This is used for CORS requests. Access tokens will have - * their allowedOrigins claim set to this value for tokens created for this application. + * their allowedOrigins claim set to this value for tokens created for this client. * * @param allowedOrigins */ @Path("allowed-origins") @DELETE - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void deleteAllowedOrigins(Set allowedOrigins) { auth.requireManage(); @@ -283,18 +282,18 @@ public class ClientResource { } /** - * If the application has an admin URL, push the application's revocation policy to it. + * If the client has an admin URL, push the client's revocation policy to it. * */ @Path("push-revocation") @POST public GlobalRequestResult pushRevocation() { auth.requireManage(); - return new ResourceAdminManager().pushApplicationRevocationPolicy(uriInfo.getRequestUri(), realm, client); + return new ResourceAdminManager().pushClientRevocationPolicy(uriInfo.getRequestUri(), realm, client); } /** - * Number of user sessions associated with this application + * Number of user sessions associated with this client * * { * "count": number @@ -314,7 +313,7 @@ public class ClientResource { } /** - * Return a list of user sessions associated with this application + * Return a list of user sessions associated with this client * * @return */ @@ -335,18 +334,18 @@ public class ClientResource { } /** - * If the application has an admin URL, invalidate all sessions associated with that application directly. + * If the client has an admin URL, invalidate all sessions associated with that client directly. * */ @Path("logout-all") @POST public GlobalRequestResult logoutAll() { auth.requireManage(); - return new ResourceAdminManager().logoutApplication(uriInfo.getRequestUri(), realm, client); + return new ResourceAdminManager().logoutClient(uriInfo.getRequestUri(), realm, client); } /** - * If the application has an admin URL, invalidate the sessions for a particular user directly. + * If the client has an admin URL, invalidate the sessions for a particular user directly. * */ @Path("logout-user/{username}") @@ -357,18 +356,18 @@ public class ClientResource { if (user == null) { throw new NotFoundException("User not found"); } - new ResourceAdminManager().logoutUserFromApplication(uriInfo.getRequestUri(), realm, client, user, session); + new ResourceAdminManager().logoutUserFromClient(uriInfo.getRequestUri(), realm, client, user, session); } /** - * Manually register cluster node to this application - usually it's not needed to call this directly as adapter should handle + * Manually register cluster node to this client - usually it's not needed to call this directly as adapter should handle * by sending registration request to Keycloak * * @param formParams */ @Path("nodes") @POST - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void registerNode(Map formParams) { auth.requireManage(); String node = formParams.get("node"); @@ -380,7 +379,7 @@ public class ClientResource { } /** - * Unregister cluster node from this application + * Unregister cluster node from this client * * @param node */ @@ -393,7 +392,7 @@ public class ClientResource { Integer time = client.getRegisteredNodes().get(node); if (time == null) { - throw new NotFoundException("Application does not have a node " + node); + throw new NotFoundException("Client does not have a node " + node); } client.unregisterNode(node); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ClientsResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ClientsResource.java index 7432efb6298..270b7ac4e49 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ClientsResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ClientsResource.java @@ -27,7 +27,7 @@ import java.util.ArrayList; import java.util.List; /** - * Base resource class for managing a realm's applications. + * Base resource class for managing a realm's clients. * * @author Bill Burke * @version $Revision: 1 $ @@ -48,7 +48,7 @@ public class ClientsResource { } /** - * List of applications belonging to this realm. + * List of clients belonging to this realm. * * @return */ @@ -100,7 +100,7 @@ public class ClientsResource { } /** - * Base path for managing a specific application. + * Base path for managing a specific client. * * @param name * @return diff --git a/services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java b/services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java index 97c56f119d4..bbb32b441b9 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java @@ -27,6 +27,7 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.util.ArrayList; @@ -53,7 +54,7 @@ public class IdentityProviderResource { @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public IdentityProviderRepresentation getIdentityProvider() { IdentityProviderRepresentation rep = ModelToRepresentation.toRepresentation(this.identityProviderModel); @@ -73,7 +74,7 @@ public class IdentityProviderResource { } @PUT - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response update(IdentityProviderRepresentation providerRep) { try { this.auth.requireManage(); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/IdentityProvidersResource.java b/services/src/main/java/org/keycloak/services/resources/admin/IdentityProvidersResource.java index e59ee6e52e7..ef0e94bd251 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/IdentityProvidersResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/IdentityProvidersResource.java @@ -57,7 +57,7 @@ public class IdentityProvidersResource { @Path("/providers/{provider_id}") @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getIdentityProviders(@PathParam("provider_id") String providerId) { this.auth.requireView(); IdentityProviderFactory providerFactory = getProviderFactorytById(providerId); @@ -108,7 +108,7 @@ public class IdentityProvidersResource { @GET @Path("instances") @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public List getIdentityProviders() { this.auth.requireView(); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ProtocolMappersResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ProtocolMappersResource.java index d4ceddab041..36428b89fb6 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ProtocolMappersResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ProtocolMappersResource.java @@ -19,6 +19,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.util.LinkedList; @@ -59,7 +60,7 @@ public class ProtocolMappersResource { @GET @NoCache @Path("protocol/{protocol}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public List getMappersPerProtocol(@PathParam("protocol") String protocol) { auth.requireView(); List mappers = new LinkedList(); @@ -77,7 +78,7 @@ public class ProtocolMappersResource { @Path("models") @POST @NoCache - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response createMapper(ProtocolMapperRepresentation rep) { auth.requireManage(); ProtocolMapperModel model = RepresentationToModel.toModel(rep); @@ -91,7 +92,7 @@ public class ProtocolMappersResource { @Path("add-models") @POST @NoCache - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void createMapper(List reps) { auth.requireManage(); for (ProtocolMapperRepresentation rep : reps) { @@ -103,7 +104,7 @@ public class ProtocolMappersResource { @GET @NoCache @Path("models") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public List getMappers() { auth.requireView(); List mappers = new LinkedList(); @@ -116,7 +117,7 @@ public class ProtocolMappersResource { @GET @NoCache @Path("models/{id}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public ProtocolMapperRepresentation getMapperById(@PathParam("id") String id) { auth.requireView(); ProtocolMapperModel model = client.getProtocolMapperById(id); @@ -127,7 +128,7 @@ public class ProtocolMappersResource { @PUT @NoCache @Path("models/{id}") - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void update(@PathParam("id") String id, ProtocolMapperRepresentation rep) { auth.requireManage(); ProtocolMapperModel model = client.getProtocolMapperById(id); 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 313d81011c7..5fea57dfbf5 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RealmAdminResource.java @@ -9,7 +9,7 @@ import org.keycloak.events.Event; import org.keycloak.events.EventQuery; import org.keycloak.events.EventStoreProvider; import org.keycloak.events.EventType; -import org.keycloak.exportimport.ApplicationImporter; +import org.keycloak.exportimport.ClientImporter; import org.keycloak.models.ClientModel; import org.keycloak.models.KeycloakSession; import org.keycloak.models.ModelDuplicateException; @@ -85,40 +85,38 @@ public class RealmAdminResource { } /** - * Base path for importing applications under this realm. + * Base path for importing clients under this realm. * * @return */ - @Path("application-importers/{formatId}") - public Object getApplicationImporter(@PathParam("formatId") String formatId) { - ApplicationImporter importer = session.getProvider(ApplicationImporter.class, formatId); + @Path("client-importers/{formatId}") + public Object getClientImporter(@PathParam("formatId") String formatId) { + ClientImporter importer = session.getProvider(ClientImporter.class, formatId); return importer.createJaxrsService(realm, auth); } /** - * Base path for managing applications under this realm. + * Base path for managing clients under this realm. * * @return */ - @Path("applications") - public ClientsResource getApplications() { + @Path("clients") + public ClientsResource getClients() { ClientsResource clientsResource = new ClientsResource(realm, auth); ResteasyProviderFactory.getInstance().injectProperties(clientsResource); - //resourceContext.initResource(applicationsResource); return clientsResource; } /** - * Base path for managing applications under this realm. + * Base path for managing clients under this realm. * * @return */ - @Path("applications-by-id") - public ClientsByIdResource getApplicationsById() { - ClientsByIdResource applicationsResource = new ClientsByIdResource(realm, auth); - ResteasyProviderFactory.getInstance().injectProperties(applicationsResource); - //resourceContext.initResource(applicationsResource); - return applicationsResource; + @Path("clients-by-id") + public ClientsByIdResource getClientsById() { + ClientsByIdResource clientsResource = new ClientsByIdResource(realm, auth); + ResteasyProviderFactory.getInstance().injectProperties(clientsResource); + return clientsResource; } /** @@ -132,14 +130,13 @@ public class RealmAdminResource { } /** - * Get the top-level representation of the realm. It will not include nested information like User, Application, or OAuth - * Client representations. + * Get the top-level representation of the realm. It will not include nested information like User and Client representations. * * @return */ @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public RealmRepresentation getRealm() { if (auth.hasView()) { RealmRepresentation rep = ModelToRepresentation.toRepresentation(realm, false); @@ -162,14 +159,14 @@ public class RealmAdminResource { } /** - * Update the top-level information of this realm. Any user, roles, application, or oauth client information in the representation + * Update the top-level information of this realm. Any user, roles or client information in the representation * will be ignored. This will only update top-level attributes of the realm. * * @param rep * @return */ @PUT - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response updateRealm(final RealmRepresentation rep) { auth.requireManage(); @@ -237,7 +234,7 @@ public class RealmAdminResource { } /** - * Path for managing all realm-level or application-level roles defined in this realm by it's id. + * Path for managing all realm-level or client-level roles defined in this realm by it's id. * * @return */ @@ -250,7 +247,7 @@ public class RealmAdminResource { } /** - * Push the realm's revocation policy to any application that has an admin url associated with it. + * Push the realm's revocation policy to any client that has an admin url associated with it. * */ @Path("push-revocation") @@ -261,7 +258,7 @@ public class RealmAdminResource { } /** - * Removes all user sessions. Any application that has an admin url will also be told to invalidate any sessions + * Removes all user sessions. Any client that has an admin url will also be told to invalidate any sessions * they have. * */ @@ -273,7 +270,7 @@ public class RealmAdminResource { } /** - * Remove a specific user session. Any application that has an admin url will also be told to invalidate this + * Remove a specific user session. Any client that has an admin url will also be told to invalidate this * particular session. * * @param sessionId @@ -287,46 +284,46 @@ public class RealmAdminResource { } /** - * Returns a JSON map. The key is the application name, the value is the number of sessions that currently are active - * with that application. Only application's that actually have a session associated with them will be in this map. + * Returns a JSON map. The key is the client name, the value is the number of sessions that currently are active + * with that client. Only client's that actually have a session associated with them will be in this map. * * @return */ - @Path("application-session-stats") + @Path("client-session-stats") @GET @NoCache @Produces(MediaType.APPLICATION_JSON) @Deprecated - public Map getApplicationSessionStats() { + public Map getClientSessionStats() { auth.requireView(); Map stats = new HashMap(); - for (ClientModel application : realm.getClients()) { - int size = session.sessions().getActiveUserSessions(application.getRealm(), application); + for (ClientModel client : realm.getClients()) { + int size = session.sessions().getActiveUserSessions(client.getRealm(), client); if (size == 0) continue; - stats.put(application.getClientId(), size); + stats.put(client.getClientId(), size); } return stats; } /** - * Returns a JSON map. The key is the application id, the value is the number of sessions that currently are active - * with that application. Only application's that actually have a session associated with them will be in this map. + * Returns a JSON map. The key is the client id, the value is the number of sessions that currently are active + * with that client. Only client's that actually have a session associated with them will be in this map. * * @return */ - @Path("application-by-id-session-stats") + @Path("client-by-id-session-stats") @GET @NoCache @Produces(MediaType.APPLICATION_JSON) - public List> getApplicationByIdSessionStats() { + public List> getClientByIdSessionStats() { auth.requireView(); List> data = new LinkedList>(); - for (ClientModel application : realm.getClients()) { - int size = session.sessions().getActiveUserSessions(application.getRealm(), application); + for (ClientModel client : realm.getClients()) { + int size = session.sessions().getActiveUserSessions(client.getRealm(), client); if (size == 0) continue; Map map = new HashMap(); - map.put("id", application.getId()); - map.put("name", application.getClientId()); + map.put("id", client.getId()); + map.put("clientId", client.getClientId()); map.put("active", size + ""); data.add(map); } @@ -341,7 +338,7 @@ public class RealmAdminResource { @GET @NoCache @Path("events/config") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public RealmEventsConfigRepresentation getRealmEventsConfig() { auth.init(RealmAuth.Resource.EVENTS).requireView(); @@ -355,7 +352,7 @@ public class RealmAdminResource { */ @PUT @Path("events/config") - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void updateRealmEventsConfig(final RealmEventsConfigRepresentation rep) { auth.init(RealmAuth.Resource.EVENTS).requireManage(); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java index 963bd6a6868..21fc79e9522 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java @@ -74,27 +74,27 @@ public class RealmsAdminResource { */ @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public List getRealms() { RealmManager realmManager = new RealmManager(session); List reps = new ArrayList(); if (auth.getRealm().equals(realmManager.getKeycloakAdminstrationRealm())) { List realms = session.realms().getRealms(); for (RealmModel realm : realms) { - addRealmRep(reps, realm, realm.getMasterAdminApp()); + addRealmRep(reps, realm, realm.getMasterAdminClient()); } } else { - ClientModel adminApp = auth.getRealm().getClientByClientId(realmManager.getRealmAdminApplicationName(auth.getRealm())); + ClientModel adminApp = auth.getRealm().getClientByClientId(realmManager.getRealmAdminClientId(auth.getRealm())); addRealmRep(reps, auth.getRealm(), adminApp); } logger.debug(("getRealms()")); return reps; } - protected void addRealmRep(List reps, RealmModel realm, ClientModel realmManagementApplication) { - if (auth.hasAppRole(realmManagementApplication, AdminRoles.MANAGE_REALM)) { + protected void addRealmRep(List reps, RealmModel realm, ClientModel realmManagementClient) { + if (auth.hasAppRole(realmManagementClient, AdminRoles.MANAGE_REALM)) { reps.add(ModelToRepresentation.toRepresentation(realm, false)); - } else if (auth.hasOneOfAppRole(realmManagementApplication, AdminRoles.ALL_REALM_ROLES)) { + } else if (auth.hasOneOfAppRole(realmManagementClient, AdminRoles.ALL_REALM_ROLES)) { RealmRepresentation rep = new RealmRepresentation(); rep.setRealm(realm.getName()); reps.add(rep); @@ -109,7 +109,7 @@ public class RealmsAdminResource { * @return */ @POST - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response importRealm(@Context final UriInfo uriInfo, final RealmRepresentation rep) { RealmManager realmManager = new RealmManager(session); realmManager.setContextPath(keycloak.getContextPath()); @@ -186,7 +186,7 @@ public class RealmsAdminResource { } RealmModel adminRealm = new RealmManager(session).getKeycloakAdminstrationRealm(); - ClientModel realmAdminApp = realm.getMasterAdminApp(); + ClientModel realmAdminApp = realm.getMasterAdminClient(); for (String r : AdminRoles.ALL_REALM_ROLES) { RoleModel role = realmAdminApp.getRole(r); auth.getUser().grantRole(role); @@ -214,9 +214,9 @@ public class RealmsAdminResource { RealmAuth realmAuth; if (auth.getRealm().equals(realmManager.getKeycloakAdminstrationRealm())) { - realmAuth = new RealmAuth(auth, realm.getMasterAdminApp()); + realmAuth = new RealmAuth(auth, realm.getMasterAdminClient()); } else { - realmAuth = new RealmAuth(auth, realm.getClientByClientId(realmManager.getRealmAdminApplicationName(auth.getRealm()))); + realmAuth = new RealmAuth(auth, realm.getClientByClientId(realmManager.getRealmAdminClientId(auth.getRealm()))); } RealmAdminResource adminResource = new RealmAdminResource(realmAuth, realm, tokenManager); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RoleByIdResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RoleByIdResource.java index 710f065d371..67d8c12e26f 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/RoleByIdResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RoleByIdResource.java @@ -19,6 +19,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import java.util.List; import java.util.Set; @@ -52,7 +53,7 @@ public class RoleByIdResource extends RoleResource { @Path("{role-id}") @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public RoleRepresentation getRole(final @PathParam("role-id") String id) { RoleModel roleModel = getRoleModel(id); auth.requireView(); @@ -101,7 +102,7 @@ public class RoleByIdResource extends RoleResource { */ @Path("{role-id}") @PUT - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void updateRole(final @PathParam("role-id") String id, final RoleRepresentation rep) { RoleModel role = getRoleModel(id); auth.requireManage(); @@ -116,7 +117,7 @@ public class RoleByIdResource extends RoleResource { */ @Path("{role-id}/composites") @POST - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void addComposites(final @PathParam("role-id") String id, List roles) { RoleModel role = getRoleModel(id); auth.requireManage(); @@ -132,7 +133,7 @@ public class RoleByIdResource extends RoleResource { @Path("{role-id}/composites") @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Set getRoleComposites(final @PathParam("role-id") String id) { if (logger.isDebugEnabled()) logger.debug("*** getRoleComposites: '" + id + "'"); @@ -150,7 +151,7 @@ public class RoleByIdResource extends RoleResource { @Path("{role-id}/composites/realm") @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Set getRealmRoleComposites(final @PathParam("role-id") String id) { RoleModel role = getRoleModel(id); auth.requireView(); @@ -158,49 +159,49 @@ public class RoleByIdResource extends RoleResource { } /** - * Return a set of application-level roles for a specific app that are in the role's composite + * Return a set of client-level roles for a specific client that are in the role's composite * * @param id * @param appName * @return */ - @Path("{role-id}/composites/applications/{app}") + @Path("{role-id}/composites/clients/{app}") @GET @NoCache - @Produces("application/json") - public Set getApplicationRoleComposites(final @PathParam("role-id") String id, + @Produces(MediaType.APPLICATION_JSON) + public Set getClientRoleComposites(final @PathParam("role-id") String id, final @PathParam("app") String appName) { RoleModel role = getRoleModel(id); auth.requireView(); ClientModel app = realm.getClientByClientId(appName); if (app == null) { - throw new NotFoundException("Could not find application: " + appName); + throw new NotFoundException("Could not find client: " + appName); } - return getApplicationRoleComposites(app, role); + return getClientRoleComposites(app, role); } /** - * Return a set of application-level roles for a specific app that are in the role's composite + * Return a set of client-level roles for a specific client that are in the role's composite * * @param id * @param appId * @return */ - @Path("{role-id}/composites/applications-by-id/{appId}") + @Path("{role-id}/composites/clients-by-id/{appId}") @GET @NoCache - @Produces("application/json") - public Set getApplicationByIdRoleComposites(final @PathParam("role-id") String id, + @Produces(MediaType.APPLICATION_JSON) + public Set getClientByIdRoleComposites(final @PathParam("role-id") String id, final @PathParam("appId") String appId) { RoleModel role = getRoleModel(id); auth.requireView(); ClientModel app = realm.getClientById(appId); if (app == null) { - throw new NotFoundException("Could not find application: " + appId); + throw new NotFoundException("Could not find client: " + appId); } - return getApplicationRoleComposites(app, role); + return getClientRoleComposites(app, role); } /** @@ -211,7 +212,7 @@ public class RoleByIdResource extends RoleResource { */ @Path("{role-id}/composites") @DELETE - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void deleteComposites(final @PathParam("role-id") String id, List roles) { RoleModel role = getRoleModel(id); auth.requireManage(); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RoleContainerResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RoleContainerResource.java index e1d5c28ddac..66d37a9492d 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/RoleContainerResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RoleContainerResource.java @@ -20,6 +20,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.util.ArrayList; @@ -43,13 +44,13 @@ public class RoleContainerResource extends RoleResource { } /** - * List all roles for this realm or application + * List all roles for this realm or client * * @return */ @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public List getRoles() { auth.requireAny(); @@ -62,14 +63,14 @@ public class RoleContainerResource extends RoleResource { } /** - * Create a new role for this realm or application + * Create a new role for this realm or client * * @param uriInfo * @param rep * @return */ @POST - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response createRole(final @Context UriInfo uriInfo, final RoleRepresentation rep) { auth.requireManage(); @@ -91,7 +92,7 @@ public class RoleContainerResource extends RoleResource { @Path("{role-name}") @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public RoleRepresentation getRole(final @PathParam("role-name") String roleName) { auth.requireView(); @@ -131,7 +132,7 @@ public class RoleContainerResource extends RoleResource { */ @Path("{role-name}") @PUT - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response updateRole(final @PathParam("role-name") String roleName, final RoleRepresentation rep) { auth.requireManage(); @@ -155,7 +156,7 @@ public class RoleContainerResource extends RoleResource { */ @Path("{role-name}/composites") @POST - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void addComposites(final @PathParam("role-name") String roleName, List roles) { auth.requireManage(); @@ -175,7 +176,7 @@ public class RoleContainerResource extends RoleResource { @Path("{role-name}/composites") @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Set getRoleComposites(final @PathParam("role-name") String roleName) { auth.requireManage(); @@ -195,7 +196,7 @@ public class RoleContainerResource extends RoleResource { @Path("{role-name}/composites/realm") @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Set getRealmRoleComposites(final @PathParam("role-name") String roleName) { auth.requireManage(); @@ -207,30 +208,30 @@ public class RoleContainerResource extends RoleResource { } /** - * An app-level roles for a specific app for this role's composite + * An client-level roles for a specific client for this role's composite * * @param roleName role's name (not id!) - * @param appName + * @param clientId * @return */ - @Path("{role-name}/composites/application/{app}") + @Path("{role-name}/composites/client/{clientId}") @GET @NoCache - @Produces("application/json") - public Set getApplicationRoleComposites(final @PathParam("role-name") String roleName, - final @PathParam("app") String appName) { + @Produces(MediaType.APPLICATION_JSON) + public Set getClientRoleComposites(final @PathParam("role-name") String roleName, + final @PathParam("clientId") String clientId) { auth.requireManage(); RoleModel role = roleContainer.getRole(roleName); if (role == null) { throw new NotFoundException("Could not find role: " + roleName); } - ClientModel app = realm.getClientByClientId(appName); + ClientModel app = realm.getClientByClientId(clientId); if (app == null) { - throw new NotFoundException("Could not find application: " + appName); + throw new NotFoundException("Could not find client: " + clientId); } - return getApplicationRoleComposites(app, role); + return getClientRoleComposites(app, role); } @@ -238,27 +239,27 @@ public class RoleContainerResource extends RoleResource { * An app-level roles for a specific app for this role's composite * * @param roleName role's name (not id!) - * @param appId + * @param id * @return */ - @Path("{role-name}/composites/application-by-id/{appId}") + @Path("{role-name}/composites/client-by-id/{id}") @GET @NoCache - @Produces("application/json") - public Set getApplicationByIdRoleComposites(final @PathParam("role-name") String roleName, - final @PathParam("appId") String appId) { + @Produces(MediaType.APPLICATION_JSON) + public Set getClientByIdRoleComposites(final @PathParam("role-name") String roleName, + final @PathParam("id") String id) { auth.requireManage(); RoleModel role = roleContainer.getRole(roleName); if (role == null) { throw new NotFoundException("Could not find role: " + roleName); } - ClientModel app = realm.getClientById(appId); - if (app == null) { - throw new NotFoundException("Could not find application: " + appId); + ClientModel client = realm.getClientById(id); + if (client == null) { + throw new NotFoundException("Could not find client: " + id); } - return getApplicationRoleComposites(app, role); + return getClientRoleComposites(client, role); } @@ -270,7 +271,7 @@ public class RoleContainerResource extends RoleResource { */ @Path("{role-name}/composites") @DELETE - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void deleteComposites(final @PathParam("role-name") String roleName, List roles) { auth.requireManage(); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RoleResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RoleResource.java index 80b6b42ff2d..8196528ccbd 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/RoleResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RoleResource.java @@ -69,7 +69,7 @@ public abstract class RoleResource { return composites; } - protected Set getApplicationRoleComposites(ClientModel app, RoleModel role) { + protected Set getClientRoleComposites(ClientModel app, RoleModel role) { if (!role.isComposite() || role.getComposites().size() == 0) return Collections.emptySet(); Set composites = new HashSet(role.getComposites().size()); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedApplicationResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedClientResource.java similarity index 59% rename from services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedApplicationResource.java rename to services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedClientResource.java index 9035ef068bb..01fe1d67ec9 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedApplicationResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedClientResource.java @@ -15,6 +15,7 @@ import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -23,33 +24,33 @@ import java.util.Set; * @author Bill Burke * @version $Revision: 1 $ */ -public class ScopeMappedApplicationResource { +public class ScopeMappedClientResource { protected RealmModel realm; private RealmAuth auth; protected ClientModel client; protected KeycloakSession session; - protected ClientModel app; + protected ClientModel scopedClient; - public ScopeMappedApplicationResource(RealmModel realm, RealmAuth auth, ClientModel client, KeycloakSession session, ClientModel app) { + public ScopeMappedClientResource(RealmModel realm, RealmAuth auth, ClientModel client, KeycloakSession session, ClientModel scopedClient) { this.realm = realm; this.auth = auth; this.client = client; this.session = session; - this.app = app; + this.scopedClient = scopedClient; } /** - * Get the roles associated with a client's scope for a specific application. + * Get the roles associated with a client's scope for a specific client. * * @return */ @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache - public List getApplicationScopeMappings() { + public List getClientScopeMappings() { auth.requireView(); - Set mappings = app.getApplicationScopeMappings(client); + Set mappings = scopedClient.getClientScopeMappings(client); List mapRep = new ArrayList(); for (RoleModel roleModel : mappings) { mapRep.add(ModelToRepresentation.toRepresentation(roleModel)); @@ -58,49 +59,49 @@ public class ScopeMappedApplicationResource { } /** - * The available application-level roles that can be associated with the client's scope + * The available client-level roles that can be associated with the client's scope * * @return */ @Path("available") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache - public List getAvailableApplicationScopeMappings() { + public List getAvailableClientScopeMappings() { auth.requireView(); - Set roles = app.getRoles(); + Set roles = scopedClient.getRoles(); return ScopeMappedResource.getAvailable(client, roles); } /** - * Get effective application roles that are associated with the client's scope for a specific application. + * Get effective client roles that are associated with the client's scope for a specific client. * * @return */ @Path("composite") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache - public List getCompositeApplicationScopeMappings() { + public List getCompositeClientScopeMappings() { auth.requireView(); - Set roles = app.getRoles(); + Set roles = scopedClient.getRoles(); return ScopeMappedResource.getComposite(client, roles); } /** - * Add application-level roles to the client's scope + * Add client-level roles to the client's scope * * @param roles */ @POST - @Consumes("application/json") - public void addApplicationScopeMapping(List roles) { + @Consumes(MediaType.APPLICATION_JSON) + public void addClientScopeMapping(List roles) { auth.requireManage(); for (RoleRepresentation role : roles) { - RoleModel roleModel = app.getRole(role.getName()); + RoleModel roleModel = scopedClient.getRole(role.getName()); if (roleModel == null) { throw new NotFoundException("Role not found"); } @@ -110,24 +111,24 @@ public class ScopeMappedApplicationResource { } /** - * Remove application-level roles from the client's scope. + * Remove client-level roles from the client's scope. * * @param roles */ @DELETE - @Consumes("application/json") - public void deleteApplicationScopeMapping(List roles) { + @Consumes(MediaType.APPLICATION_JSON) + public void deleteClientScopeMapping(List roles) { auth.requireManage(); if (roles == null) { - Set roleModels = app.getApplicationScopeMappings(client); + Set roleModels = scopedClient.getClientScopeMappings(client); for (RoleModel roleModel : roleModels) { client.deleteScopeMapping(roleModel); } } else { for (RoleRepresentation role : roles) { - RoleModel roleModel = app.getRole(role.getName()); + RoleModel roleModel = scopedClient.getRole(role.getName()); if (roleModel == null) { throw new NotFoundException("Role not found"); } diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedResource.java index 28b63ced08a..8d4e005710e 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ScopeMappedResource.java @@ -18,6 +18,7 @@ import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -25,7 +26,7 @@ import java.util.Map; import java.util.Set; /** - * Base class for managing the scope mappings of a specific client (application or oauth). + * Base class for managing the scope mappings of a specific client. * * @author Bill Burke * @version $Revision: 1 $ @@ -49,7 +50,7 @@ public class ScopeMappedResource { * @return */ @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public MappingsRepresentation getScopeMappings() { auth.requireView(); @@ -68,7 +69,7 @@ public class ScopeMappedResource { if (clients.size() > 0) { Map clientMappings = new HashMap(); for (ClientModel client : clients) { - Set roleMappings = client.getApplicationScopeMappings(this.client); + Set roleMappings = client.getClientScopeMappings(this.client); if (roleMappings.size() > 0) { ClientMappingsRepresentation mappings = new ClientMappingsRepresentation(); mappings.setId(client.getId()); @@ -93,7 +94,7 @@ public class ScopeMappedResource { */ @Path("realm") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public List getRealmScopeMappings() { auth.requireView(); @@ -113,7 +114,7 @@ public class ScopeMappedResource { */ @Path("realm/available") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public List getAvailableRealmScopeMappings() { auth.requireView(); @@ -140,7 +141,7 @@ public class ScopeMappedResource { */ @Path("realm/composite") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public List getCompositeRealmScopeMappings() { auth.requireView(); @@ -164,7 +165,7 @@ public class ScopeMappedResource { */ @Path("realm") @POST - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void addRealmScopeMappings(List roles) { auth.requireManage(); @@ -186,7 +187,7 @@ public class ScopeMappedResource { */ @Path("realm") @DELETE - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void deleteRealmScopeMappings(List roles) { auth.requireManage(); @@ -200,32 +201,32 @@ public class ScopeMappedResource { for (RoleRepresentation role : roles) { RoleModel roleModel = realm.getRoleById(role.getId()); if (roleModel == null) { - throw new NotFoundException("Application not found"); + throw new NotFoundException("Client not found"); } client.deleteScopeMapping(roleModel); } } } - @Path("applications/{app}") - public ScopeMappedApplicationResource getApplicationScopeMappings(@PathParam("app") String appName) { - ClientModel app = realm.getClientByClientId(appName); + @Path("clients/{clientId}") + public ScopeMappedClientResource getClientScopeMappings(@PathParam("clientId") String clientId) { + ClientModel app = realm.getClientByClientId(clientId); if (app == null) { throw new NotFoundException("Role not found"); } - return new ScopeMappedApplicationResource(realm, auth, client, session, app); + return new ScopeMappedClientResource(realm, auth, client, session, app); } - @Path("applications-by-id/{appId}") - public ScopeMappedApplicationResource getApplicationByIdScopeMappings(@PathParam("appId") String appId) { - ClientModel app = realm.getClientById(appId); + @Path("clients-by-id/{id}") + public ScopeMappedClientResource getClientByIdScopeMappings(@PathParam("id") String id) { + ClientModel app = realm.getClientById(id); if (app == null) { - throw new NotFoundException("Application not found"); + throw new NotFoundException("Client not found"); } - return new ScopeMappedApplicationResource(realm, auth, client, session, app); + return new ScopeMappedClientResource(realm, auth, client, session, app); } } diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java index ec72cc146f4..322f60df94f 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java @@ -5,8 +5,8 @@ import org.keycloak.broker.provider.IdentityProvider; import org.keycloak.broker.provider.IdentityProviderFactory; import org.keycloak.events.EventListenerProvider; import org.keycloak.events.EventType; -import org.keycloak.exportimport.ApplicationImporter; -import org.keycloak.exportimport.ApplicationImporterFactory; +import org.keycloak.exportimport.ClientImporter; +import org.keycloak.exportimport.ClientImporterFactory; import org.keycloak.freemarker.Theme; import org.keycloak.freemarker.ThemeProvider; import org.keycloak.models.KeycloakSession; @@ -55,7 +55,7 @@ public class ServerInfoAdminResource { setThemes(info); setEventListeners(info); setProtocols(info); - setApplicationImporters(info); + setClientImporters(info); setProviders(info); setProtocolMapperTypes(info); setBuiltinProtocolMappers(info); @@ -167,14 +167,14 @@ public class ServerInfoAdminResource { } } - private void setApplicationImporters(ServerInfoRepresentation info) { - info.applicationImporters = new LinkedList>(); - for (ProviderFactory p : session.getKeycloakSessionFactory().getProviderFactories(ApplicationImporter.class)) { - ApplicationImporterFactory factory = (ApplicationImporterFactory)p; + private void setClientImporters(ServerInfoRepresentation info) { + info.clientImporters = new LinkedList>(); + for (ProviderFactory p : session.getKeycloakSessionFactory().getProviderFactories(ClientImporter.class)) { + ClientImporterFactory factory = (ClientImporterFactory)p; Map data = new HashMap(); data.put("id", factory.getId()); data.put("name", factory.getDisplayName()); - info.applicationImporters.add(data); + info.clientImporters.add(data); } } @@ -198,7 +198,7 @@ public class ServerInfoAdminResource { private List> socialProviders; public List> identityProviders; private List protocols; - private List> applicationImporters; + private List> clientImporters; private Map> providers; @@ -239,8 +239,8 @@ public class ServerInfoAdminResource { return protocols; } - public List> getApplicationImporters() { - return applicationImporters; + public List> getClientImporters() { + return clientImporters; } public Map> getProviders() { diff --git a/services/src/main/java/org/keycloak/services/resources/admin/UserApplicationRoleMappingsResource.java b/services/src/main/java/org/keycloak/services/resources/admin/UserClientRoleMappingsResource.java similarity index 60% rename from services/src/main/java/org/keycloak/services/resources/admin/UserApplicationRoleMappingsResource.java rename to services/src/main/java/org/keycloak/services/resources/admin/UserClientRoleMappingsResource.java index 2149ef95a57..e838333c618 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/UserApplicationRoleMappingsResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/UserClientRoleMappingsResource.java @@ -16,6 +16,7 @@ import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -25,79 +26,73 @@ import java.util.Set; * @author Bill Burke * @version $Revision: 1 $ */ -public class UserApplicationRoleMappingsResource { - protected static final Logger logger = Logger.getLogger(UserApplicationRoleMappingsResource.class); +public class UserClientRoleMappingsResource { + protected static final Logger logger = Logger.getLogger(UserClientRoleMappingsResource.class); protected RealmModel realm; protected RealmAuth auth; protected UserModel user; - protected ClientModel application; + protected ClientModel client; - public UserApplicationRoleMappingsResource(RealmModel realm, RealmAuth auth, UserModel user, ClientModel application) { + public UserClientRoleMappingsResource(RealmModel realm, RealmAuth auth, UserModel user, ClientModel client) { this.realm = realm; this.auth = auth; this.user = user; - this.application = application; + this.client = client; } /** - * Get application-level role mappings for this user for a specific app + * Get client-level role mappings for this user for a specific app * * @return */ @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache - public List getApplicationRoleMappings() { + public List getClientRoleMappings() { auth.requireView(); - logger.debug("getApplicationRoleMappings"); - - Set mappings = user.getApplicationRoleMappings(application); + Set mappings = user.getClientRoleMappings(client); List mapRep = new ArrayList(); for (RoleModel roleModel : mappings) { mapRep.add(ModelToRepresentation.toRepresentation(roleModel)); } - logger.debugv("getApplicationRoleMappings.size() = {0}", mapRep.size()); return mapRep; } /** - * Get effective application-level role mappings. This recurses any composite roles + * Get effective client-level role mappings. This recurses any composite roles * * @return */ @Path("composite") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache - public List getCompositeApplicationRoleMappings() { + public List getCompositeClientRoleMappings() { auth.requireView(); - logger.debug("getCompositeApplicationRoleMappings"); - - Set roles = application.getRoles(); + Set roles = client.getRoles(); List mapRep = new ArrayList(); for (RoleModel roleModel : roles) { if (user.hasRole(roleModel)) mapRep.add(ModelToRepresentation.toRepresentation(roleModel)); } - logger.debugv("getCompositeApplicationRoleMappings.size() = {0}", mapRep.size()); return mapRep; } /** - * Get available application-level roles that can be mapped to the user + * Get available client-level roles that can be mapped to the user * * @return */ @Path("available") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache - public List getAvailableApplicationRoleMappings() { + public List getAvailableClientRoleMappings() { auth.requireView(); - Set available = application.getRoles(); + Set available = client.getRoles(); return getAvailableRoles(user, available); } @@ -116,18 +111,17 @@ public class UserApplicationRoleMappingsResource { } /** - * Add application-level roles to the user role mapping. + * Add client-level roles to the user role mapping. * * @param roles */ @POST - @Consumes("application/json") - public void addApplicationRoleMapping(List roles) { + @Consumes(MediaType.APPLICATION_JSON) + public void addClientRoleMapping(List roles) { auth.requireManage(); - logger.debug("addApplicationRoleMapping"); for (RoleRepresentation role : roles) { - RoleModel roleModel = application.getRole(role.getName()); + RoleModel roleModel = client.getRole(role.getName()); if (roleModel == null || !roleModel.getId().equals(role.getId())) { throw new NotFoundException("Role not found"); } @@ -137,28 +131,28 @@ public class UserApplicationRoleMappingsResource { } /** - * Delete application-level roles from user role mapping. + * Delete client-level roles from user role mapping. * * @param roles */ @DELETE - @Consumes("application/json") - public void deleteApplicationRoleMapping(List roles) { + @Consumes(MediaType.APPLICATION_JSON) + public void deleteClientRoleMapping(List roles) { auth.requireManage(); if (roles == null) { - Set roleModels = user.getApplicationRoleMappings(application); + Set roleModels = user.getClientRoleMappings(client); for (RoleModel roleModel : roleModels) { if (!(roleModel.getContainer() instanceof ClientModel)) { - ClientModel app = (ClientModel) roleModel.getContainer(); - if (!app.getId().equals(application.getId())) continue; + ClientModel client = (ClientModel) roleModel.getContainer(); + if (!client.getId().equals(this.client.getId())) continue; } user.deleteRoleMapping(roleModel); } } else { for (RoleRepresentation role : roles) { - RoleModel roleModel = application.getRole(role.getName()); + RoleModel roleModel = client.getRole(role.getName()); if (roleModel == null || !roleModel.getId().equals(role.getId())) { throw new NotFoundException("Role not found"); } diff --git a/services/src/main/java/org/keycloak/services/resources/admin/UserFederationResource.java b/services/src/main/java/org/keycloak/services/resources/admin/UserFederationResource.java index 006124bc156..188cb30ae39 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/UserFederationResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/UserFederationResource.java @@ -28,6 +28,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.util.LinkedList; @@ -67,7 +68,7 @@ public class UserFederationResource { @GET @NoCache @Path("providers") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public List getProviders() { auth.requireView(); List providers = new LinkedList(); @@ -88,7 +89,7 @@ public class UserFederationResource { @GET @NoCache @Path("providers/{id}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public UserFederationProviderFactoryRepresentation getProvider(@PathParam("id") String id) { auth.requireView(); for (ProviderFactory factory : session.getKeycloakSessionFactory().getProviderFactories(UserFederationProvider.class)) { @@ -111,7 +112,7 @@ public class UserFederationResource { */ @POST @Path("instances") - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response createProviderInstance(UserFederationProviderRepresentation rep) { auth.requireManage(); String displayName = rep.getDisplayName(); @@ -133,7 +134,7 @@ public class UserFederationResource { */ @PUT @Path("instances/{id}") - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void updateProviderInstance(@PathParam("id") String id, UserFederationProviderRepresentation rep) { auth.requireManage(); String displayName = rep.getDisplayName(); @@ -155,7 +156,7 @@ public class UserFederationResource { @GET @NoCache @Path("instances/{id}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public UserFederationProviderRepresentation getProviderInstance(@PathParam("id") String id) { auth.requireView(); for (UserFederationProviderModel model : realm.getUserFederationProviders()) { @@ -191,7 +192,7 @@ public class UserFederationResource { */ @GET @Path("instances") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public List getUserFederationInstances() { auth.requireManage(); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java b/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java index eec34c8d655..8bad8982eff 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java @@ -106,7 +106,7 @@ public class UsersResource { */ @Path("{username}") @PUT - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response updateUser(final @PathParam("username") String username, final UserRepresentation rep) { auth.requireManage(); @@ -137,7 +137,7 @@ public class UsersResource { * @return */ @POST - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response createUser(final @Context UriInfo uriInfo, final UserRepresentation rep) { auth.requireManage(); @@ -209,7 +209,7 @@ public class UsersResource { @Path("{username}") @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public UserRepresentation getUser(final @PathParam("username") String username) { auth.requireView(); @@ -311,7 +311,7 @@ public class UsersResource { } /** - * Remove all user sessions associated with this user. And, for all applications that have an admin URL, tell + * Remove all user sessions associated with this user. And, for all client that have an admin URL, tell * them to invalidate the sessions for this particular user. * * @param username username (not id!) @@ -368,7 +368,7 @@ public class UsersResource { */ @GET @NoCache - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public List getUsers(@QueryParam("search") String search, @QueryParam("lastName") String last, @QueryParam("firstName") String first, @@ -418,7 +418,7 @@ public class UsersResource { */ @Path("{username}/role-mappings") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public MappingsRepresentation getRoleMappings(@PathParam("username") String username) { auth.requireView(); @@ -439,21 +439,21 @@ public class UsersResource { all.setRealmMappings(realmRep); } - List applications = realm.getClients(); - if (applications.size() > 0) { + List clients = realm.getClients(); + if (clients.size() > 0) { Map appMappings = new HashMap(); - for (ClientModel application : applications) { - Set roleMappings = user.getApplicationRoleMappings(application); + for (ClientModel client : clients) { + Set roleMappings = user.getClientRoleMappings(client); if (roleMappings.size() > 0) { ClientMappingsRepresentation mappings = new ClientMappingsRepresentation(); - mappings.setId(application.getId()); - mappings.setClient(application.getClientId()); + mappings.setId(client.getId()); + mappings.setClient(client.getClientId()); List roles = new ArrayList(); mappings.setMappings(roles); for (RoleModel role : roleMappings) { roles.add(ModelToRepresentation.toRepresentation(role)); } - appMappings.put(application.getClientId(), mappings); + appMappings.put(client.getClientId(), mappings); all.setClientMappings(appMappings); } } @@ -469,7 +469,7 @@ public class UsersResource { */ @Path("{username}/role-mappings/realm") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public List getRealmRoleMappings(@PathParam("username") String username) { auth.requireView(); @@ -495,7 +495,7 @@ public class UsersResource { */ @Path("{username}/role-mappings/realm/composite") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public List getCompositeRealmRoleMappings(@PathParam("username") String username) { auth.requireView(); @@ -523,7 +523,7 @@ public class UsersResource { */ @Path("{username}/role-mappings/realm/available") @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) @NoCache public List getAvailableRealmRoleMappings(@PathParam("username") String username) { auth.requireView(); @@ -534,7 +534,7 @@ public class UsersResource { } Set available = realm.getRoles(); - return UserApplicationRoleMappingsResource.getAvailableRoles(user, available); + return UserClientRoleMappingsResource.getAvailableRoles(user, available); } /** @@ -545,7 +545,7 @@ public class UsersResource { */ @Path("{username}/role-mappings/realm") @POST - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void addRealmRoleMappings(@PathParam("username") String username, List roles) { auth.requireManage(); @@ -574,7 +574,7 @@ public class UsersResource { */ @Path("{username}/role-mappings/realm") @DELETE - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void deleteRealmRoleMappings(@PathParam("username") String username, List roles) { auth.requireManage(); @@ -601,36 +601,36 @@ public class UsersResource { } } - @Path("{username}/role-mappings/applications/{app}") - public UserApplicationRoleMappingsResource getUserApplicationRoleMappingsResource(@PathParam("username") String username, @PathParam("app") String appName) { + @Path("{username}/role-mappings/clients/{clientId}") + public UserClientRoleMappingsResource getUserClientRoleMappingsResource(@PathParam("username") String username, @PathParam("clientId") String clientId) { UserModel user = session.users().getUserByUsername(username, realm); if (user == null) { throw new NotFoundException("User not found"); } - ClientModel application = realm.getClientByClientId(appName); + ClientModel client = realm.getClientByClientId(clientId); - if (application == null) { - throw new NotFoundException("Application not found"); + if (client == null) { + throw new NotFoundException("Client not found"); } - return new UserApplicationRoleMappingsResource(realm, auth, user, application); + return new UserClientRoleMappingsResource(realm, auth, user, client); } - @Path("{username}/role-mappings/applications-by-id/{appId}") - public UserApplicationRoleMappingsResource getUserApplicationRoleMappingsResourceById(@PathParam("username") String username, @PathParam("appId") String appId) { + @Path("{username}/role-mappings/clients-by-id/{id}") + public UserClientRoleMappingsResource getUserClientRoleMappingsResourceById(@PathParam("username") String username, @PathParam("id") String id) { UserModel user = session.users().getUserByUsername(username, realm); if (user == null) { throw new NotFoundException("User not found"); } - ClientModel application = realm.getClientById(appId); + ClientModel client = realm.getClientById(id); - if (application == null) { - throw new NotFoundException("Application not found"); + if (client == null) { + throw new NotFoundException("Client not found"); } - return new UserApplicationRoleMappingsResource(realm, auth, user, application); + return new UserClientRoleMappingsResource(realm, auth, user, client); } /** @@ -642,7 +642,7 @@ public class UsersResource { */ @Path("{username}/reset-password") @PUT - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void resetPassword(@PathParam("username") String username, CredentialRepresentation pass) { auth.requireManage(); @@ -670,7 +670,7 @@ public class UsersResource { */ @Path("{username}/remove-totp") @PUT - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public void removeTotp(@PathParam("username") String username) { auth.requireManage(); @@ -685,7 +685,7 @@ public class UsersResource { /** * Send an email to the user with a link they can click to reset their password. * The redirectUri and clientId parameters are optional. The default for the - * redirect is the account application. + * redirect is the account client. * * @param username username (not id!) * @param redirectUri redirect uri @@ -694,7 +694,7 @@ public class UsersResource { */ @Path("{username}/reset-password-email") @PUT - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response resetPasswordEmail(@PathParam("username") String username, @QueryParam(OIDCLoginProtocol.REDIRECT_URI_PARAM) String redirectUri, @QueryParam(OIDCLoginProtocol.CLIENT_ID_PARAM) String clientId) { auth.requireManage(); @@ -716,7 +716,7 @@ public class UsersResource { } if(clientId == null){ - clientId = Constants.ACCOUNT_MANAGEMENT_APP; + clientId = Constants.ACCOUNT_MANAGEMENT_CLIENT_ID; } ClientModel client = realm.getClientByClientId(clientId); diff --git a/services/src/main/resources/META-INF/services/org.keycloak.provider.Spi b/services/src/main/resources/META-INF/services/org.keycloak.provider.Spi index cb0145565eb..e1c0b912821 100755 --- a/services/src/main/resources/META-INF/services/org.keycloak.provider.Spi +++ b/services/src/main/resources/META-INF/services/org.keycloak.provider.Spi @@ -1,4 +1,4 @@ org.keycloak.protocol.LoginProtocolSpi org.keycloak.protocol.ProtocolMapperSpi -org.keycloak.exportimport.ApplicationImportSpi +org.keycloak.exportimport.ClientImportSpi org.keycloak.wellknown.WellKnownSpi \ No newline at end of file diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/account/AccountTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/account/AccountTest.java index 8e22acf35cf..999fdb875fe 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/account/AccountTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/account/AccountTest.java @@ -25,7 +25,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.keycloak.events.Details; @@ -75,7 +74,7 @@ public class AccountTest { public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) { UserModel user = manager.getSession().users().getUserByUsername("test-user@localhost", appRealm); - ClientModel accountApp = appRealm.getClientNameMap().get(org.keycloak.models.Constants.ACCOUNT_MANAGEMENT_APP); + ClientModel accountApp = appRealm.getClientNameMap().get(org.keycloak.models.Constants.ACCOUNT_MANAGEMENT_CLIENT_ID); UserModel user2 = manager.getSession().users().addUser(appRealm, "test-user-no-access@localhost"); user2.setEnabled(true); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/account/ProfileTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/account/ProfileTest.java index a189032dc0d..44ebaf17125 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/account/ProfileTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/account/ProfileTest.java @@ -53,7 +53,7 @@ public class ProfileTest { user.setAttribute("key1", "value1"); user.setAttribute("key2", "value2"); - ClientModel accountApp = appRealm.getClientByClientId(org.keycloak.models.Constants.ACCOUNT_MANAGEMENT_APP); + ClientModel accountApp = appRealm.getClientByClientId(org.keycloak.models.Constants.ACCOUNT_MANAGEMENT_CLIENT_ID); UserModel user2 = manager.getSession().users().addUser(appRealm, "test-user-no-access@localhost"); user2.setEnabled(true); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/adapter/AdapterTestStrategy.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/adapter/AdapterTestStrategy.java index dcbdcbf6c38..b73b013f10b 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/adapter/AdapterTestStrategy.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/adapter/AdapterTestStrategy.java @@ -22,7 +22,6 @@ package org.keycloak.testsuite.adapter; import org.junit.Assert; -import org.junit.Test; import org.junit.rules.ExternalResource; import org.keycloak.Config; import org.keycloak.OAuth2Constants; @@ -137,7 +136,7 @@ public class AdapterTestStrategy extends ExternalResource { RealmManager manager = new RealmManager(session); RealmModel adminRealm = manager.getRealm(Config.getAdminRealm()); - ClientModel adminConsole = adminRealm.getClientByClientId(Constants.ADMIN_CONSOLE_APPLICATION); + ClientModel adminConsole = adminRealm.getClientByClientId(Constants.ADMIN_CONSOLE_CLIENT_ID); TokenManager tm = new TokenManager(); UserModel admin = session.users().getUserByUsername("admin", adminRealm); ClientSessionModel clientSession = session.sessions().createClientSession(adminRealm, adminConsole); @@ -574,7 +573,7 @@ public class AdapterTestStrategy extends ExternalResource { loginAndCheckSession(driver, loginPage); // logout mposolda with admin client - Keycloak keycloakAdmin = Keycloak.getInstance(AUTH_SERVER_URL, "master", "admin", "admin", Constants.ADMIN_CONSOLE_APPLICATION); + Keycloak keycloakAdmin = Keycloak.getInstance(AUTH_SERVER_URL, "master", "admin", "admin", Constants.ADMIN_CONSOLE_CLIENT_ID); keycloakAdmin.realm("demo").clients().get("session-portal").logoutUser("mposolda"); // bburke should be still logged with original httpSession in our browser window diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/adapter/RelativeUriAdapterTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/adapter/RelativeUriAdapterTest.java index b56232ecc05..8361845e777 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/adapter/RelativeUriAdapterTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/adapter/RelativeUriAdapterTest.java @@ -85,7 +85,7 @@ public class RelativeUriAdapterTest { deployApplication("customer-db", "/customer-db", CustomerDatabaseServlet.class, url.getPath(), "user"); url = getClass().getResource("/adapter-test/product-keycloak-relative.json"); deployApplication("product-portal", "/product-portal", ProductServlet.class, url.getPath(), "user"); - ClientModel adminConsole = adminRealm.getClientByClientId(Constants.ADMIN_CONSOLE_APPLICATION); + ClientModel adminConsole = adminRealm.getClientByClientId(Constants.ADMIN_CONSOLE_CLIENT_ID); TokenManager tm = new TokenManager(); UserModel admin = session.users().getUserByUsername("admin", adminRealm); ClientSessionModel clientSession = session.sessions().createClientSession(realm, adminConsole); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/AbstractClientTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/AbstractClientTest.java index d221df0669c..1a8c554edab 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/AbstractClientTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/AbstractClientTest.java @@ -8,10 +8,8 @@ import org.keycloak.admin.client.resource.RealmResource; import org.keycloak.models.Constants; import org.keycloak.models.RealmModel; import org.keycloak.models.utils.KeycloakModelUtils; -import org.keycloak.representations.idm.ApplicationRepresentation; import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.IdentityProviderRepresentation; -import org.keycloak.representations.idm.OAuthClientRepresentation; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.services.managers.RealmManager; import org.keycloak.testsuite.rule.KeycloakRule; @@ -49,7 +47,7 @@ public abstract class AbstractClientTest { } }); - keycloak = Keycloak.getInstance("http://localhost:8081/auth", "master", "admin", "admin", Constants.ADMIN_CONSOLE_APPLICATION); + keycloak = Keycloak.getInstance("http://localhost:8081/auth", "master", "admin", "admin", Constants.ADMIN_CONSOLE_CLIENT_ID); realm = keycloak.realm(REALM_NAME); } diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/AdminAPITest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/AdminAPITest.java index a8a4292049e..b3a7ca614e0 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/AdminAPITest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/AdminAPITest.java @@ -77,7 +77,7 @@ public class AdminAPITest { RealmManager manager = new RealmManager(session); RealmModel adminRealm = manager.getRealm(Config.getAdminRealm()); - ClientModel adminConsole = adminRealm.getClientByClientId(Constants.ADMIN_CONSOLE_APPLICATION); + ClientModel adminConsole = adminRealm.getClientByClientId(Constants.ADMIN_CONSOLE_CLIENT_ID); TokenManager tm = new TokenManager(); UserModel admin = session.users().getUserByUsername("admin", adminRealm); ClientSessionModel clientSession = session.sessions().createClientSession(adminRealm, adminConsole); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/model/AdapterTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/model/AdapterTest.java index e7440ab20dd..0e489144301 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/model/AdapterTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/model/AdapterTest.java @@ -469,7 +469,7 @@ public class AdapterTest extends AbstractModelTest { // Role "foo" is default realm role Assert.assertTrue(user.hasRole(realmModel.getRole("foo"))); - roles = user.getApplicationRoleMappings(application); + roles = user.getClientRoleMappings(application); Assert.assertEquals(roles.size(), 2); assertRolesContains(application.getRole("user"), roles); assertRolesContains(appBarRole, roles); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ImportTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ImportTest.java index 13b019a4348..54f4cbeeddb 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ImportTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/model/ImportTest.java @@ -86,7 +86,7 @@ public class ImportTest extends AbstractModelTest { // Test applications imported ClientModel application = realm.getClientByClientId("Application"); ClientModel otherApp = realm.getClientByClientId("OtherApp"); - ClientModel accountApp = realm.getClientByClientId(Constants.ACCOUNT_MANAGEMENT_APP); + ClientModel accountApp = realm.getClientByClientId(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID); ClientModel nonExisting = realm.getClientByClientId("NonExisting"); Assert.assertNotNull(application); Assert.assertNotNull(otherApp); @@ -130,7 +130,7 @@ public class ImportTest extends AbstractModelTest { Assert.assertEquals(1, realmRoles.size()); Assert.assertEquals("admin", realmRoles.iterator().next().getName()); - Set appRoles = admin.getApplicationRoleMappings(application); + Set appRoles = admin.getClientRoleMappings(application); Assert.assertEquals(1, appRoles.size()); Assert.assertEquals("app-admin", appRoles.iterator().next().getName()); @@ -149,7 +149,7 @@ public class ImportTest extends AbstractModelTest { Set realmScopes = oauthClient.getRealmScopeMappings(); Assert.assertTrue(realmScopes.contains(realm.getRole("admin"))); - Set appScopes = application.getApplicationScopeMappings(oauthClient); + Set appScopes = application.getClientScopeMappings(oauthClient); Assert.assertTrue(appScopes.contains(application.getRole("app-user"))); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/saml/SamlBindingTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/saml/SamlBindingTest.java index 000eaad3f18..6997697aa4d 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/saml/SamlBindingTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/saml/SamlBindingTest.java @@ -419,7 +419,7 @@ public class SamlBindingTest { RealmManager manager = new RealmManager(session); RealmModel adminRealm = manager.getRealm(Config.getAdminRealm()); - ClientModel adminConsole = adminRealm.getClientByClientId(Constants.ADMIN_CONSOLE_APPLICATION); + ClientModel adminConsole = adminRealm.getClientByClientId(Constants.ADMIN_CONSOLE_CLIENT_ID); TokenManager tm = new TokenManager(); UserModel admin = session.users().getUserByUsername("admin", adminRealm); ClientSessionModel clientSession = session.sessions().createClientSession(adminRealm, adminConsole); diff --git a/testsuite/integration/src/test/resources/testrealm.json b/testsuite/integration/src/test/resources/testrealm.json index b33febcd544..c9b67085bab 100755 --- a/testsuite/integration/src/test/resources/testrealm.json +++ b/testsuite/integration/src/test/resources/testrealm.json @@ -47,16 +47,6 @@ } } ], - "oauthClients" : [ - { - "name" : "third-party", - "enabled": true, - "redirectUris": [ - "http://localhost:8081/app/*" - ], - "secret": "password" - } - ], "scopeMappings": [ { "client": "third-party", @@ -69,7 +59,7 @@ ], "clients": [ { - "name": "test-app", + "clientId": "test-app", "enabled": true, "baseUrl": "http://localhost:8081/app", "redirectUris": [ @@ -77,7 +67,17 @@ ], "adminUrl": "http://localhost:8081/app/logout", "secret": "password" - } + }, + { + "clientId" : "third-party", + "enabled": true, + "consentRequired": true, + + "redirectUris": [ + "http://localhost:8081/app/*" + ], + "secret": "password" + } ], "roles" : { "realm" : [