From 45809bf66169417f390d70e4ef8d4f887a70286f Mon Sep 17 00:00:00 2001
From: shlomomdahan <64103471+shlomomdahan@users.noreply.github.com>
Date: Fri, 11 Oct 2024 10:10:15 -0400
Subject: [PATCH] un-inline script in config.jelly and fix existing behavior
---
.../plugins/oic/OicSecurityRealm/config.jelly | 19 ++++---------------
.../oic/OicSecurityRealm/logout-idp-toggle.js | 12 ++++++++++++
2 files changed, 16 insertions(+), 15 deletions(-)
create mode 100644 src/main/resources/org/jenkinsci/plugins/oic/OicSecurityRealm/logout-idp-toggle.js
diff --git a/src/main/resources/org/jenkinsci/plugins/oic/OicSecurityRealm/config.jelly b/src/main/resources/org/jenkinsci/plugins/oic/OicSecurityRealm/config.jelly
index 42de2c18..b781edab 100644
--- a/src/main/resources/org/jenkinsci/plugins/oic/OicSecurityRealm/config.jelly
+++ b/src/main/resources/org/jenkinsci/plugins/oic/OicSecurityRealm/config.jelly
@@ -7,6 +7,8 @@
+
+
@@ -30,8 +32,8 @@
-
-
+
+
@@ -86,19 +88,6 @@
-
diff --git a/src/main/resources/org/jenkinsci/plugins/oic/OicSecurityRealm/logout-idp-toggle.js b/src/main/resources/org/jenkinsci/plugins/oic/OicSecurityRealm/logout-idp-toggle.js
new file mode 100644
index 00000000..ca2462b7
--- /dev/null
+++ b/src/main/resources/org/jenkinsci/plugins/oic/OicSecurityRealm/logout-idp-toggle.js
@@ -0,0 +1,12 @@
+Behaviour.specify("#logoutFromIDP", 'oic-security-realm', 0, function(logoutFromIDP) {
+
+ var endSessionConfig = document.querySelector('.endSessionConfig');
+
+ if (endSessionConfig && logoutFromIDP) {
+ endSessionConfig.style.display = logoutFromIDP.checked ? "block" : "none";
+
+ logoutFromIDP.addEventListener("change", function() {
+ endSessionConfig.style.display = logoutFromIDP.checked ? "block" : "none";
+ });
+ }
+});