From 1b6cb7b2a9e0e3455deb4df25f47cbea9c98ffeb Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Wed, 27 Sep 2023 13:38:53 +0200 Subject: [PATCH] Always check storage access before placing test cookie (#23393) --- js/libs/keycloak-js/src/keycloak.js | 9 +++- .../oidc/endpoints/3p-cookies-step1.html | 54 ++++++------------- .../oidc/endpoints/3p-cookies-step2.html | 2 +- .../oidc/endpoints/login-status-iframe.html | 21 +++++++- 4 files changed, 42 insertions(+), 44 deletions(-) diff --git a/js/libs/keycloak-js/src/keycloak.js b/js/libs/keycloak-js/src/keycloak.js index 74cecd1aee..03312d8c78 100755 --- a/js/libs/keycloak-js/src/keycloak.js +++ b/js/libs/keycloak-js/src/keycloak.js @@ -1275,12 +1275,17 @@ function Keycloak (config) { if (event.data !== "supported" && event.data !== "unsupported") { return; } else if (event.data === "unsupported") { + logWarn( + "[KEYCLOAK] Your browser is blocking access to 3rd-party cookies, this means:\n\n" + + " - It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).\n" + + " - It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).\n\n" + + "For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers" + ); + loginIframe.enable = false; if (kc.silentCheckSsoFallback) { kc.silentCheckSsoRedirectUri = false; } - logWarn("[KEYCLOAK] 3rd party cookies aren't supported by this browser. checkLoginIframe and " + - "silent check-sso are not available.") } document.body.removeChild(iframe); diff --git a/services/src/main/resources/org/keycloak/protocol/oidc/endpoints/3p-cookies-step1.html b/services/src/main/resources/org/keycloak/protocol/oidc/endpoints/3p-cookies-step1.html index 7051421e5e..b07bcf9baf 100644 --- a/services/src/main/resources/org/keycloak/protocol/oidc/endpoints/3p-cookies-step1.html +++ b/services/src/main/resources/org/keycloak/protocol/oidc/endpoints/3p-cookies-step1.html @@ -1,66 +1,42 @@ - + diff --git a/services/src/main/resources/org/keycloak/protocol/oidc/endpoints/3p-cookies-step2.html b/services/src/main/resources/org/keycloak/protocol/oidc/endpoints/3p-cookies-step2.html index 06a7f02335..3a2d566b20 100644 --- a/services/src/main/resources/org/keycloak/protocol/oidc/endpoints/3p-cookies-step2.html +++ b/services/src/main/resources/org/keycloak/protocol/oidc/endpoints/3p-cookies-step2.html @@ -1,7 +1,7 @@ - +