diff --git a/components/application-mgt/org.wso2.carbon.identity.application.common/spotbugs-exclude.xml b/components/application-mgt/org.wso2.carbon.identity.application.common/spotbugs-exclude.xml deleted file mode 100644 index 97dbb63deda3..000000000000 --- a/components/application-mgt/org.wso2.carbon.identity.application.common/spotbugs-exclude.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/application-mgt/spotbugs-exclude.xml b/components/application-mgt/spotbugs-exclude.xml deleted file mode 100644 index 97dbb63deda3..000000000000 --- a/components/application-mgt/spotbugs-exclude.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java index e56b27222f2b..2172afaa7ddf 100644 --- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java +++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java @@ -3985,8 +3985,10 @@ public String addIdPWithResourceId(IdentityProvider identityProvider, int tenant throw new IdentityProviderManagementException("An error occurred while processing content stream.", e); } catch (SQLException e) { IdentityDatabaseUtil.rollbackTransaction(dbConnection); - endpointConfigurationManager.deleteEndpointConfigurations(identityProvider.getDefaultAuthenticatorConfig(), - tenantId); + if (identityProvider.getFederatedAuthenticatorConfigs().length == 1) { + endpointConfigurationManager.deleteEndpointConfigurations( + identityProvider.getFederatedAuthenticatorConfigs()[0], tenantId); + } throw new IdentityProviderManagementException("Error occurred while adding Identity Provider for tenant " + tenantId, e); } catch (IdentityProviderManagementException e) { @@ -4315,8 +4317,12 @@ public void updateIdPWithResourceId(String resourceId, IdentityProvider throw new IdentityProviderManagementException("An error occurred while processing content stream.", e); } catch (SQLException e) { IdentityDatabaseUtil.rollbackTransaction(dbConnection); - endpointConfigurationManager.updateEndpointConfigurations(currentIdentityProvider - .getDefaultAuthenticatorConfig(), newIdentityProvider.getDefaultAuthenticatorConfig(), tenantId); + // + if (currentIdentityProvider.getFederatedAuthenticatorConfigs().length == 1) { + endpointConfigurationManager.updateEndpointConfigurations(currentIdentityProvider + .getFederatedAuthenticatorConfigs()[0], newIdentityProvider.getFederatedAuthenticatorConfigs()[0], + tenantId); + } throw new IdentityProviderManagementException("Error occurred while updating Identity Provider " + "information for tenant " + tenantId, e); } catch (IdentityProviderManagementException e) { @@ -4394,14 +4400,18 @@ public void deleteIdP(String idPName, int tenantId, String tenantDomain) String msg = "Trying to delete non-existent Identity Provider: %s in tenantDomain: %s"; throw new IdentityProviderManagementException(String.format(msg, idPName, tenantDomain)); } - endpointConfigurationManager.deleteEndpointConfigurations(identityProvider.getDefaultAuthenticatorConfig(), - tenantId); + if (identityProvider.getFederatedAuthenticatorConfigs().length == 1) { + endpointConfigurationManager.deleteEndpointConfigurations( + identityProvider.getFederatedAuthenticatorConfigs()[0], tenantId); + } deleteIdP(dbConnection, tenantId, idPName, null); IdentityDatabaseUtil.commitTransaction(dbConnection); } catch (SQLException e) { IdentityDatabaseUtil.rollbackTransaction(dbConnection); - endpointConfigurationManager.addEndpointConfigurations(identityProvider.getDefaultAuthenticatorConfig(), - tenantId); + if (identityProvider.getFederatedAuthenticatorConfigs().length == 1) { + endpointConfigurationManager.addEndpointConfigurations( + identityProvider.getFederatedAuthenticatorConfigs()[0], tenantId); + } throw new IdentityProviderManagementException("Error occurred while deleting Identity Provider of tenant " + tenantDomain, e); } catch (IdentityProviderManagementException e) { @@ -4454,16 +4464,20 @@ public void deleteIdPByResourceId(String resourceId, int tenantId, String tenant throw new IdentityProviderManagementException(String.format(msg, resourceId, tenantDomain)); } idPName = identityProvider.getIdentityProviderName(); - endpointConfigurationManager.deleteEndpointConfigurations(identityProvider.getDefaultAuthenticatorConfig(), - tenantId); + if (identityProvider.getFederatedAuthenticatorConfigs().length == 1) { + endpointConfigurationManager.deleteEndpointConfigurations( + identityProvider.getFederatedAuthenticatorConfigs()[0], tenantId); + } deleteIdP(dbConnection, tenantId, null, resourceId); // Delete IdP related secrets from the IDN_SECRET table. idpSecretsProcessorService.deleteAssociatedSecrets(identityProvider); IdentityDatabaseUtil.commitTransaction(dbConnection); } catch (SQLException e) { IdentityDatabaseUtil.rollbackTransaction(dbConnection); - endpointConfigurationManager.addEndpointConfigurations(identityProvider.getDefaultAuthenticatorConfig(), - tenantId); + if (identityProvider.getFederatedAuthenticatorConfigs().length == 1) { + endpointConfigurationManager.addEndpointConfigurations( + identityProvider.getFederatedAuthenticatorConfigs()[0], tenantId); + } throw new IdentityProviderManagementException("Error occurred while deleting Identity Provider of tenant " + tenantDomain, e); } catch (IdentityProviderManagementException e) { @@ -4502,15 +4516,19 @@ public void forceDeleteIdP(String idPName, log.debug(String.format("Deleting SP Provisioning Associations for IDP:%s of tenantDomain:%s", idPName, tenantDomain)); } - endpointConfigurationManager.deleteEndpointConfigurations(identityProvider.getDefaultAuthenticatorConfig(), - tenantId); + if (identityProvider.getFederatedAuthenticatorConfigs().length == 1) { + endpointConfigurationManager.deleteEndpointConfigurations( + identityProvider.getFederatedAuthenticatorConfigs()[0], tenantId); + } deleteIdpSpProvisioningAssociations(dbConnection, tenantId, idPName); deleteIdP(dbConnection, tenantId, idPName, null); IdentityDatabaseUtil.commitTransaction(dbConnection); } catch (SQLException e) { IdentityDatabaseUtil.rollbackTransaction(dbConnection); - endpointConfigurationManager.addEndpointConfigurations(identityProvider.getDefaultAuthenticatorConfig(), - tenantId); + if (identityProvider.getFederatedAuthenticatorConfigs().length == 1) { + endpointConfigurationManager.addEndpointConfigurations( + identityProvider.getFederatedAuthenticatorConfigs()[0], tenantId); + } throw new IdentityProviderManagementException( String.format("Error occurred while deleting Identity Provider:%s of tenant:%s ", idPName, tenantDomain), e); @@ -4549,14 +4567,18 @@ public void forceDeleteIdPByResourceId(String resourceId, int tenantId, String t identityProvider.getIdentityProviderName(), tenantDomain)); } deleteIdpSpProvisioningAssociations(dbConnection, tenantId, identityProvider.getIdentityProviderName()); - endpointConfigurationManager.deleteEndpointConfigurations(identityProvider.getDefaultAuthenticatorConfig(), - tenantId); + if (identityProvider.getFederatedAuthenticatorConfigs().length == 1) { + endpointConfigurationManager.deleteEndpointConfigurations( + identityProvider.getFederatedAuthenticatorConfigs()[0], tenantId); + } deleteIdP(dbConnection, tenantId, null, resourceId); IdentityDatabaseUtil.commitTransaction(dbConnection); } catch (SQLException e) { IdentityDatabaseUtil.rollbackTransaction(dbConnection); - endpointConfigurationManager.addEndpointConfigurations(identityProvider.getDefaultAuthenticatorConfig(), - tenantId); + if (identityProvider.getFederatedAuthenticatorConfigs().length == 1) { + endpointConfigurationManager.addEndpointConfigurations( + identityProvider.getFederatedAuthenticatorConfigs()[0], tenantId); + } throw new IdentityProviderManagementException( String.format("Error occurred while deleting Identity Provider with resource ID:%s of tenant:%s ", resourceId, tenantDomain), e); diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/internal/IdpMgtServiceComponentHolder.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/internal/IdpMgtServiceComponentHolder.java index 629f0a20585a..758a7b7f630c 100644 --- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/internal/IdpMgtServiceComponentHolder.java +++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/internal/IdpMgtServiceComponentHolder.java @@ -57,7 +57,8 @@ public static IdpMgtServiceComponentHolder getInstance() { private RoleManagementService roleManagementService; private ClaimMetadataManagementService claimMetadataManagementService; private SecretManager secretManager; - private SecretResolveManager secretResolveManager; + private SecretResolveManager secretResolveManager; + private ActionManagementService actionManagementService; private List metadataConverters = new ArrayList<>(); diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/AuthenticatorEndpointConfigurationManager.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/AuthenticatorEndpointConfigurationManager.java index 7312896e6ff5..68c5cc8bf31e 100644 --- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/AuthenticatorEndpointConfigurationManager.java +++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/AuthenticatorEndpointConfigurationManager.java @@ -163,7 +163,7 @@ public FederatedAuthenticatorConfig createFederatedAuthenticatorConfig(Authentic } return new UserDefinedFederatedAuthenticatorConfig( - AuthenticatorPropertyConstants.AuthenticationType.Identification); + AuthenticatorPropertyConstants.AuthenticationType.IDENTIFICATION); } private Action buildActionToCreate(String authenticatorName, EndpointConfig endpointConfig) {