Skip to content

Commit

Permalink
Merge pull request #427 from shlomomdahan/JENKINS-73909
Browse files Browse the repository at this point in the history
[JENKINS-73909] un-inline script in `config.jelly` and fix existing behavior
  • Loading branch information
jtnord authored Oct 11, 2024
2 parents b409831 + 45809bf commit 5b97484
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<f:password/>
</f:entry>

<st:adjunct includes="org.jenkinsci.plugins.oic.OicSecurityRealm.logout-idp-toggle" />

<f:dropdownDescriptorSelector field="serverConfiguration" title="${%ConfigurationMode}" default="${descriptor.defaultServerConfigurationType}"/>

<f:section title="${%AdvancedConfiguration}">
Expand All @@ -30,8 +32,8 @@
<f:entry title="${%SendScopesInTokenRequest}" field="sendScopesInTokenRequest">
<f:checkbox/>
</f:entry>
<f:entry title="${%PostLogoutRedirectUrl}" field="postLogoutRedirectUrl">
<f:textbox/>
<f:entry title="${%PostLogoutRedirectUrl}" field="postLogoutRedirectUrl" class="endSessionConfig">
<f:textbox />
</f:entry>

<f:advanced title="${%SecurityConfiguration}">
Expand Down Expand Up @@ -86,19 +88,6 @@
</f:section>

<st:once>
<script type="text/javascript">

window.addEventListener('load', function() {
var logoutFromIDP = document.getElementById('logoutFromIDP');
var endSessionConfig = document.getElementById('endSessionConfig');

endSessionConfig.hidden = !logoutFromIDP.checked

logoutFromIDP.addEventListener("change", (event)=>{
endSessionConfig.hidden = !logoutFromIDP.checked;
});
})
</script>
</st:once>

</j:jelly>
Original file line number Diff line number Diff line change
@@ -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";
});
}
});

0 comments on commit 5b97484

Please sign in to comment.