Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
67f10bee24
8 files changed
+64
-21
No files matched your search
@@ -44,7 +44,7 @@
|
||||
<listitem>
|
||||
<para>
|
||||
For OAuth clients, you would also see a "Direct Access Only" switch when creating the OAuth Client.
|
||||
This switch is for oauth clients that only use the <link linkend='direct-access-grant'>Direct Access Grant</link>
|
||||
This switch is for oauth clients that only use the <link linkend='direct-access-grants'>Direct Access Grant</link>
|
||||
protocol to obtain access tokens.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
@@ -35,12 +35,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"roleMappings": [
|
||||
{
|
||||
"username": "user",
|
||||
"roles": ["user"]
|
||||
}
|
||||
],
|
||||
"scopeMappings": [
|
||||
{
|
||||
"client": "cordova",
|
||||
@@ -52,17 +46,10 @@
|
||||
"name": "cordova",
|
||||
"enabled": true,
|
||||
"publicClient": true,
|
||||
"redirectUris": []
|
||||
"redirectUris": ["http://localhost"],
|
||||
"webOrigins": ["localhost"]
|
||||
}
|
||||
],
|
||||
"applicationRoleMappings": {
|
||||
"account": [
|
||||
{
|
||||
"username": "user",
|
||||
"roles": ["view-profile", "manage-account"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"applicationScopeMappings": {
|
||||
"account": [
|
||||
{
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
<gap:plugin name="org.apache.cordova.inappbrowser" />
|
||||
|
||||
<access origin="http://*"/>
|
||||
<access origin="*"/>
|
||||
</widget>
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
document.addEventListener("deviceready", function() {
|
||||
keycloak.init({ onLoad: 'check-sso' });
|
||||
keycloak.init({ onLoad: 'check-sso' }).success(updateState);
|
||||
}, false);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -112,7 +112,7 @@ Next thing you have to do is import the test realm for the demo. Clicking on th
|
||||
create realm page in the Admin UI. The username/password is admin/admin to login in. Keycloak will ask you to
|
||||
create a new admin password before you can go to the create realm page.
|
||||
|
||||
[http://localhost:8080/auth/admin/index.html#/create/realm](http://localhost:8080/auth/admin/index.html#/create/realm)
|
||||
[http://localhost:8080/auth/admin/master/console/#/create/realm](http://localhost:8080/auth/admin/master/console/#/create/realm)
|
||||
|
||||
Import the testrealm.json file that is in the preconfigured-demo/ example directory.
|
||||
|
||||
|
||||
@@ -190,6 +190,12 @@ public class UsersResource {
|
||||
for (Map.Entry<String, String> attr : rep.getAttributes().entrySet()) {
|
||||
user.setAttribute(attr.getKey(), attr.getValue());
|
||||
}
|
||||
|
||||
for (String key : user.getAttributes().keySet()) {
|
||||
if (!rep.getAttributes().containsKey(key)) {
|
||||
user.removeAttribute(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
"cacheThemes": "${keycloak.theme.cacheThemes:true}",
|
||||
"folder": {
|
||||
"dir": "${keycloak.theme.dir}"
|
||||
},
|
||||
"welcomeTheme": "logo-example"
|
||||
}
|
||||
},
|
||||
|
||||
"login": {
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
@@ -149,4 +150,54 @@ public class UserTest extends AbstractClientTest {
|
||||
assertEquals(0, user.getSocialLinks().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void attributes() {
|
||||
UserRepresentation user1 = new UserRepresentation();
|
||||
user1.setUsername("user1");
|
||||
user1.attribute("attr1", "value1user1");
|
||||
user1.attribute("attr2", "value2user1");
|
||||
realm.users().create(user1);
|
||||
|
||||
UserRepresentation user2 = new UserRepresentation();
|
||||
user2.setUsername("user2");
|
||||
user2.attribute("attr1", "value1user2");
|
||||
user2.attribute("attr2", "value2user2");
|
||||
realm.users().create(user2);
|
||||
|
||||
user1 = realm.users().get("user1").toRepresentation();
|
||||
assertEquals(2, user1.getAttributes().size());
|
||||
assertEquals("value1user1", user1.getAttributes().get("attr1"));
|
||||
assertEquals("value2user1", user1.getAttributes().get("attr2"));
|
||||
|
||||
user2 = realm.users().get("user2").toRepresentation();
|
||||
assertEquals(2, user2.getAttributes().size());
|
||||
assertEquals("value1user2", user2.getAttributes().get("attr1"));
|
||||
assertEquals("value2user2", user2.getAttributes().get("attr2"));
|
||||
|
||||
user1.attribute("attr1", "value3user1");
|
||||
user1.attribute("attr3", "value4user1");
|
||||
|
||||
realm.users().get("user1").update(user1);
|
||||
|
||||
user1 = realm.users().get("user1").toRepresentation();
|
||||
assertEquals(3, user1.getAttributes().size());
|
||||
assertEquals("value3user1", user1.getAttributes().get("attr1"));
|
||||
assertEquals("value2user1", user1.getAttributes().get("attr2"));
|
||||
assertEquals("value4user1", user1.getAttributes().get("attr3"));
|
||||
|
||||
user1.getAttributes().remove("attr1");
|
||||
realm.users().get("user1").update(user1);
|
||||
|
||||
user1 = realm.users().get("user1").toRepresentation();
|
||||
assertEquals(2, user1.getAttributes().size());
|
||||
assertEquals("value2user1", user1.getAttributes().get("attr2"));
|
||||
assertEquals("value4user1", user1.getAttributes().get("attr3"));
|
||||
|
||||
user1.getAttributes().clear();
|
||||
realm.users().get("user1").update(user1);
|
||||
|
||||
user1 = realm.users().get("user1").toRepresentation();
|
||||
assertNull(user1.getAttributes());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user