use of org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode in project carbon-apimgt by wso2.
the class APIProviderImpl method addCertificate.
@Override
public int addCertificate(String userName, String certificate, String alias, String endpoint) throws APIManagementException {
ResponseCode responseCode = ResponseCode.INTERNAL_SERVER_ERROR;
String tenantDomain = MultitenantUtils.getTenantDomain(userName);
try {
int tenantId = ServiceReferenceHolder.getInstance().getRealmService().getTenantManager().getTenantId(tenantDomain);
responseCode = certificateManager.addCertificateToParentNode(certificate, alias, endpoint, tenantId);
CertificateEvent certificateEvent = new CertificateEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.ENDPOINT_CERTIFICATE_ADD.toString(), tenantDomain, alias, endpoint);
APIUtil.sendNotification(certificateEvent, APIConstants.NotifierType.CERTIFICATE.name());
} catch (UserStoreException e) {
handleException("Error while reading tenant information", e);
}
return responseCode.getResponseCode();
}
Aggregations