Skip to content

Commit bfcee3c

Browse files
committed
make saml auth request option forceauthn configurable
1 parent e666dca commit bfcee3c

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
SAMLProviderMetadata getSPMetadata();
7780
SAMLProviderMetadata getIdPMetadata(String entityId);
7881
Collection<SAMLProviderMetadata> getAllIdPMetadata();

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
@@ -542,6 +542,6 @@ public ConfigKey<?>[] getConfigKeys() {
542542
SAMLServiceProviderSingleSignOnURL, SAMLServiceProviderSingleLogOutURL,
543543
SAMLCloudStackRedirectionUrl, SAMLUserAttributeName,
544544
SAMLIdentityProviderMetadataURL, SAMLDefaultIdentityProviderId,
545-
SAMLSignatureAlgorithm, SAMLAppendDomainSuffix, SAMLTimeout, SAMLCheckSignature};
545+
SAMLSignatureAlgorithm, SAMLAppendDomainSuffix, SAMLTimeout, SAMLCheckSignature, SAMLForceAuthn};
546546
}
547547
}

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
@@ -189,7 +189,7 @@ public static AuthnRequest buildAuthnRequestObject(final String authnId, final S
189189
authnRequest.setID(authnId);
190190
authnRequest.setDestination(idpUrl);
191191
authnRequest.setVersion(SAMLVersion.VERSION_20);
192-
authnRequest.setForceAuthn(false);
192+
authnRequest.setForceAuthn(SAML2AuthManager.SAMLForceAuthn.value());
193193
authnRequest.setIsPassive(false);
194194
authnRequest.setIssueInstant(new DateTime());
195195
authnRequest.setProtocolBinding(SAMLConstants.SAML2_POST_BINDING_URI);

0 commit comments

Comments
 (0)