use of org.wso2.carbon.identity.api.server.idp.v1.model.OutboundConnectorListItem in project identity-api-server by wso2.
the class ServerIdpManagementService method createOutboundConnectorListItem.
private OutboundConnectorListItem createOutboundConnectorListItem(String idPId, ProvisioningConnectorConfig config) {
String connectorId = base64URLEncode(config.getName());
OutboundConnectorListItem listItem = new OutboundConnectorListItem();
listItem.setConnectorId(connectorId);
listItem.setName(config.getName());
listItem.setIsEnabled(config.isEnabled());
listItem.setSelf(ContextLoader.buildURIForBody(String.format(V1_API_PATH_COMPONENT + IDP_PATH_COMPONENT + "/%s/provisioning/outbound-connectors/%s", idPId, connectorId)).toString());
return listItem;
}
use of org.wso2.carbon.identity.api.server.idp.v1.model.OutboundConnectorListItem in project identity-api-server by wso2.
the class ServerIdpManagementService method createOutboundProvisioningResponse.
private OutboundConnectorListResponse createOutboundProvisioningResponse(IdentityProvider idp) {
ProvisioningConnectorConfig[] connectorConfigs = idp.getProvisioningConnectorConfigs();
List<OutboundConnectorListItem> connectors = new ArrayList<>();
if (connectorConfigs != null) {
for (ProvisioningConnectorConfig connectorConfig : connectorConfigs) {
OutboundConnectorListItem connectorListItem = new OutboundConnectorListItem();
connectorListItem.setConnectorId(base64URLEncode(connectorConfig.getName()));
connectorListItem.setName(connectorConfig.getName());
connectorListItem.setIsEnabled(connectorConfig.isEnabled());
connectorListItem.setSelf(ContextLoader.buildURIForBody(String.format(V1_API_PATH_COMPONENT + IDP_PATH_COMPONENT + "/%s/provisioning/outbound-connectors/%s", idp.getResourceId(), base64URLEncode(connectorConfig.getName()))).toString());
connectors.add(connectorListItem);
}
}
OutboundConnectorListResponse outboundConnectorListResponse = new OutboundConnectorListResponse();
outboundConnectorListResponse.setDefaultConnectorId(idp.getDefaultProvisioningConnectorConfig() != null ? base64URLEncode(idp.getDefaultProvisioningConnectorConfig().getName()) : null);
outboundConnectorListResponse.setConnectors(connectors);
return outboundConnectorListResponse;
}
use of org.wso2.carbon.identity.api.server.idp.v1.model.OutboundConnectorListItem in project identity-api-server by wso2.
the class ServerIdpManagementService method getOutboundConnectors.
/**
* Get outbound provisioning connectors of a specific Identity Provider.
*
* @param idpId Identity Provider resource ID.
* @return OutboundConnectorListResponse.
*/
public OutboundConnectorListResponse getOutboundConnectors(String idpId) {
try {
IdentityProvider idp = IdentityProviderServiceHolder.getIdentityProviderManager().getIdPByResourceId(idpId, ContextLoader.getTenantDomainFromContext(), true);
if (idp == null) {
throw handleException(Response.Status.NOT_FOUND, Constants.ErrorMessage.ERROR_CODE_IDP_NOT_FOUND, idpId);
}
OutboundConnectorListResponse listResponse = null;
String defaultConnectorId = null;
ProvisioningConnectorConfig[] connectorConfigs = idp.getProvisioningConnectorConfigs();
if (connectorConfigs != null) {
listResponse = new OutboundConnectorListResponse();
List<OutboundConnectorListItem> connectorList = new ArrayList<>();
for (ProvisioningConnectorConfig config : connectorConfigs) {
connectorList.add(createOutboundConnectorListItem(idpId, config));
if (idp.getDefaultProvisioningConnectorConfig() != null) {
defaultConnectorId = base64URLEncode(idp.getDefaultProvisioningConnectorConfig().getName());
}
}
listResponse.setDefaultConnectorId(defaultConnectorId);
listResponse.setConnectors(connectorList);
}
return listResponse;
} catch (IdentityProviderManagementException e) {
throw handleIdPException(e, Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_IDP_CONNECTORS, idpId);
}
}
Aggregations