Skip to content

Commit 4459772

Browse files
authored
make saml auth request option forceauthn configurable (#9756)
1 parent 9661060 commit 4459772

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAML2AuthManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public interface SAML2AuthManager extends PluggableAPIAuthenticator, PluggableSe
7373
ConfigKey<Boolean> SAMLCheckSignature = new ConfigKey<Boolean>("Advanced", Boolean.class, "saml2.check.signature", "true",
7474
"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);
7575

76+
ConfigKey<Boolean> SAMLForceAuthn = new ConfigKey<Boolean>("Advanced", Boolean.class, "saml2.force.authn", "false",
77+
"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);
78+
7679
ConfigKey<String> SAMLUserSessionKeyPathAttribute = new ConfigKey<String>("Advanced", String.class, "saml2.user.sessionkey.path", "",
7780
"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);
7881

plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,6 @@ public ConfigKey<?>[] getConfigKeys() {
543543
SAMLCloudStackRedirectionUrl, SAMLUserAttributeName,
544544
SAMLIdentityProviderMetadataURL, SAMLDefaultIdentityProviderId,
545545
SAMLSignatureAlgorithm, SAMLAppendDomainSuffix, SAMLTimeout, SAMLCheckSignature,
546-
SAMLUserSessionKeyPathAttribute};
546+
SAMLForceAuthn, SAMLUserSessionKeyPathAttribute};
547547
}
548548
}

plugins/user-authenticators/saml2/src/main/java/org/apache/cloudstack/saml/SAMLUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public static AuthnRequest buildAuthnRequestObject(final String authnId, final S
193193
authnRequest.setID(authnId);
194194
authnRequest.setDestination(idpUrl);
195195
authnRequest.setVersion(SAMLVersion.VERSION_20);
196-
authnRequest.setForceAuthn(false);
196+
authnRequest.setForceAuthn(SAML2AuthManager.SAMLForceAuthn.value());
197197
authnRequest.setIsPassive(false);
198198
authnRequest.setIssueInstant(new DateTime());
199199
authnRequest.setProtocolBinding(SAMLConstants.SAML2_POST_BINDING_URI);

0 commit comments

Comments
 (0)