From 428f528b97de1ece5f99090cdfa2149327a036ea Mon Sep 17 00:00:00 2001 From: DilshanSenarath <74205483+DilshanSenarath@users.noreply.github.com> Date: Thu, 19 Dec 2024 20:23:20 +0530 Subject: [PATCH] use idp management facade --- .../application/mgt/dao/impl/ApplicationDAOImpl.java | 10 +++++----- .../wso2/carbon/idp/mgt/dao/CacheBackedIdPMgtDAO.java | 6 +++--- .../wso2/carbon/idp/mgt/dao/IdPManagementFacade.java | 10 ++++++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java index cc40df0c17c5..e89116b81d8e 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java @@ -1575,7 +1575,7 @@ private void updateLocalAndOutboundAuthenticationConfiguration(int applicationId for (LocalAuthenticatorConfig lclAuthenticator : authStep .getLocalAuthenticatorConfigs()) { // set the identity provider name to LOCAL. - int authenticatorId = getAuthentictorID(connection, tenantID, + int authenticatorId = getAuthenticatorID(connection, tenantID, ApplicationConstants.LOCAL_IDP_NAME, lclAuthenticator.getName()); if (authenticatorId < 0) { authenticatorId = addAuthenticator(connection, tenantID, @@ -1623,7 +1623,7 @@ private void updateLocalAndOutboundAuthenticationConfiguration(int applicationId for (FederatedAuthenticatorConfig authenticator : authenticators) { // ID, TENANT_ID, AUTHENTICATOR_ID if (authenticator != null) { - int authenticatorId = getAuthentictorID(connection, tenantID, + int authenticatorId = getAuthenticatorID(connection, tenantID, idpName, authenticator.getName()); if (authenticatorId > 0) { storeStepIDPAuthnPrepStmt.setInt(1, stepId); @@ -5015,8 +5015,8 @@ public boolean isApplicationExists(String serviceProviderName, String tenantName * @return * @throws SQLException */ - private int getAuthentictorID(Connection conn, int tenantId, String idpName, - String authenticatorName) throws SQLException { + private int getAuthenticatorID(Connection conn, int tenantId, String idpName, + String authenticatorName) throws SQLException { if (idpName == null || idpName.isEmpty()) { return -1; @@ -6687,7 +6687,7 @@ public String[] getSPsAssociatedWithFederatedIDPAuthenticator(String idpName, try { int defaultAuthenticatorId = - getAuthentictorID(dbConnection, tenantId, idpName, defaultAuthenticatorName); + getAuthenticatorID(dbConnection, tenantId, idpName, defaultAuthenticatorName); prepStmt = dbConnection.prepareStatement( ApplicationMgtDBQueries.GET_SP_UUIDS_ASSOCIATED_AUTH_FLOW_AUTHENTICATOR); diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/CacheBackedIdPMgtDAO.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/CacheBackedIdPMgtDAO.java index 6c13238c054c..259f3dfeadfd 100644 --- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/CacheBackedIdPMgtDAO.java +++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/CacheBackedIdPMgtDAO.java @@ -994,7 +994,7 @@ public ConnectedAppsResult getConnectedApplications(String resourceId, int limit */ public boolean isIdpReferredBySP(String idpName, int tenantId) throws IdentityProviderManagementException { - return idPMgtDAO.isIdpReferredBySP(idpName, tenantId); + return idPManagementFacade.isIdpReferredBySP(idpName, tenantId); } /** @@ -1009,7 +1009,7 @@ public boolean isIdpReferredBySP(String idpName, int tenantId) throws IdentityPr public boolean isAuthenticatorReferredBySP(String idpName, String authenticatorName, int tenantId) throws IdentityProviderManagementException { - return idPMgtDAO.isAuthenticatorReferredBySP(idpName, authenticatorName, tenantId); + return idPManagementFacade.isAuthenticatorReferredBySP(idpName, authenticatorName, tenantId); } /** @@ -1024,7 +1024,7 @@ public boolean isAuthenticatorReferredBySP(String idpName, String authenticatorN public boolean isOutboundConnectorReferredBySP(String idpName, String connectorName, int tenantId) throws IdentityProviderManagementException { - return idPMgtDAO.isOutboundConnectorReferredBySP(idpName, connectorName, tenantId); + return idPManagementFacade.isOutboundConnectorReferredBySP(idpName, connectorName, tenantId); } public ConnectedAppsResult getConnectedAppsOfLocalAuthenticator(String authenticatorId, int tenantId, diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementFacade.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementFacade.java index d81da034e0ab..0c1a15f09d36 100644 --- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementFacade.java +++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementFacade.java @@ -179,6 +179,16 @@ public boolean isIdpReferredBySP(String idPName, int tenantId) throws IdentityPr return dao.isIdpReferredBySP(idPName, tenantId); } + public boolean isAuthenticatorReferredBySP(String idpName, String authenticatorName, int tenantId) throws IdentityProviderManagementException { + + return dao.isAuthenticatorReferredBySP(idpName, authenticatorName, tenantId); + } + + public boolean isOutboundConnectorReferredBySP(String idpName, String connectorName, int tenantId) throws IdentityProviderManagementException { + + return dao.isOutboundConnectorReferredBySP(idpName, connectorName, tenantId); + } + public void deleteIdP(String idPName, int tenantId, String tenantDomain) throws IdentityProviderManagementException {