unknownPath
.
*
diff --git a/services/src/main/java/org/keycloak/storage/openshift/OpenshiftSAClientAdapter.java b/services/src/main/java/org/keycloak/storage/openshift/OpenshiftSAClientAdapter.java
old mode 100644
new mode 100755
diff --git a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/HardcodedClientStorageProvider.java b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/HardcodedClientStorageProvider.java
old mode 100644
new mode 100755
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/OAuth2DeviceVerificationPage.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/OAuth2DeviceVerificationPage.java
new file mode 100644
index 0000000000..c3b0f9795d
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/OAuth2DeviceVerificationPage.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2019 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * 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.pages;
+
+import org.junit.Assert;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+
+/**
+ * @author Hiroyuki Wada
+ */
+public class OAuth2DeviceVerificationPage extends LanguageComboboxAwarePage {
+
+ @FindBy(id = "device-user-code")
+ private WebElement userCodeInput;
+
+ @FindBy(css = "input[type=\"submit\"]")
+ private WebElement submitButton;
+
+ @FindBy(className = "alert-error")
+ private WebElement verifyErrorMessage;
+
+ public void submit(String userCode) {
+ userCodeInput.clear();
+ if (userCode != null) {
+ userCodeInput.sendKeys(userCode);
+ }
+ submitButton.click();
+ }
+
+ public String getError() {
+ return verifyErrorMessage != null ? verifyErrorMessage.getText() : null;
+ }
+
+ @Override
+ public boolean isCurrent() {
+ if (driver.getTitle().startsWith("Log in to ")) {
+ try {
+ driver.findElement(By.id("device-user-code"));
+ return true;
+ } catch (Throwable t) {
+ }
+ }
+ return false;
+ }
+
+ public void assertLoginPage() {
+ String name = getClass().getSimpleName();
+ Assert.assertTrue("Expected device login page but was " + driver.getTitle() + " (" + driver.getCurrentUrl() + ")",
+ isLoginPage());
+ }
+
+ public void assertApprovedPage() {
+ String name = getClass().getSimpleName();
+ Assert.assertTrue("Expected device approved page but was " + driver.getTitle() + " (" + driver.getCurrentUrl() + ")",
+ isApprovedPage());
+ }
+
+ public void assertDeniedPage() {
+ String name = getClass().getSimpleName();
+ Assert.assertTrue("Expected device denied page but was " + driver.getTitle() + " (" + driver.getCurrentUrl() + ")",
+ isDeniedPage());
+ }
+
+ private boolean isLoginPage() {
+ if (driver.getTitle().startsWith("Log in to ")) {
+ try {
+ driver.findElement(By.id("username"));
+ driver.findElement(By.id("password"));
+ return true;
+ } catch (Throwable t) {
+ }
+ }
+ return false;
+ }
+
+ private boolean isApprovedPage() {
+ if (driver.getTitle().startsWith("Log in to ")) {
+ try {
+ driver.findElement(By.id("kc-page-title")).getText().equals("Device Login Successful");
+ return true;
+ } catch (Throwable t) {
+ }
+ }
+ return false;
+ }
+
+ private boolean isDeniedPage() {
+ if (driver.getTitle().startsWith("Log in to ")) {
+ try {
+ driver.findElement(By.id("kc-page-title")).getText().equals("Device Login Failed");
+ driver.findElement(By.className("instruction")).getText().equals("Consent denied for connecting the device.");
+ return true;
+ } catch (Throwable t) {
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void open() {
+ }
+}
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/OAuthClient.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/OAuthClient.java
index 48e41d981d..db739f47c6 100644
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/OAuthClient.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/OAuthClient.java
@@ -68,6 +68,8 @@ import org.keycloak.representations.JsonWebToken;
import org.keycloak.representations.RefreshToken;
import org.keycloak.representations.UserInfo;
import org.keycloak.representations.idm.UserRepresentation;
+import org.keycloak.services.resources.RealmsResource;
+import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
import org.keycloak.testsuite.runonserver.RunOnServerException;
import org.keycloak.util.BasicAuthHelper;
import org.keycloak.util.JsonSerialization;
@@ -860,6 +862,71 @@ public class OAuthClient {
}
}
+ public DeviceAuthorizationResponse doDeviceAuthorizationRequest(String clientId, String clientSecret) throws Exception {
+ try (CloseableHttpClient client = httpClient.get()) {
+ HttpPost post = new HttpPost(getDeviceAuthorizationUrl());
+
+ List