diff --git a/components/org.wso2.carbon.identity.api.server.common/src/main/java/org/wso2/carbon/identity/api/server/common/Util.java b/components/org.wso2.carbon.identity.api.server.common/src/main/java/org/wso2/carbon/identity/api/server/common/Util.java index f569d7bb4d..47cc7b0782 100644 --- a/components/org.wso2.carbon.identity.api.server.common/src/main/java/org/wso2/carbon/identity/api/server/common/Util.java +++ b/components/org.wso2.carbon.identity.api.server.common/src/main/java/org/wso2/carbon/identity/api/server/common/Util.java @@ -18,8 +18,6 @@ import org.apache.commons.lang.StringUtils; import org.slf4j.MDC; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.identity.recovery.ChallengeQuestionManager; import java.nio.charset.StandardCharsets; import java.util.Base64; @@ -37,17 +35,6 @@ public class Util { private static final String PAGINATION_LINK_FORMAT = Constants.V1_API_PATH_COMPONENT + "%s?offset=%d&limit=%d"; - /** - * Get ChallengeQuestionManager osgi service - * - * @return ChallengeQuestionManager - */ - @Deprecated - public static ChallengeQuestionManager getChallengeQuestionManager() { - return (ChallengeQuestionManager) PrivilegedCarbonContext.getThreadLocalCarbonContext() - .getOSGiService(ChallengeQuestionManager.class, null); - } - /** * Get correlation id of current thread * diff --git a/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.common/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/common/GovernanceConstants.java b/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.common/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/common/GovernanceConstants.java index 8cfc8f10fa..d4762dfd65 100644 --- a/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.common/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/common/GovernanceConstants.java +++ b/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.common/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/common/GovernanceConstants.java @@ -67,7 +67,9 @@ public enum ErrorMessage { ERROR_CODE_INCORRECT_CONNECTOR_NAME("50011", "Invalid connector name", "Unable to find a connector with the name %s."), ERROR_CODE_UNSUPPORTED_PROPERTY_NAME("50012", "Unsupported property is requested.", - "The property %s is not supported by this API."); + "The property %s is not supported by this API."), + ERROR_CODE_INVALID_CONNECTOR_CONFIGURATION("50013", "Connector update failed.", + "Unable to update the identity governance connector. %s"); private final String code; private final String message; diff --git a/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/v1/core/ServerIdentityGovernanceService.java b/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/v1/core/ServerIdentityGovernanceService.java index 6787ef2fa8..28fd4d41a9 100644 --- a/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/v1/core/ServerIdentityGovernanceService.java +++ b/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/v1/core/ServerIdentityGovernanceService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, WSO2 LLC. (http://www.wso2.com). + * Copyright (c) 2019-2024, WSO2 LLC. (http://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -42,6 +42,7 @@ import org.wso2.carbon.identity.governance.IdentityGovernanceException; import org.wso2.carbon.identity.governance.IdentityGovernanceService; import org.wso2.carbon.identity.governance.bean.ConnectorConfig; +import org.wso2.carbon.identity.governance.exceptions.general.IdentityGovernanceClientException; import java.net.URI; import java.nio.charset.StandardCharsets; @@ -297,7 +298,9 @@ public void updateGovernanceConnectorProperty(String categoryId, String connecto configurationDetails.put(propertyReqDTO.getName(), propertyReqDTO.getValue()); } identityGovernanceService.updateConfiguration(tenantDomain, configurationDetails); - + } catch (IdentityGovernanceClientException e) { + throw handleBadRequestError(GovernanceConstants.ErrorMessage.ERROR_CODE_INVALID_CONNECTOR_CONFIGURATION, + e.getMessage()); } catch (IdentityGovernanceException e) { GovernanceConstants.ErrorMessage errorEnum = GovernanceConstants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_CONNECTOR_PROPERTY; @@ -508,4 +511,5 @@ private APIError handleNotFoundError(String resourceId, return new APIError(status, errorResponse); } + } diff --git a/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/resources/identity-governance.yaml b/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/resources/identity-governance.yaml index a4db1aa9a5..cc2adf747b 100644 --- a/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/resources/identity-governance.yaml +++ b/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/resources/identity-governance.yaml @@ -407,7 +407,7 @@ paths: