mirror of https://github.com/apache/cloudstack.git
Adds configuration for behaviour, when SAML SSO is disabled for a user
This commit is contained in:
parent
14a7871727
commit
652094d09c
|
|
@ -82,6 +82,9 @@ public interface SAML2AuthManager extends PluggableAPIAuthenticator, PluggableSe
|
|||
ConfigKey<Boolean> SAMLRequirePasswordLogin = new ConfigKey<Boolean>("Advanced", Boolean.class, "saml2.require.password", "true",
|
||||
"When enabled SAML2 will validate that the SAML login was performed with a password. If disabled, other forms of authentication are allowed (two-factor, certificate, etc) on the SAML Authentication Provider", true);
|
||||
|
||||
ConfigKey<Boolean> EnableLoginAfterSAMLDisable = new ConfigKey<>("Advanced", Boolean.class, "enable.login.saml.unathourized", "true", "When enabled, if SAML SSO is disabled, enables user to login with user and password, otherwise a user with SAML SSO disabled cannot login", true);
|
||||
|
||||
|
||||
|
||||
SAMLProviderMetadata getSPMetadata();
|
||||
SAMLProviderMetadata getIdPMetadata(String entityId);
|
||||
|
|
|
|||
|
|
@ -451,8 +451,13 @@ public class SAML2AuthManagerImpl extends AdapterBase implements SAML2AuthManage
|
|||
user.setExternalEntity(entityId);
|
||||
user.setSource(User.Source.SAML2);
|
||||
} else {
|
||||
boolean enableLoginAfterSAMLDisable = SAML2AuthManager.EnableLoginAfterSAMLDisable.value();
|
||||
if (user.getSource().equals(User.Source.SAML2)) {
|
||||
user.setSource(User.Source.SAML2DISABLED);
|
||||
if(enableLoginAfterSAMLDisable) {
|
||||
user.setSource(User.Source.UNKNOWN);
|
||||
} else {
|
||||
user.setSource(User.Source.SAML2DISABLED);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -541,6 +546,6 @@ public class SAML2AuthManagerImpl extends AdapterBase implements SAML2AuthManage
|
|||
SAMLCloudStackRedirectionUrl, SAMLUserAttributeName,
|
||||
SAMLIdentityProviderMetadataURL, SAMLDefaultIdentityProviderId,
|
||||
SAMLSignatureAlgorithm, SAMLAppendDomainSuffix, SAMLTimeout, SAMLCheckSignature,
|
||||
SAMLForceAuthn, SAMLUserSessionKeyPathAttribute, SAMLRequirePasswordLogin};
|
||||
SAMLForceAuthn, SAMLUserSessionKeyPathAttribute, SAMLRequirePasswordLogin, EnableLoginAfterSAMLDisable};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2877,7 +2877,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||
for (UserAuthenticator authenticator : _userAuthenticators) {
|
||||
final String[] secretCodeArray = (String[])requestParameters.get(ApiConstants.SECRET_CODE);
|
||||
String secretCode = ((secretCodeArray == null) ? null : secretCodeArray[0]);
|
||||
if (userSource != User.Source.UNKNOWN && userSource != User.Source.SAML2DISABLED && secretCode == null) {
|
||||
if (userSource != User.Source.UNKNOWN && secretCode == null) {
|
||||
if (!authenticator.getName().equalsIgnoreCase(userSource.name())) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue