From 2b6ae2fef21281f44a7a07b8331c8eed65842b24 Mon Sep 17 00:00:00 2001 From: oadham Date: Wed, 13 Aug 2025 16:02:39 +0200 Subject: [PATCH 01/16] update gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index db75fcc..b6a886e 100644 --- a/.gitignore +++ b/.gitignore @@ -151,6 +151,8 @@ fabric.properties !.idea/codeStyles !.idea/runConfigurations +/.idea/codeStyles/codeStyleConfig.xml +/.idea/codeStyles/Project.xml ### Maven ### target/ @@ -173,3 +175,4 @@ buildNumber.properties # End of https://www.toptal.com/developers/gitignore/api/maven,intellij+all,eclipse /patch-tool/.work/ + From d50fabc6cdf18ce7268cf588d5c4267c0171a799 Mon Sep 17 00:00:00 2001 From: oadham Date: Tue, 3 Mar 2026 13:29:16 +0100 Subject: [PATCH 02/16] .gitignore .idea folder entirely --- .gitignore | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index df6cd6e..8253d04 100644 --- a/.gitignore +++ b/.gitignore @@ -98,12 +98,7 @@ local.properties # When using Gradle or Maven with auto-import, you should exclude module files, # since they will be recreated, and may cause churn. Uncomment if using # auto-import. -.idea/artifacts -.idea/compiler.xml -.idea/jarRepositories.xml -.idea/modules.xml -.idea/*.iml -.idea/modules +.idea *.iml *.ipr From cde6fe156c7f8691122a28bb5bc96c45135333e1 Mon Sep 17 00:00:00 2001 From: oadham Date: Fri, 22 May 2026 11:58:35 +0200 Subject: [PATCH 03/16] Frontend: No longer prefill "metadata validUntil" field at all, instead of default value 0 days aka the past. --- .../resources/saml-extended-frontend/pages/addprovider.html | 2 +- .../resources/saml-extended-frontend/pages/editprovider.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/saml-extended-frontend/pages/addprovider.html b/src/main/resources/saml-extended-frontend/pages/addprovider.html index c417d61..ebead45 100644 --- a/src/main/resources/saml-extended-frontend/pages/addprovider.html +++ b/src/main/resources/saml-extended-frontend/pages/addprovider.html @@ -874,7 +874,7 @@
Metadata expires in
- + + '; ClassRefs_items.appendChild(newItem); }); - + document.body.addEventListener("click", function (e) { if (e.target.classList.contains("delete")) { e.preventDefault(); @@ -240,39 +240,39 @@ wantAuthnRequestsSigned.addEventListener("change", function () { }); }); - const deleteButtonsDeclRefs = document.querySelectorAll(".delete1"); - const addButtonDeclRefs = document.getElementById("addDeclRefs"); - const DeclRefs_items = document.getElementById("DeclRefs_items"); +const deleteButtonsDeclRefs = document.querySelectorAll(".delete1"); +const addButtonDeclRefs = document.getElementById("addDeclRefs"); +const DeclRefs_items = document.getElementById("DeclRefs_items"); + +deleteButtonsDeclRefs.forEach(function (button) { + button.style.display = "inline"; +}); +addButtonDeclRefs.addEventListener("click", function (e) { deleteButtonsDeclRefs.forEach(function (button) { button.style.display = "inline"; }); + + const newItem = document.createElement("div"); + newItem.className = "next-referral col-4"; + newItem.innerHTML = ''; + DeclRefs_items.appendChild(newItem); +}); - addButtonDeclRefs.addEventListener("click", function (e) { - deleteButtonsDeclRefs.forEach(function (button) { - button.style.display = "inline"; - }); - - const newItem = document.createElement("div"); - newItem.className = "next-referral col-4"; - newItem.innerHTML = ''; - DeclRefs_items.appendChild(newItem); - }); - - document.body.addEventListener("click", function (e) { - if (e.target.classList.contains("delete1")) { - e.preventDefault(); - const items = DeclRefs_items.querySelectorAll(".next-referral"); - if (items.length > 0) { - items[items.length - 1].remove(); - deleteButtonsDeclRefs.forEach(function (button, index) { - if (index === items.length - 1) { - button.style.display = "inline"; - } - }); - } +document.body.addEventListener("click", function (e) { + if (e.target.classList.contains("delete1")) { + e.preventDefault(); + const items = DeclRefs_items.querySelectorAll(".next-referral"); + if (items.length > 0) { + items[items.length - 1].remove(); + deleteButtonsDeclRefs.forEach(function (button, index) { + if (index === items.length - 1) { + button.style.display = "inline"; + } + }); } - + } + }); @@ -284,8 +284,8 @@ validateSignatures.addEventListener("change", function () { if (validateSignatures.checked) { validateSignatures.value = true; additionalField1.removeAttribute("disabled"); - - + + } else { validateSignatures.value = false; @@ -298,31 +298,31 @@ var Artifact_Resolution = document.getElementById("Artifact_Resolution"); Artifact_Resolution.addEventListener("change", function () { - if (Artifact_Resolution.checked) { - Artifact_Resolution.value = true; - additionalField_endpoint.removeAttribute("disabled"); - - } - else { - Artifact_Resolution.value = false; - additionalField_endpoint.setAttribute("disabled", "true"); - additionalField_endpoint.value = ''; - ; - } -} + if (Artifact_Resolution.checked) { + Artifact_Resolution.value = true; + additionalField_endpoint.removeAttribute("disabled"); + + } + else { + Artifact_Resolution.value = false; + additionalField_endpoint.setAttribute("disabled", "true"); + additionalField_endpoint.value = ''; + ; + } + } ); const Sign_Artifact_Resolution_Request = document.getElementById("Sign_Artifact_Resolution_Request"); Sign_Artifact_Resolution_Request.addEventListener("change", function () { handleCheckboxValue(Sign_Artifact_Resolution_Request); - + }); const ArtifactResolution_via_HTTP_ARTIFACT = document.getElementById("ArtifactResolution_via_HTTP_ARTIFACT"); ArtifactResolution_via_HTTP_ARTIFACT.addEventListener("change", function () { handleCheckboxValue(ArtifactResolution_via_HTTP_ARTIFACT); - + }); @@ -330,7 +330,7 @@ ArtifactResolution_via_HTTP_ARTIFACT.addEventListener("change", function () { const Artifact_Resolution_with_SOAP = document.getElementById("Artifact_Resolution_with_SOAP"); Artifact_Resolution_with_SOAP.addEventListener("change", function () { handleCheckboxValue(Artifact_Resolution_with_SOAP); - + }); @@ -338,7 +338,7 @@ Artifact_Resolution_with_SOAP.addEventListener("change", function () { const Artifact_Resolution_with_XML_header = document.getElementById("Artifact_Resolution_with_XML_header"); Artifact_Resolution_with_XML_header.addEventListener("change", function () { handleCheckboxValue(Artifact_Resolution_with_XML_header); - + }); @@ -350,11 +350,11 @@ Mutual_TLS.addEventListener("change", function () { principalType_input.addEventListener('change', function () { if (principalType_input.value == "ATTRIBUTE" || principalType_input.value == "FRIENDLY_ATTRIBUTE") { principalAttribute_input.removeAttribute("disabled"); - + } else { principalAttribute_input.value = ''; principalAttribute_input.setAttribute("disabled", "true"); - + } - + }); diff --git a/src/main/resources/saml-extended-frontend/js/CheckBoxControllerEditProvider.js b/src/main/resources/saml-extended-frontend/js/CheckBoxControllerEditProvider.js index 1ef3631..f2d8223 100644 --- a/src/main/resources/saml-extended-frontend/js/CheckBoxControllerEditProvider.js +++ b/src/main/resources/saml-extended-frontend/js/CheckBoxControllerEditProvider.js @@ -1,368 +1,365 @@ document.addEventListener('DOMContentLoaded', function() { -storedData = localStorage.getItem('pluginData'); -var pluginData = JSON.parse(storedData); -backchannel.value = pluginData.config.backchannelSupported ? pluginData.config.backchannelSupported : false; -backchannel.addEventListener("change", function () { - handleCheckboxValue(backchannel); -}); - - -const allowCreate = document.getElementById("allowCreate"); -allowCreate.value = pluginData.config.allowCreate ? pluginData.config.allowCreate : false; -allowCreate.addEventListener("change", function () { - handleCheckboxValue(allowCreate); -}); - - - - -const httpPostBindingResponse = document.getElementById("httpPostBindingResponse"); -httpPostBindingResponse.value = pluginData.config.postBindingResponse ? pluginData.config.postBindingResponse : false; -httpPostBindingResponse.addEventListener("change", function () { - handleCheckboxValue(httpPostBindingResponse); - - -}); - - - - - - -const httpPostBindingAuthnRequest = document.getElementById("httpPostBindingAuthnRequest"); -httpPostBindingAuthnRequest.value = pluginData.config.postBindingAuthnRequest ? pluginData.config.postBindingAuthnRequest : false; -httpPostBindingAuthnRequest.addEventListener("change", function () { - handleCheckboxValue(httpPostBindingAuthnRequest); - -}); - -const httpPostBindingLogout = document.getElementById("httpPostBindingLogout"); -httpPostBindingLogout.value = pluginData.config.postBindingLogout ? pluginData.config.postBindingLogout : false; -httpPostBindingLogout.addEventListener("change", function () { - handleCheckboxValue(httpPostBindingLogout); - -}); - - -const wantAssertionsSigned = document.getElementById("wantAssertionsSigned"); -wantAssertionsSigned.value = pluginData.config.wantAssertionsSigned ? pluginData.config.wantAssertionsSigned : false; -wantAssertionsSigned.addEventListener("change", function () { - handleCheckboxValue(wantAssertionsSigned); - -}); - - -const wantAssertionsEncrypted = document.getElementById("wantAssertionsEncrypted"); -wantAssertionsEncrypted.value = pluginData.config.wantAssertionsEncrypted ? pluginData.config.wantAssertionsEncrypted : false; -wantAssertionsEncrypted.addEventListener("change", function () { - handleCheckboxValue(wantAssertionsEncrypted); - -}); - - -const forceAuthentication = document.getElementById("forceAuthentication"); -forceAuthentication.value = pluginData.config.forceAuthn ? pluginData.config.forceAuthn : false; -forceAuthentication.addEventListener("change", function () { - handleCheckboxValue(forceAuthentication); -}); - - - -const signMetadata = document.getElementById("signMetadata"); -signMetadata.value = pluginData.config.signSpMetadata ? pluginData.config.signSpMetadata : false -signMetadata.addEventListener("change", function () { - handleCheckboxValue(signMetadata); - -}); - - -const passSubject = document.getElementById("passSubject"); -passSubject.value = pluginData.config.loginHint ? pluginData.config.loginHint : false; -passSubject.addEventListener("change", function () { - handleCheckboxValue(passSubject); - -}); - - -const storeToken = document.getElementById("storeToken"); -storeToken.value = pluginData.storeToken ? pluginData.storeToken : false; -storeToken.addEventListener("change", function () { - handleCheckboxValue(storeToken); - -}); - - -const storedTokensReadable = document.getElementById("storedTokensReadable"); -storedTokensReadable.value = pluginData.addReadTokenRoleOnCreate ? pluginData.addReadTokenRoleOnCreate : false; -storedTokensReadable.addEventListener("change", function () { - handleCheckboxValue(storedTokensReadable); - -}); - + storedData = localStorage.getItem('pluginData'); + var pluginData = JSON.parse(storedData); + backchannel.value = pluginData.config.backchannelSupported ? pluginData.config.backchannelSupported : false; + backchannel.addEventListener("change", function () { + handleCheckboxValue(backchannel); + }); + + + const allowCreate = document.getElementById("allowCreate"); + allowCreate.value = pluginData.config.allowCreate ? pluginData.config.allowCreate : false; + allowCreate.addEventListener("change", function () { + handleCheckboxValue(allowCreate); + }); + + const httpPostBindingResponse = document.getElementById("httpPostBindingResponse"); + httpPostBindingResponse.value = pluginData.config.postBindingResponse ? pluginData.config.postBindingResponse : false; + httpPostBindingResponse.addEventListener("change", function () { + handleCheckboxValue(httpPostBindingResponse); + }); + + const artifactBindingResponse = document.getElementById("artifactBindingResponse"); + artifactBindingResponse.checked = pluginData.config.artifactBindingResponse === 'true'; + artifactBindingResponse.value = artifactBindingResponse.checked; + artifactBindingResponse.addEventListener("change", function () { + handleCheckboxValue(artifactBindingResponse); + }); + + const httpPostBindingAuthnRequest = document.getElementById("httpPostBindingAuthnRequest"); + httpPostBindingAuthnRequest.value = pluginData.config.postBindingAuthnRequest ? pluginData.config.postBindingAuthnRequest : false; + httpPostBindingAuthnRequest.addEventListener("change", function () { + handleCheckboxValue(httpPostBindingAuthnRequest); + + }); + + const httpPostBindingLogout = document.getElementById("httpPostBindingLogout"); + httpPostBindingLogout.value = pluginData.config.postBindingLogout ? pluginData.config.postBindingLogout : false; + httpPostBindingLogout.addEventListener("change", function () { + handleCheckboxValue(httpPostBindingLogout); + + }); + + + const wantAssertionsSigned = document.getElementById("wantAssertionsSigned"); + wantAssertionsSigned.value = pluginData.config.wantAssertionsSigned ? pluginData.config.wantAssertionsSigned : false; + wantAssertionsSigned.addEventListener("change", function () { + handleCheckboxValue(wantAssertionsSigned); + + }); + + + const wantAssertionsEncrypted = document.getElementById("wantAssertionsEncrypted"); + wantAssertionsEncrypted.value = pluginData.config.wantAssertionsEncrypted ? pluginData.config.wantAssertionsEncrypted : false; + wantAssertionsEncrypted.addEventListener("change", function () { + handleCheckboxValue(wantAssertionsEncrypted); + + }); + + + const forceAuthentication = document.getElementById("forceAuthentication"); + forceAuthentication.value = pluginData.config.forceAuthn ? pluginData.config.forceAuthn : false; + forceAuthentication.addEventListener("change", function () { + handleCheckboxValue(forceAuthentication); + }); + + + + const signMetadata = document.getElementById("signMetadata"); + signMetadata.value = pluginData.config.signSpMetadata ? pluginData.config.signSpMetadata : false + signMetadata.addEventListener("change", function () { + handleCheckboxValue(signMetadata); + + }); + + + const passSubject = document.getElementById("passSubject"); + passSubject.value = pluginData.config.loginHint ? pluginData.config.loginHint : false; + passSubject.addEventListener("change", function () { + handleCheckboxValue(passSubject); + + }); + + + const storeToken = document.getElementById("storeToken"); + storeToken.value = pluginData.storeToken ? pluginData.storeToken : false; + storeToken.addEventListener("change", function () { + handleCheckboxValue(storeToken); + + }); + + + const storedTokensReadable = document.getElementById("storedTokensReadable"); + storedTokensReadable.value = pluginData.addReadTokenRoleOnCreate ? pluginData.addReadTokenRoleOnCreate : false; + storedTokensReadable.addEventListener("change", function () { + handleCheckboxValue(storedTokensReadable); + + }); + const id_token_hint=document.getElementById("id_token_hint"); id_token_hint.value = pluginData.config.sendIdTokenOnLogout ? pluginData.config.sendIdTokenOnLogout : false; id_token_hint.addEventListener("change", function () { handleCheckboxValue(id_token_hint); }); - -const client_id_in_logout_requests=document.getElementById("client_id_in_logout_requests") -client_id_in_logout_requests.value = pluginData.config.sendClientIdOnLogout ? pluginData.config.sendClientIdOnLogout : false; -client_id_in_logout_requests.addEventListener("change", function () { - handleCheckboxValue(client_id_in_logout_requests); - -}); - -const trustEmail = document.getElementById("trustEmail"); -trustEmail.value = pluginData.trustEmail ? pluginData.trustEmail : false; -trustEmail.addEventListener("change", function () { - handleCheckboxValue(trustEmail); - -}); - - - - -const accountLinkingOnly = document.getElementById("accountLinkingOnly"); -accountLinkingOnly.value = pluginData.linkOnly ? pluginData.linkOnly : false; -accountLinkingOnly.addEventListener("change", function () { - handleCheckboxValue(accountLinkingOnly); - -}); - - -const hideLoginPage = document.getElementById("hideLoginPage"); -hideLoginPage.value = pluginData.config.hideOnLoginPage ? pluginData.config.hideOnLoginPage : false; -hideLoginPage.addEventListener("change", function () { - handleCheckboxValue(hideLoginPage); - -}); - - -var SignatureAlgorithm = document.getElementById("SignatureAlgorithm"); -var SAMLSignatureKeyName = document.getElementById("SAMLSignatureKeyName"); - -const wantAuthnRequestsSigned = document.getElementById("wantAuthnRequestsSigned"); -wantAuthnRequestsSigned.value = pluginData.config.wantAuthnRequestsSigned ? pluginData.config.wantAuthnRequestsSigned : false; -wantAuthnRequestsSigned.addEventListener("change", function () { - if (wantAuthnRequestsSigned.checked) { - wantAuthnRequestsSigned.value = true; - SignatureAlgorithm.removeAttribute("disabled"); - SAMLSignatureKeyName.removeAttribute("disabled"); - encryption_algorithm.removeAttribute("disabled"); - - } - else { - wantAuthnRequestsSigned.value = false; - SignatureAlgorithm.setAttribute("disabled", "true"); - SAMLSignatureKeyName.setAttribute("disabled", "true"); - encryption_algorithm.setAttribute("disabled", "true"); - - - ; - } -}); - -const ArtifactResolutionService_in_metadata = document.getElementById("ArtifactResolutionService_in_metadata"); -ArtifactResolutionService_in_metadata.value = pluginData.config.includeArtifactResolutionServiceMetadata ? pluginData.config.includeArtifactResolutionServiceMetadata : false; -ArtifactResolutionService_in_metadata.addEventListener("change", function () { - handleCheckboxValue(ArtifactResolutionService_in_metadata); - -}); - -document.addEventListener("DOMContentLoaded", function () { - const deleteButtonsClassRefs = document.querySelectorAll(".delete"); - const addButtonClassRefs = document.getElementById("addClassRefs"); - const ClassRefs_items = document.getElementById("ClassRefs_items"); - - deleteButtonsClassRefs.forEach(function (button) { - button.style.display = "inline"; + + const client_id_in_logout_requests=document.getElementById("client_id_in_logout_requests") + client_id_in_logout_requests.value = pluginData.config.sendClientIdOnLogout ? pluginData.config.sendClientIdOnLogout : false; + client_id_in_logout_requests.addEventListener("change", function () { + handleCheckboxValue(client_id_in_logout_requests); + }); - - addButtonClassRefs.addEventListener("click", function (e) { + + const trustEmail = document.getElementById("trustEmail"); + trustEmail.value = pluginData.trustEmail ? pluginData.trustEmail : false; + trustEmail.addEventListener("change", function () { + handleCheckboxValue(trustEmail); + + }); + + + + + const accountLinkingOnly = document.getElementById("accountLinkingOnly"); + accountLinkingOnly.value = pluginData.linkOnly ? pluginData.linkOnly : false; + accountLinkingOnly.addEventListener("change", function () { + handleCheckboxValue(accountLinkingOnly); + + }); + + + const hideLoginPage = document.getElementById("hideLoginPage"); + hideLoginPage.value = pluginData.config.hideOnLoginPage ? pluginData.config.hideOnLoginPage : false; + hideLoginPage.addEventListener("change", function () { + handleCheckboxValue(hideLoginPage); + + }); + + + var SignatureAlgorithm = document.getElementById("SignatureAlgorithm"); + var SAMLSignatureKeyName = document.getElementById("SAMLSignatureKeyName"); + + const wantAuthnRequestsSigned = document.getElementById("wantAuthnRequestsSigned"); + wantAuthnRequestsSigned.value = pluginData.config.wantAuthnRequestsSigned ? pluginData.config.wantAuthnRequestsSigned : false; + wantAuthnRequestsSigned.addEventListener("change", function () { + if (wantAuthnRequestsSigned.checked) { + wantAuthnRequestsSigned.value = true; + SignatureAlgorithm.removeAttribute("disabled"); + SAMLSignatureKeyName.removeAttribute("disabled"); + encryption_algorithm.removeAttribute("disabled"); + + } + else { + wantAuthnRequestsSigned.value = false; + SignatureAlgorithm.setAttribute("disabled", "true"); + SAMLSignatureKeyName.setAttribute("disabled", "true"); + encryption_algorithm.setAttribute("disabled", "true"); + + + ; + } + }); + + const ArtifactResolutionService_in_metadata = document.getElementById("ArtifactResolutionService_in_metadata"); + ArtifactResolutionService_in_metadata.value = pluginData.config.includeArtifactResolutionServiceMetadata ? pluginData.config.includeArtifactResolutionServiceMetadata : false; + ArtifactResolutionService_in_metadata.addEventListener("change", function () { + handleCheckboxValue(ArtifactResolutionService_in_metadata); + + }); + + document.addEventListener("DOMContentLoaded", function () { + const deleteButtonsClassRefs = document.querySelectorAll(".delete"); + const addButtonClassRefs = document.getElementById("addClassRefs"); + const ClassRefs_items = document.getElementById("ClassRefs_items"); + deleteButtonsClassRefs.forEach(function (button) { button.style.display = "inline"; }); - - const newItem = document.createElement("div"); - newItem.className = "next-referral col-4"; - newItem.innerHTML = ''; - ClassRefs_items.appendChild(newItem); - }); - - document.body.addEventListener("click", function (e) { - if (e.target.classList.contains("delete")) { - const items = ClassRefs_items.querySelectorAll(".next-referral"); - if (items.length > 0) { - items[items.length - 1].remove(); - deleteButtonsClassRefs.forEach(function (button, index) { - if (index === items.length - 1) { - button.style.display = "inline"; - } - }); + + addButtonClassRefs.addEventListener("click", function (e) { + deleteButtonsClassRefs.forEach(function (button) { + button.style.display = "inline"; + }); + + const newItem = document.createElement("div"); + newItem.className = "next-referral col-4"; + newItem.innerHTML = ''; + ClassRefs_items.appendChild(newItem); + }); + + document.body.addEventListener("click", function (e) { + if (e.target.classList.contains("delete")) { + const items = ClassRefs_items.querySelectorAll(".next-referral"); + if (items.length > 0) { + items[items.length - 1].remove(); + deleteButtonsClassRefs.forEach(function (button, index) { + if (index === items.length - 1) { + button.style.display = "inline"; + } + }); + } } - } - }); -}); - -document.addEventListener("DOMContentLoaded", function () { - const deleteButtonsDeclRefs = document.querySelectorAll(".delete1"); - const addButtonDeclRefs = document.getElementById("addDeclRefs"); - const DeclRefs_items = document.getElementById("DeclRefs_items"); - - deleteButtonsDeclRefs.forEach(function (button) { - button.style.display = "inline"; + }); }); - - addButtonDeclRefs.addEventListener("click", function (e) { + + document.addEventListener("DOMContentLoaded", function () { + const deleteButtonsDeclRefs = document.querySelectorAll(".delete1"); + const addButtonDeclRefs = document.getElementById("addDeclRefs"); + const DeclRefs_items = document.getElementById("DeclRefs_items"); + deleteButtonsDeclRefs.forEach(function (button) { button.style.display = "inline"; }); - - const newItem = document.createElement("div"); - newItem.className = "next-referral col-4"; - newItem.innerHTML = ''; - DeclRefs_items.appendChild(newItem); - }); - - document.body.addEventListener("click", function (e) { - if (e.target.classList.contains("delete1")) { - const items = DeclRefs_items.querySelectorAll(".next-referral"); - if (items.length > 0) { - items[items.length - 1].remove(); - deleteButtonsDeclRefs.forEach(function (button, index) { - if (index === items.length - 1) { - button.style.display = "inline"; - } - }); + + addButtonDeclRefs.addEventListener("click", function (e) { + deleteButtonsDeclRefs.forEach(function (button) { + button.style.display = "inline"; + }); + + const newItem = document.createElement("div"); + newItem.className = "next-referral col-4"; + newItem.innerHTML = ''; + DeclRefs_items.appendChild(newItem); + }); + + document.body.addEventListener("click", function (e) { + if (e.target.classList.contains("delete1")) { + const items = DeclRefs_items.querySelectorAll(".next-referral"); + if (items.length > 0) { + items[items.length - 1].remove(); + deleteButtonsDeclRefs.forEach(function (button, index) { + if (index === items.length - 1) { + button.style.display = "inline"; + } + }); + } } - } + }); }); -}); - - - -var validateSignatures = document.getElementById("validateSignatures"); -var additionalField1 = document.getElementById("ValidatingX509Certificates"); -var saml_EntityDescriptor=document.getElementById("saml_EntityDescriptor") -var Use_Metadata_Descriptor_URL=document.getElementById("Use_Metadata_Descriptor_URL") -validateSignatures.value = pluginData.config.validateSignature ? pluginData.config.validateSignature : false; + + + + var validateSignatures = document.getElementById("validateSignatures"); + var additionalField1 = document.getElementById("ValidatingX509Certificates"); + var saml_EntityDescriptor=document.getElementById("saml_EntityDescriptor") + var Use_Metadata_Descriptor_URL=document.getElementById("Use_Metadata_Descriptor_URL") + validateSignatures.value = pluginData.config.validateSignature ? pluginData.config.validateSignature : false; var validateSignatures = document.getElementById("validateSignatures"); var additionalField1 = document.getElementById("ValidatingX509Certificates"); var saml_EntityDescriptor = document.getElementById("saml_EntityDescriptor"); var Use_Metadata_Descriptor_URL = document.getElementById("Use_Metadata_Descriptor_URL"); - validateSignatures.checked = pluginData.config.validateSignature ? pluginData.config.validateSignature : false; - validateSignatures.addEventListener("change", function () { - if (validateSignatures.checked) { - validateSignatures.value = true; - additionalField1.removeAttribute("disabled"); - saml_EntityDescriptor.style.display = 'block'; - Use_Metadata_Descriptor_URL.style.display = 'block'; - } else { - additionalField1.setAttribute("disabled", "true"); - additionalField1.value = ''; - saml_EntityDescriptor.style.display = 'none'; - Use_Metadata_Descriptor_URL.style.display = 'none'; - validateSignatures.value = false; - } - }); - - validateSignatures.dispatchEvent(new Event("change")); - + validateSignatures.checked = pluginData.config.validateSignature ? pluginData.config.validateSignature : false; + validateSignatures.addEventListener("change", function () { + if (validateSignatures.checked) { + validateSignatures.value = true; + additionalField1.removeAttribute("disabled"); + saml_EntityDescriptor.style.display = 'block'; + Use_Metadata_Descriptor_URL.style.display = 'block'; + } else { + additionalField1.setAttribute("disabled", "true"); + additionalField1.value = ''; + saml_EntityDescriptor.style.display = 'none'; + Use_Metadata_Descriptor_URL.style.display = 'none'; + validateSignatures.value = false; + } + }); + + validateSignatures.dispatchEvent(new Event("change")); + var UseMetadataDescriptorURL = document.getElementById("UseMetadataDescriptorURL"); var Validating_X509_Certificates=document.getElementById("Validating_X509_Certificates"); UseMetadataDescriptorURL.checked = pluginData.config.useMetadataDescriptorUrl ? pluginData.config.useMetadataDescriptorUrl : false; UseMetadataDescriptorURL.addEventListener("change", function () { - if (UseMetadataDescriptorURL.checked) { - UseMetadataDescriptorURL.value = true; - Validating_X509_Certificates.style.display='none' - } - else { - UseMetadataDescriptorURL.value = false; - Validating_X509_Certificates.style.display='block' - ; - } - } - + if (UseMetadataDescriptorURL.checked) { + UseMetadataDescriptorURL.value = true; + Validating_X509_Certificates.style.display='none' + } + else { + UseMetadataDescriptorURL.value = false; + Validating_X509_Certificates.style.display='block' + ; + } + } + ); - - -var Artifact_Resolution = document.getElementById("Artifact_Resolution"); -Artifact_Resolution.value = pluginData.config.artifactResolution ? pluginData.config.artifactResolution : false; - -Artifact_Resolution.addEventListener("change", function () { - if (Artifact_Resolution.checked) { - Artifact_Resolution.value = true; - additionalField_endpoint.removeAttribute("disabled"); - - } - else { - Artifact_Resolution.value = false; - additionalField_endpoint.setAttribute("disabled", "true"); - additionalField_endpoint.value = ''; - - ; - } -} -); - - -const Sign_Artifact_Resolution_Request = document.getElementById("Sign_Artifact_Resolution_Request"); -Sign_Artifact_Resolution_Request.value = pluginData.config.signArtifactResolutionRequest ? pluginData.config.signArtifactResolutionRequest : false; -Sign_Artifact_Resolution_Request.addEventListener("change", function () { - handleCheckboxValue(Sign_Artifact_Resolution_Request); - -}); - -const ArtifactResolution_via_HTTP_ARTIFACT = document.getElementById("ArtifactResolution_via_HTTP_ARTIFACT"); -ArtifactResolution_via_HTTP_ARTIFACT.value = pluginData.config.artifactResolutionHTTPArtifact ? pluginData.config.artifactResolutionHTTPArtifact : false; -ArtifactResolution_via_HTTP_ARTIFACT.addEventListener("change", function () { - handleCheckboxValue(ArtifactResolution_via_HTTP_ARTIFACT); - -}); - - - - -const Artifact_Resolution_with_SOAP = document.getElementById("Artifact_Resolution_with_SOAP"); -Artifact_Resolution_with_SOAP.value = pluginData.config.artifactResolutionSOAP ? pluginData.config.artifactResolutionSOAP : false; -Artifact_Resolution_with_SOAP.addEventListener("change", function () { - handleCheckboxValue(Artifact_Resolution_with_SOAP); - -}); - - - -const Artifact_Resolution_with_XML_header = document.getElementById("Artifact_Resolution_with_XML_header"); -Artifact_Resolution_with_XML_header.value = pluginData.config.artifactResolutionWithXmlHeader ? pluginData.config.artifactResolutionWithXmlHeader : false; -Artifact_Resolution_with_XML_header.addEventListener("change", function () { - handleCheckboxValue(Artifact_Resolution_with_XML_header); - -}); - - -const Mutual_TLS = document.getElementById("Mutual_TLS"); -Mutual_TLS.value = pluginData.config.mutualTls ? pluginData.config.mutualTls : false; -Mutual_TLS.addEventListener("change", function () { - handleCheckboxValue(Mutual_TLS); - -}); -const enabled = document.getElementById("enabled"); -enabled.value = pluginData.enabled ? pluginData.enabled : false; -enabled.addEventListener("change", function () { - handleCheckboxValue(enabled); - -}); - -principalType_input.addEventListener('change', function () { - if (principalType_input.value == "ATTRIBUTE" || principalType_input.value == "FRIENDLY_ATTRIBUTE") { - principalAttribute_input.removeAttribute("disabled"); - - } else { - principalAttribute_input.value = ''; - principalAttribute_input.setAttribute("disabled", "true"); - - } -}) ; + + + var Artifact_Resolution = document.getElementById("Artifact_Resolution"); + Artifact_Resolution.value = pluginData.config.artifactResolution ? pluginData.config.artifactResolution : false; + + Artifact_Resolution.addEventListener("change", function () { + if (Artifact_Resolution.checked) { + Artifact_Resolution.value = true; + additionalField_endpoint.removeAttribute("disabled"); + + } + else { + Artifact_Resolution.value = false; + additionalField_endpoint.setAttribute("disabled", "true"); + additionalField_endpoint.value = ''; + + ; + } + } + ); + + + const Sign_Artifact_Resolution_Request = document.getElementById("Sign_Artifact_Resolution_Request"); + Sign_Artifact_Resolution_Request.value = pluginData.config.signArtifactResolutionRequest ? pluginData.config.signArtifactResolutionRequest : false; + Sign_Artifact_Resolution_Request.addEventListener("change", function () { + handleCheckboxValue(Sign_Artifact_Resolution_Request); + + }); + + const ArtifactResolution_via_HTTP_ARTIFACT = document.getElementById("ArtifactResolution_via_HTTP_ARTIFACT"); + ArtifactResolution_via_HTTP_ARTIFACT.value = pluginData.config.artifactResolutionHTTPArtifact ? pluginData.config.artifactResolutionHTTPArtifact : false; + ArtifactResolution_via_HTTP_ARTIFACT.addEventListener("change", function () { + handleCheckboxValue(ArtifactResolution_via_HTTP_ARTIFACT); + + }); + + + + + const Artifact_Resolution_with_SOAP = document.getElementById("Artifact_Resolution_with_SOAP"); + Artifact_Resolution_with_SOAP.value = pluginData.config.artifactResolutionSOAP ? pluginData.config.artifactResolutionSOAP : false; + Artifact_Resolution_with_SOAP.addEventListener("change", function () { + handleCheckboxValue(Artifact_Resolution_with_SOAP); + + }); + + + + const Artifact_Resolution_with_XML_header = document.getElementById("Artifact_Resolution_with_XML_header"); + Artifact_Resolution_with_XML_header.value = pluginData.config.artifactResolutionWithXmlHeader ? pluginData.config.artifactResolutionWithXmlHeader : false; + Artifact_Resolution_with_XML_header.addEventListener("change", function () { + handleCheckboxValue(Artifact_Resolution_with_XML_header); + + }); + + + const Mutual_TLS = document.getElementById("Mutual_TLS"); + Mutual_TLS.value = pluginData.config.mutualTls ? pluginData.config.mutualTls : false; + Mutual_TLS.addEventListener("change", function () { + handleCheckboxValue(Mutual_TLS); + + }); + const enabled = document.getElementById("enabled"); + enabled.value = pluginData.enabled ? pluginData.enabled : false; + enabled.addEventListener("change", function () { + handleCheckboxValue(enabled); + + }); + + principalType_input.addEventListener('change', function () { + if (principalType_input.value == "ATTRIBUTE" || principalType_input.value == "FRIENDLY_ATTRIBUTE") { + principalAttribute_input.removeAttribute("disabled"); + + } else { + principalAttribute_input.value = ''; + principalAttribute_input.setAttribute("disabled", "true"); + + } + }) ; }); \ No newline at end of file diff --git a/src/main/resources/saml-extended-frontend/js/EditProvider.js b/src/main/resources/saml-extended-frontend/js/EditProvider.js index a31dca0..5897757 100644 --- a/src/main/resources/saml-extended-frontend/js/EditProvider.js +++ b/src/main/resources/saml-extended-frontend/js/EditProvider.js @@ -3,7 +3,7 @@ edit.addEventListener('click', () => { keycloak.updateToken(300).then((bool) => { if (bool) { newAccessToken = keycloak.token; - + var authnContextClassRefs = [] const ClassRefs_inputs = ClassRefs_items.querySelectorAll("input"); ClassRefs_inputs.forEach(input => { @@ -18,7 +18,7 @@ edit.addEventListener('click', () => { authnContextDeclRefs.push(input.value); } }); - + var Single_Sign_On_Service_URL = Single_Sign_On_Service_URL_input.value; var Single_Logout_Service_URL = Single_Logout_Service_URL_input.value; var nameIdPolicy = nameIdPolicy_input.value; @@ -42,6 +42,7 @@ edit.addEventListener('click', () => { "postBindingLogout": httpPostBindingLogout.value, "authnContextClassRefs": authnContextClassRefs.length > 0 ? JSON.stringify(authnContextClassRefs) : undefined, "postBindingResponse": httpPostBindingResponse.value, + "artifactBindingResponse": artifactBindingResponse.value, "singleLogoutServiceUrl": Single_Logout_Service_URL, "authnContextDeclRefs": authnContextDeclRefs.length > 0 ? JSON.stringify(authnContextDeclRefs) : undefined, "backchannelSupported": backchannel.value, @@ -88,28 +89,28 @@ edit.addEventListener('click', () => { "metadataDescriptorUrl":samlEntityDescriptor_input.value, "useMetadataDescriptorUrl":UseMetadataDescriptorURL.value, "attributeConsumingServiceMetadata":attributeServicesArray.length > 0 ? JSON.stringify(attributeServicesArray) : undefined - + } }; - - + + let isValid = true; hasFocused = false; - + if (!Single_Sign_On_Service_URL_input.value || !Single_Sign_On_Service_URL_input.value.startsWith("https://")) { handleInvalidInput(Single_Sign_On_Service_URL_input, errorMessage_URL, "Enter a valid URL"); isValid = false; } else { handleValidInput(Single_Sign_On_Service_URL_input, errorMessage_URL,""); } - + if (Single_Logout_Service_URL_input.value && !Single_Logout_Service_URL_input.value.startsWith("https://")) { handleInvalidInput(Single_Logout_Service_URL_input, errorMessage_URL_logout, "Enter a valid URL"); isValid = false; } else { handleValidInput(Single_Logout_Service_URL_input, errorMessage_URL_logout,""); } - + if (UseMetadataDescriptorURL.checked) { if (!samlEntityDescriptor_input.value ||!samlEntityDescriptor_input.value.startsWith("https://")) { handleInvalidInput(samlEntityDescriptor_input, samlEntityDescriptor_errorMessage_URL, "Enter a valid URL!"); @@ -118,17 +119,17 @@ edit.addEventListener('click', () => { else { handleValidInput(samlEntityDescriptor_input, samlEntityDescriptor_errorMessage_URL,""); } - - + + } - + if (!isValid) { return; } - - + + removeEmptyStrings(data); - + const configKeys = Object.keys(data.config); for (const key of configKeys) { if (typeof data.config[key] === 'string' && data.config[key].trim() === "") { @@ -138,102 +139,98 @@ edit.addEventListener('click', () => { if (Array.isArray(data.config.authnContextClassRefs) && data.config.authnContextClassRefs.length === 0) { delete data.config.authnContextClassRefs; } - + if (Array.isArray(data.config.authnContextDeclRefs) && data.config.authnContextDeclRefs.length === 0) { delete data.config.authnContextDeclRefs; } - - - + + + var selectedrealm = localStorage.getItem('selectedRealm'); - if(alias_input.value){ - // Sending a GET request to check if the plugin exists - fetch(`${ServerUrl}/admin/realms/${selectedrealm}/identity-provider/instances/${alias_input.value}`, { - method: 'GET', - headers: { - 'Authorization': `Bearer ${newAccessToken}`, - }, - }) - - // Handling the response of the GET request - .then(async checkPluginResponse => { - if (checkPluginResponse.ok) { - var pluginData = await checkPluginResponse.json(); - const updatePluginResponse = await fetch(`${ServerUrl}/admin/realms/${selectedrealm}/identity-provider/instances/${alias_input.value}`, { - method: 'PUT', - headers: { - 'Authorization': `Bearer ${newAccessToken}`, - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - } - - ); - localStorage.setItem('pluginData', JSON.stringify(data)); - - - - // Checking the response status for success - if (updatePluginResponse.status === 204 || updatePluginResponse.status === 201) { - console.log("Plugin updated successfully."); - alert("Plugin updated successfully."); - getAllPlugins(newAccessToken,selectedrealm); - localStorage.setItem('pluginData', JSON.stringify(data)); - - - } else { - console.error(`Failed to update/add the plugin. Response: ${updatePluginResponse.statusText}`); - console.error("Error Details:", await updatePluginResponse.json()); - alert("Failed to update the plugin") - } - } else if (checkPluginResponse.status === 404) { - // If the status is 404, the plugin does not exist, so send a POST request - return fetch(`${ServerUrl}/admin/realms/${selectedrealm}/identity-provider/instances`, { - method: 'POST', - headers: { - 'Authorization': `Bearer ${newAccessToken}`, - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }) + if(alias_input.value){ + // Sending a GET request to check if the plugin exists + fetch(`${ServerUrl}/admin/realms/${selectedrealm}/identity-provider/instances/${alias_input.value}`, { + method: 'GET', + headers: { + 'Authorization': `Bearer ${newAccessToken}`, + }, + }) + + // Handling the response of the GET request + .then(async checkPluginResponse => { + if (checkPluginResponse.ok) { + var pluginData = await checkPluginResponse.json(); + const updatePluginResponse = await fetch(`${ServerUrl}/admin/realms/${selectedrealm}/identity-provider/instances/${alias_input.value}`, { + method: 'PUT', + headers: { + 'Authorization': `Bearer ${newAccessToken}`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify(data), + } + + ); + localStorage.setItem('pluginData', JSON.stringify(data)); + + // Checking the response status for success + if (updatePluginResponse.status === 204 || updatePluginResponse.status === 201) { + console.log("Plugin updated successfully."); + alert("Plugin updated successfully."); + getAllPlugins(newAccessToken,selectedrealm); + localStorage.setItem('pluginData', JSON.stringify(data)); + } else { + console.error(`Failed to update/add the plugin. Response: ${updatePluginResponse.statusText}`); + console.error("Error Details:", await updatePluginResponse.json()); + alert("Failed to update the plugin") + } + } else if (checkPluginResponse.status === 404) { + // If the status is 404, the plugin does not exist, so send a POST request + return fetch(`${ServerUrl}/admin/realms/${selectedrealm}/identity-provider/instances`, { + method: 'POST', + headers: { + 'Authorization': `Bearer ${newAccessToken}`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify(data), + }) .then(response => { if (response.ok) { alert("Plugin added successfully."); - + localStorage.setItem('pluginData', JSON.stringify(data)); - + } else { console.error('Failed to add plugin:', response.status, response.statusText); alert("Failed to add plugin"); } }) .catch(error => { - + console.error('Network error or failed to send request:', error); }); - - - } else { - // If there is another status, an error occurred - - console.error(`Failed to retrieve the plugin. Response: ${checkPluginResponse.statusText}`); - alert("Failed to retrieve the plugin"); - throw new Error(`Failed to retrieve the plugin. Response: ${checkPluginResponse.statusText}`); - } - }) - - // Handling the response of the POST request (if executed) - .then(response => { - // ... (Additional code that was commented out) - }) - .catch(error => { - // ... (Additional code that was commented out) - }); - }else - {console.log('alias_input does not exist')} - + + + } else { + // If there is another status, an error occurred + + console.error(`Failed to retrieve the plugin. Response: ${checkPluginResponse.statusText}`); + alert("Failed to retrieve the plugin"); + throw new Error(`Failed to retrieve the plugin. Response: ${checkPluginResponse.statusText}`); + } + }) + + // Handling the response of the POST request (if executed) + .then(response => { + // ... (Additional code that was commented out) + }) + .catch(error => { + // ... (Additional code that was commented out) + }); + }else + {console.log('alias_input does not exist')} + // Setting a form element value to an empty string - + } else { console.log("Token is not updated"); } diff --git a/src/main/resources/saml-extended-frontend/pages/addprovider.html b/src/main/resources/saml-extended-frontend/pages/addprovider.html index ebead45..475c4bb 100644 --- a/src/main/resources/saml-extended-frontend/pages/addprovider.html +++ b/src/main/resources/saml-extended-frontend/pages/addprovider.html @@ -356,8 +356,8 @@

Saml-extended

@@ -378,9 +378,9 @@
Redirect URI value="http://localhost:8080/realms/master/broker/saml-extended/endpoint" id="redirectUri" readonly>
Alias * question markAlias *
Display Name question markEndpoints SAML 2.0 Service Provider Metadata + var selectedRealm = localStorage.getItem('selectedRealm'); + var serverUrl = localStorage.getItem('ServerUrl'); + var alias_for_endpoint = localStorage.getItem('alias_for_endpoint'); + document.getElementById('metadataLink').onclick = function(event) { + event.preventDefault(); + window.open(`${serverUrl}/realms/${selectedRealm}/broker/${alias_for_endpoint}/endpoint/descriptor`, '_blank');}

SAML settings

Service Provider Entity ID @@ -563,19 +563,22 @@
HTTP-POST Binding Response onclick="alert('Indicates whether to respond to requests using HTTP-POST binding. If false, HTTP-REDIRECT binding will be used.')">
- +
ARTIFACT binding response
+
HTTP-POST Binding for AuthnRequest question mark
-
@@ -891,17 +892,17 @@
Linked Providers @@ -1001,14 +1002,14 @@

Attribute Consuming Service

@@ -1062,11 +1063,11 @@

Attribute Consuming Service

diff --git a/src/main/resources/saml-extended-frontend/pages/editprovider.html b/src/main/resources/saml-extended-frontend/pages/editprovider.html index 70033a8..dd8ac65 100644 --- a/src/main/resources/saml-extended-frontend/pages/editprovider.html +++ b/src/main/resources/saml-extended-frontend/pages/editprovider.html @@ -339,9 +339,9 @@

Saml-extended

@@ -360,35 +360,35 @@

General Settings

Redirect URI question mark + onclick="alert('The redirect uri to use when configuring the identity provider.')">
+ value="http://localhost:8080/realms/master/broker/saml-extended/endpoint" id="redirectUri" readonly>
Alias * question mark + onclick="alert('The alias uniquely identifies an identity provider and it is also used to build the redirect uri.')">
-
Display Name - question mark -
- +
Display Name + question mark +
+
Display Order question mark + onclick="alert('Number defining the order of the providers in GUI (for example, on the Login page). The lowest number will be applied first.')">
Endpoints question mark + onclick="alert('The alias uniquely identifies an identity provider and it is also used to build the redirect uri.')">
@@ -397,48 +397,48 @@
Endpoints

SAML settings

Service Provider Entity ID question mark + onclick="alert('The Entity ID that will be used to uniquely identify this SAML Service Provider.')">
Identity Provider Entity ID question mark + onclick="alert('The Entity ID used to validate the Issuer for received SAML assertions. If empty, no Issuer validation is performed.')">
Single Sign-On Service URL * question mark + onclick="alert('The Url that must be used to send authentication requests (SAML AuthnRequest).')">
Single Logout Service URL question mark + onclick="alert('The Url that must be used to send logout requests.')">
Backchannel Logout question mark + onclick="alert('Does the external IDP support backchannel logout?')">
@@ -730,10 +735,10 @@
AuthnContext ClassRefs
AuthnContext DeclRefs question mark
+ alt="question mark" onclick="alert('Ordered list of requested AuthnContext DeclRefs.')">
+ class="form-control input-md">
@@ -746,7 +751,7 @@

Advanced Settings

Store Tokens question mark + onclick="alert('Enable/disable if tokens must be stored after authenticating users')">