From d5fe2db59b2d218702128515e08a735096718e22 Mon Sep 17 00:00:00 2001 From: kathari00 Date: Thu, 19 Mar 2026 09:21:27 +0100 Subject: [PATCH 1/2] Add keycloak.v2 device verification template Signed-off-by: kathari00 --- .../login-oauth2-device-verify-user-code.ftl | 17 +++ ...ogin-passkeys-conditional-authenticate.ftl | 136 ++++++++++++++++++ 2 files changed, 153 insertions(+) create mode 100644 themes/src/main/resources/theme/keycloak.v2/login/login-oauth2-device-verify-user-code.ftl create mode 100644 themes/src/main/resources/theme/keycloak.v2/login/login-passkeys-conditional-authenticate.ftl diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login-oauth2-device-verify-user-code.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login-oauth2-device-verify-user-code.ftl new file mode 100644 index 00000000000..37bba408bf5 --- /dev/null +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-oauth2-device-verify-user-code.ftl @@ -0,0 +1,17 @@ +<#import "template.ftl" as layout> +<#import "field.ftl" as field> +<#import "buttons.ftl" as buttons> +<@layout.registrationLayout; section> + + <#if section = "header"> + ${msg("oauth2DeviceVerificationTitle")} + <#elseif section = "form"> +
+ <@field.input name="device_user_code" label=msg("verifyOAuth2DeviceUserCode") autofocus=true /> + + <@buttons.actionGroup> + <@buttons.button id="kc-login" label="doSubmit" class=["kcButtonPrimaryClass", "kcButtonBlockClass"] /> + +
+ + diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login-passkeys-conditional-authenticate.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login-passkeys-conditional-authenticate.ftl new file mode 100644 index 00000000000..d797ac66a79 --- /dev/null +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-passkeys-conditional-authenticate.ftl @@ -0,0 +1,136 @@ +<#import "template.ftl" as layout> +<#import "field.ftl" as field> +<#import "buttons.ftl" as buttons> +<@layout.registrationLayout displayInfo=(realm.registrationAllowed && !registrationDisabled??); section> + + <#if section = "title"> + title + <#elseif section = "header"> + ${msg("passkey-login-title")} + <#elseif section = "form"> +
+ + + + + + +
+ +
+ <#if authenticators??> +
+ <#list authenticators.authenticators as authenticator> + + +
+ + <#if shouldDisplayAuthenticators?? && shouldDisplayAuthenticators> + <#if authenticators.authenticators?size gt 1> +

${msg("passkey-available-authenticators")}

+ + +
+ <#list authenticators.authenticators as authenticator> +
+
+ +
+
+
+ ${authenticator.label} +
+ + <#if authenticator.transports?? && authenticator.transports.displayNameProperties?has_content> +
+ <#list authenticator.transports.displayNameProperties as nameProperty> + ${msg(nameProperty)} + <#if nameProperty?has_next> + , + + +
+ + +
+ + ${msg('passkey-createdAt-label')} + + + ${authenticator.createdAt} + +
+
+
+
+ +
+ + + +
+
+ <#if realm.password> + + + +
+
+
+ + + + <#elseif section = "info"> + <#if realm.registrationAllowed && !registrationDisabled??> +
+ ${msg("noAccount")} ${msg("doRegister")} +
+ + + + From 78cfb4701427234e11b03cbec3cd225797e83d4b Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Wed, 8 Apr 2026 18:13:48 +0200 Subject: [PATCH 2/2] Adjusting the test suite to new field names Signed-off-by: Alexander Schwartz --- .../pages/OAuth2DeviceVerificationPage.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 index c8c6fae02f4..cb1d5ef8356 100644 --- 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 @@ -27,11 +27,12 @@ public class OAuth2DeviceVerificationPage extends LanguageComboboxAwarePage { private static final String CONSENT_DENIED_MESSAGE = "Consent denied for connecting the device."; - - @FindBy(id = "device-user-code") + public static final String DEVICE_USER_CODE = "device_user_code"; + + @FindBy(name = DEVICE_USER_CODE) private WebElement userCodeInput; - @FindBy(css = "input[type=\"submit\"]") + @FindBy(css = "button[type=\"submit\"]") private WebElement submitButton; @FindBy(className = "pf-v5-c-alert") @@ -53,7 +54,7 @@ public String getError() { public boolean isCurrent() { if (driver.getTitle().startsWith("Sign in to ")) { try { - driver.findElement(By.id("device-user-code")); + driver.findElement(By.id(DEVICE_USER_CODE)); return true; } catch (Throwable t) { } @@ -106,7 +107,7 @@ private boolean isDeniedPage() { private boolean isInvalidUserCodePage() { if (driver.getTitle().startsWith("Sign in to ")) { try { - driver.findElement(By.id("device-user-code")); + driver.findElement(By.id(DEVICE_USER_CODE)); return driver.findElement(By.id("kc-page-title")).getText().equals("Device Login") && driver.findElement(By.className("pf-m-danger")).getText().equals("Invalid code, please try again."); } catch (Throwable t) { @@ -118,7 +119,7 @@ private boolean isInvalidUserCodePage() { private boolean isExpiredUserCodePage() { if (driver.getTitle().startsWith("Sign in to ")) { try { - driver.findElement(By.id("device-user-code")); + driver.findElement(By.id(DEVICE_USER_CODE)); return driver.findElement(By.id("kc-page-title")).getText().equals("Device Login") && driver.findElement(By.className("pf-m-danger")).getText().equals("The code has expired. Please go back to your device and try connecting again."); } catch (Throwable t) {