From 42d30a5a70cd2a1e390b3ecbfda1c9ffa257a5fc Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Wed, 26 Feb 2014 22:23:04 -0500 Subject: [PATCH] rename scope rep username to client --- .../representations/idm/RealmRepresentation.java | 2 +- .../idm/ScopeMappingRepresentation.java | 10 +++++----- examples/demo-template/testrealm.json | 6 +++--- model/tests/src/test/resources/testcomposites.json | 6 +++--- model/tests/src/test/resources/testrealm-demo.json | 2 +- model/tests/src/test/resources/testrealm.json | 4 ++-- .../keycloak/services/managers/ApplicationManager.java | 2 +- .../org/keycloak/services/managers/RealmManager.java | 2 +- .../integration/src/test/resources/testcomposite.json | 6 +++--- .../integration/src/test/resources/testrealm.json | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java index dbca8743e7..d8434b9c32 100755 --- a/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java @@ -159,7 +159,7 @@ public class RealmRepresentation { public ScopeMappingRepresentation scopeMapping(String username) { ScopeMappingRepresentation mapping = new ScopeMappingRepresentation(); - mapping.setUsername(username); + mapping.setClient(username); if (scopeMappings == null) scopeMappings = new ArrayList(); scopeMappings.add(mapping); return mapping; diff --git a/core/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java index b65196f3b3..7780cd8457 100755 --- a/core/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java @@ -9,7 +9,7 @@ import java.util.Set; */ public class ScopeMappingRepresentation { protected String self; // link - protected String username; + protected String client; protected Set roles; public String getSelf() { @@ -20,12 +20,12 @@ public class ScopeMappingRepresentation { this.self = self; } - public String getUsername() { - return username; + public String getClient() { + return client; } - public void setUsername(String username) { - this.username = username; + public void setClient(String client) { + this.client = client; } public Set getRoles() { diff --git a/examples/demo-template/testrealm.json b/examples/demo-template/testrealm.json index 9f0fb13eaa..5bcd82b87f 100755 --- a/examples/demo-template/testrealm.json +++ b/examples/demo-template/testrealm.json @@ -44,15 +44,15 @@ ], "scopeMappings": [ { - "username": "third-party", + "client": "third-party", "roles": ["user"] }, { - "username": "customer-portal", + "client": "customer-portal", "roles": ["user"] }, { - "username": "product-portal", + "client": "product-portal", "roles": ["user"] } diff --git a/model/tests/src/test/resources/testcomposites.json b/model/tests/src/test/resources/testcomposites.json index 6c11b4eac7..c884a0fd05 100755 --- a/model/tests/src/test/resources/testcomposites.json +++ b/model/tests/src/test/resources/testcomposites.json @@ -91,11 +91,11 @@ ], "scopeMappings": [ { - "username": "REALM_COMPOSITE_1_APPLICATION", + "client": "REALM_COMPOSITE_1_APPLICATION", "roles": ["REALM_COMPOSITE_1"] }, { - "username": "REALM_ROLE_1_APPLICATION", + "client": "REALM_ROLE_1_APPLICATION", "roles": ["REALM_ROLE_1"] } ], @@ -221,7 +221,7 @@ "applicationScopeMappings": { "APP_ROLE_APPLICATION": [ { - "username": "APP_COMPOSITE_APPLICATION", + "client": "APP_COMPOSITE_APPLICATION", "roles": ["APP_ROLE_2"] } ] diff --git a/model/tests/src/test/resources/testrealm-demo.json b/model/tests/src/test/resources/testrealm-demo.json index 136a14424f..b565740865 100755 --- a/model/tests/src/test/resources/testrealm-demo.json +++ b/model/tests/src/test/resources/testrealm-demo.json @@ -53,7 +53,7 @@ ], "scopeMappings": [ { - "username": "third-party", + "client": "third-party", "roles": ["user"] } ], diff --git a/model/tests/src/test/resources/testrealm.json b/model/tests/src/test/resources/testrealm.json index e1148da464..caeea6c40f 100755 --- a/model/tests/src/test/resources/testrealm.json +++ b/model/tests/src/test/resources/testrealm.json @@ -119,7 +119,7 @@ ], "scopeMappings": [ { - "username": "oauthclient", + "client": "oauthclient", "roles": ["admin"] } ], @@ -148,7 +148,7 @@ "applicationScopeMappings": { "Application": [ { - "username": "oauthclient", + "client": "oauthclient", "roles": ["app-user"] } ] diff --git a/services/src/main/java/org/keycloak/services/managers/ApplicationManager.java b/services/src/main/java/org/keycloak/services/managers/ApplicationManager.java index 746b4d5591..db10338088 100755 --- a/services/src/main/java/org/keycloak/services/managers/ApplicationManager.java +++ b/services/src/main/java/org/keycloak/services/managers/ApplicationManager.java @@ -123,7 +123,7 @@ public class ApplicationManager { if (role == null) { role = applicationModel.addRole(roleString.trim()); } - ClientModel client = realm.findClient(mapping.getUsername()); + ClientModel client = realm.findClient(mapping.getClient()); realm.addScopeMapping(client, role); } } 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 632504ad96..1fa6e10463 100755 --- a/services/src/main/java/org/keycloak/services/managers/RealmManager.java +++ b/services/src/main/java/org/keycloak/services/managers/RealmManager.java @@ -361,7 +361,7 @@ public class RealmManager { if (role == null) { role = newRealm.addRole(roleString.trim()); } - UserModel user = userMap.get(scope.getUsername()); + UserModel user = userMap.get(scope.getClient()); ClientModel client = newRealm.findClient(user.getLoginName()); newRealm.addScopeMapping(client, role); } diff --git a/testsuite/integration/src/test/resources/testcomposite.json b/testsuite/integration/src/test/resources/testcomposite.json index cfdd2c73c5..e6753fb31e 100755 --- a/testsuite/integration/src/test/resources/testcomposite.json +++ b/testsuite/integration/src/test/resources/testcomposite.json @@ -91,11 +91,11 @@ ], "scopeMappings": [ { - "username": "REALM_COMPOSITE_1_APPLICATION", + "client": "REALM_COMPOSITE_1_APPLICATION", "roles": ["REALM_COMPOSITE_1"] }, { - "username": "REALM_ROLE_1_APPLICATION", + "client": "REALM_ROLE_1_APPLICATION", "roles": ["REALM_ROLE_1"] } ], @@ -221,7 +221,7 @@ "applicationScopeMappings": { "APP_ROLE_APPLICATION": [ { - "username": "APP_COMPOSITE_APPLICATION", + "client": "APP_COMPOSITE_APPLICATION", "roles": ["APP_ROLE_2"] } ] diff --git a/testsuite/integration/src/test/resources/testrealm.json b/testsuite/integration/src/test/resources/testrealm.json index 72db7ca928..59eefc85da 100755 --- a/testsuite/integration/src/test/resources/testrealm.json +++ b/testsuite/integration/src/test/resources/testrealm.json @@ -46,11 +46,11 @@ ], "scopeMappings": [ { - "username": "third-party", + "client": "third-party", "roles": ["user"] }, { - "username": "test-app", + "client": "test-app", "roles": ["user"] } ], @@ -105,7 +105,7 @@ "applicationScopeMappings": { "test-app": [ { - "username": "third-party", + "client": "third-party", "roles": ["customer-user"] } ]