This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.19 by this push:
     new 44597724f58 make saml auth request option `forceauthn` configurable 
(#9756)
44597724f58 is described below

commit 44597724f58e5d87fb07e114f6f975b9fb32acde
Author: dahn <[email protected]>
AuthorDate: Wed Oct 16 07:15:18 2024 +0200

    make saml auth request option `forceauthn` configurable (#9756)
---
 .../src/main/java/org/apache/cloudstack/saml/SAML2AuthManager.java     | 3 +++
 .../src/main/java/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java | 2 +-
 .../saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java      | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAML2AuthManager.java
 
b/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAML2AuthManager.java
index e10ea08012f..4e8ba16c739 100644
--- 
a/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAML2AuthManager.java
+++ 
b/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAML2AuthManager.java
@@ -73,6 +73,9 @@ public interface SAML2AuthManager extends 
PluggableAPIAuthenticator, PluggableSe
     ConfigKey<Boolean> SAMLCheckSignature = new ConfigKey<Boolean>("Advanced", 
Boolean.class, "saml2.check.signature", "true",
             "When enabled (default and recommended), SAML2 signature checks 
are enforced and lack of signature in the SAML SSO response will cause login 
exception. Disabling this is not advisable but provided for backward 
compatibility for users who are able to accept the risks.", false);
 
+    ConfigKey<Boolean> SAMLForceAuthn = new ConfigKey<Boolean>("Advanced", 
Boolean.class, "saml2.force.authn", "false",
+            "When enabled (default false), SAML2 will force a new 
authentication. This can be useful if multiple application use different saml 
logins from the same application (I.E. browser)", true);
+
     ConfigKey<String> SAMLUserSessionKeyPathAttribute = new 
ConfigKey<String>("Advanced", String.class, "saml2.user.sessionkey.path", "",
             "The Path attribute of sessionkey cookie when SAML users have 
logged in. If not set, it will be set to the path of SAML redirection URL 
(saml2.redirect.url).", true);
 
diff --git 
a/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java
 
b/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java
index aa1e0be91c7..a7524ec63a7 100644
--- 
a/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java
+++ 
b/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java
@@ -543,6 +543,6 @@ public class SAML2AuthManagerImpl extends AdapterBase 
implements SAML2AuthManage
                 SAMLCloudStackRedirectionUrl, SAMLUserAttributeName,
                 SAMLIdentityProviderMetadataURL, SAMLDefaultIdentityProviderId,
                 SAMLSignatureAlgorithm, SAMLAppendDomainSuffix, SAMLTimeout, 
SAMLCheckSignature,
-                SAMLUserSessionKeyPathAttribute};
+                SAMLForceAuthn, SAMLUserSessionKeyPathAttribute};
     }
 }
diff --git 
a/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java
 
b/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java
index bb94c8af4c2..443091445b1 100644
--- 
a/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java
+++ 
b/plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java
@@ -193,7 +193,7 @@ public class SAMLUtils {
         authnRequest.setID(authnId);
         authnRequest.setDestination(idpUrl);
         authnRequest.setVersion(SAMLVersion.VERSION_20);
-        authnRequest.setForceAuthn(false);
+        authnRequest.setForceAuthn(SAML2AuthManager.SAMLForceAuthn.value());
         authnRequest.setIsPassive(false);
         authnRequest.setIssueInstant(new DateTime());
         authnRequest.setProtocolBinding(SAMLConstants.SAML2_POST_BINDING_URI);

Reply via email to