diff --git a/connections/jpa/src/main/java/org/keycloak/connections/jpa/updater/JpaUpdaterProvider.java b/connections/jpa/src/main/java/org/keycloak/connections/jpa/updater/JpaUpdaterProvider.java index c1f58433a4..60b063513e 100755 --- a/connections/jpa/src/main/java/org/keycloak/connections/jpa/updater/JpaUpdaterProvider.java +++ b/connections/jpa/src/main/java/org/keycloak/connections/jpa/updater/JpaUpdaterProvider.java @@ -12,7 +12,7 @@ public interface JpaUpdaterProvider extends Provider { public String FIRST_VERSION = "1.0.0.Final"; - public String LAST_VERSION = "1.5.0"; + public String LAST_VERSION = "1.6.0"; public String getCurrentVersionSql(String defaultSchema); diff --git a/pom.xml b/pom.xml index dc18d038e6..3ef78c33e2 100755 --- a/pom.xml +++ b/pom.xml @@ -56,8 +56,7 @@ 7.5.0.Final-redhat-15 1.0.2.Final - 2.2 - 1.14.1-beta + 3.2.1 2011.1 1.0.1 2.3.23 diff --git a/social/facebook/src/main/java/org/keycloak/social/facebook/FacebookIdentityProvider.java b/social/facebook/src/main/java/org/keycloak/social/facebook/FacebookIdentityProvider.java index 3a6b25b67f..c193e82ea3 100755 --- a/social/facebook/src/main/java/org/keycloak/social/facebook/FacebookIdentityProvider.java +++ b/social/facebook/src/main/java/org/keycloak/social/facebook/FacebookIdentityProvider.java @@ -17,7 +17,7 @@ public class FacebookIdentityProvider extends AbstractOAuth2IdentityProvider imp public static final String AUTH_URL = "https://graph.facebook.com/oauth/authorize"; public static final String TOKEN_URL = "https://graph.facebook.com/oauth/access_token"; - public static final String PROFILE_URL = "https://graph.facebook.com/me"; + public static final String PROFILE_URL = "https://graph.facebook.com/me?fields=id,name,email,first_name,last_name"; public static final String DEFAULT_SCOPE = "email"; public FacebookIdentityProvider(OAuth2IdentityProviderConfig config) { diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/admin/ApiUtil.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/admin/ApiUtil.java index eb202e5cd3..a196fc7601 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/admin/ApiUtil.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/admin/ApiUtil.java @@ -25,8 +25,8 @@ import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.jboss.logging.Logger; import org.keycloak.admin.client.resource.ClientResource; -import org.keycloak.admin.client.resource.RoleScopeResource; import org.keycloak.admin.client.resource.UserResource; import org.keycloak.representations.idm.CredentialRepresentation; import static org.keycloak.representations.idm.CredentialRepresentation.PASSWORD; @@ -37,6 +37,8 @@ import org.keycloak.representations.idm.UserRepresentation; * Created by st on 28.05.15. */ public class ApiUtil { + + private static final Logger log = Logger.getLogger(ApiUtil.class); public static String getCreatedId(Response response) { URI location = response.getLocation(); @@ -96,16 +98,32 @@ public class ApiUtil { userResource.resetPassword(newCredential); } - public static void assignClientRoles(UserResource userResource, String clientId, String... roles) { - RoleScopeResource rsr = userResource.roles().clientLevel(clientId); - List rolesList = Arrays.asList(roles); - List realmMgmtRoles = new ArrayList<>(); - for (RoleRepresentation rr : rsr.listAvailable()) { - if (rolesList.contains(rr.getName())) { - realmMgmtRoles.add(rr); + public static void assignClientRoles(RealmResource realm, String userId, String clientName, String... roles) { + String realmName = realm.toRepresentation().getRealm(); + String clientId = ""; + for (ClientRepresentation clientRepresentation : realm.clients().findAll()) { + if (clientRepresentation.getClientId().equals(clientName)) { + clientId = clientRepresentation.getId(); } } - rsr.add(realmMgmtRoles); + + if (!clientId.isEmpty()) { + ClientResource clientResource = realm.clients().get(clientId); + + List roleRepresentations = new ArrayList<>(); + for (String roleName : roles) { + RoleRepresentation role = clientResource.roles().get(roleName).toRepresentation(); + roleRepresentations.add(role); + } + + UserResource userResource = realm.users().get(userId); + log.debug("assigning roles: " + Arrays.toString(roles) + " to user: \"" + + userResource.toRepresentation().getUsername() + "\" of client: \"" + + clientName + "\" in realm: \"" + realmName + "\""); + userResource.roles().clientLevel(clientId).add(roleRepresentations); + } else { + log.warn("client with name " + clientName + "doesn't exist in realm " + realmName); + } } } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/Config.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/Config.java index be84772e0f..fc22df1200 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/Config.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/Config.java @@ -2,6 +2,7 @@ package org.keycloak.testsuite.console.page.events; import org.keycloak.testsuite.console.page.fragment.OnOffSwitch; import org.keycloak.testsuite.page.Form; +import static org.keycloak.testsuite.util.WaitUtils.*; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -101,5 +102,9 @@ public class Config extends Events { public void clearAdminEvents() { clearAdminEventsButton.click(); } + + public void waitForClearEventsButtonPresent() { + waitAjaxForElement(clearLoginEventsButton); + } } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractAuthTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractAuthTest.java index 98aa62ef56..31c9b77e57 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractAuthTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractAuthTest.java @@ -1,3 +1,20 @@ +/* + * JBoss, Home of Professional Open Source + * + * Copyright 2013 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.keycloak.testsuite; import java.text.MessageFormat; @@ -10,7 +27,7 @@ import org.keycloak.admin.client.resource.RealmResource; import static org.keycloak.representations.idm.CredentialRepresentation.PASSWORD; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.representations.idm.UserRepresentation; -import static org.keycloak.testsuite.admin.ApiUtil.createUserAndResetPasswordWithAdminClient; +import static org.keycloak.testsuite.admin.ApiUtil.*; import static org.keycloak.testsuite.admin.Users.setPasswordFor; import org.keycloak.testsuite.auth.page.AuthRealm; import static org.keycloak.testsuite.auth.page.AuthRealm.TEST; @@ -56,6 +73,8 @@ public abstract class AbstractAuthTest extends AbstractKeycloakTest { log.debug("creating test user"); String id = createUserAndResetPasswordWithAdminClient(testRealmResource(), testUser, PASSWORD); testUser.setId(id); + + assignClientRoles(testRealmResource(), id, "realm-management", "view-realm"); } public static UserRepresentation createUserRepresentation(String username, String email, String firstName, String lastName, boolean enabled) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java index 078c56df0c..d8d112463b 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java @@ -21,14 +21,14 @@ import static org.keycloak.representations.idm.CredentialRepresentation.PASSWORD public class LoginEventsTest extends AbstractConsoleTest { @Page private LoginEvents loginEventsPage; - @Page private Config configPage; - + @Before public void beforeLoginEventsTest() { configPage.navigateTo(); configPage.form().setSaveEvents(true); + configPage.form().waitForClearEventsButtonPresent(); configPage.form().addSaveType("LOGIN"); configPage.form().addSaveType("LOGIN_ERROR"); configPage.form().addSaveType("LOGOUT");