diff --git a/examples/demo-template/customer-app-js/src/main/webapp/customers/view.html b/examples/demo-template/customer-app-js/src/main/webapp/customers/view.html
index 36ef79f38f..ee38261cb5 100755
--- a/examples/demo-template/customer-app-js/src/main/webapp/customers/view.html
+++ b/examples/demo-template/customer-app-js/src/main/webapp/customers/view.html
@@ -1,25 +1,52 @@
Customer View Page
-
+
Goto: logout
-User made this request.
+User made this request.
+User details (from )
+Username:
+Email:
+Full Name:
+First:
+Last:
+
Customer Listing
diff --git a/integration/js/src/main/resources/META-INF/resources/js/keycloak.js b/integration/js/src/main/resources/META-INF/resources/js/keycloak.js
index 525366372d..b3a6af4871 100755
--- a/integration/js/src/main/resources/META-INF/resources/js/keycloak.js
+++ b/integration/js/src/main/resources/META-INF/resources/js/keycloak.js
@@ -194,13 +194,22 @@ var Keycloak = function (options) {
if (token) {
window.oauth.token = token;
kc.token = token;
-
kc.tokenParsed = JSON.parse(atob(token.split('.')[1]));
kc.authenticated = true;
kc.subject = kc.tokenParsed.sub;
kc.realmAccess = kc.tokenParsed.realm_access;
kc.resourceAccess = kc.tokenParsed.resource_access;
+ for (var i = 0; i < idTokenProperties.length; i++) {
+ var n = idTokenProperties[i];
+ if (kc.tokenParsed[n]) {
+ if (!kc.idToken) {
+ kc.idToken = {};
+ }
+ kc.idToken[n] = kc.tokenParsed[n];
+ }
+ }
+
setTimeout(function() {
successCallback && successCallback({ authenticated: kc.authenticated, subject: kc.subject });
}, 0);
@@ -260,6 +269,35 @@ var Keycloak = function (options) {
var uuid = s.join('');
return uuid;
}
+
+ var idTokenProperties = [
+ "name",
+ "given_name",
+ "family_name",
+ "middle_name",
+ "nickname",
+ "preferred_username",
+ "profile",
+ "picture",
+ "website",
+ "email",
+ "email_verified",
+ "gender",
+ "birthdate",
+ "zoneinfo",
+ "locale",
+ "phone_number",
+ "phone_number_verified",
+ "address",
+ "updated_at",
+ "formatted",
+ "street_address",
+ "locality",
+ "region",
+ "postal_code",
+ "country",
+ "claims_locales"
+ ]
}
window.oauth = (function () {
diff --git a/testsuite/integration/src/main/java/org/keycloak/testutils/KeycloakServer.java b/testsuite/integration/src/main/java/org/keycloak/testutils/KeycloakServer.java
index 68d6c5ef7b..0a0e463066 100755
--- a/testsuite/integration/src/main/java/org/keycloak/testutils/KeycloakServer.java
+++ b/testsuite/integration/src/main/java/org/keycloak/testutils/KeycloakServer.java
@@ -202,11 +202,12 @@ public class KeycloakServer {
try {
RealmManager manager = new RealmManager(session);
- if (rep.getId() == null) {
- throw new RuntimeException("Realm id not specified");
+ if (rep.getId() != null && manager.getRealm(rep.getId()) != null) {
+ info("Not importing realm " + rep.getRealm() + " realm already exists");
+ return;
}
- if (manager.getRealm(rep.getId()) != null) {
+ if (manager.getRealmByName(rep.getRealm()) != null) {
info("Not importing realm " + rep.getRealm() + " realm already exists");
return;
}
@@ -268,7 +269,7 @@ public class KeycloakServer {
server.deploy(di);
- factory = ((KeycloakApplication)deployment.getApplication()).getFactory();
+ factory = ((KeycloakApplication) deployment.getApplication()).getFactory();
setupDevConfig();