|
|
@ -103,7 +103,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String tags[],
|
|
|
|
public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String[] tags,
|
|
|
|
String keyType, String username,
|
|
|
|
String keyType, String username,
|
|
|
|
boolean isAllowedAllDomains,
|
|
|
|
boolean isAllowedAllDomains,
|
|
|
|
String validityTime, String password)
|
|
|
|
String validityTime, String password)
|
|
|
@ -116,15 +116,10 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
|
|
|
|
|
|
|
|
|
|
|
|
ApiApplicationInfo applicationInfo = applicationInfo(apiApplicationServices, username, password);
|
|
|
|
ApiApplicationInfo applicationInfo = applicationInfo(apiApplicationServices, username, password);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application[] applications =
|
|
|
|
|
|
|
|
consumerRESTAPIServices.getAllApplications(applicationInfo, applicationName);
|
|
|
|
|
|
|
|
io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application application;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<APIInfo> uniqueApiList = new ArrayList<>();
|
|
|
|
List<APIInfo> uniqueApiList = new ArrayList<>();
|
|
|
|
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> headerParams = new HashMap<>();
|
|
|
|
Map<String, String> headerParams = new HashMap<>();
|
|
|
|
if (!"carbon.super".equals(tenantDomain)) {
|
|
|
|
if (!"carbon.super".equals(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true))) {
|
|
|
|
headerParams.put("X-WSO2-Tenant", "carbon.super");
|
|
|
|
headerParams.put("X-WSO2-Tenant", "carbon.super");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -140,6 +135,9 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
|
|
|
|
uniqueApiList.addAll(taggedAPISet);
|
|
|
|
uniqueApiList.addAll(taggedAPISet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application[] applications =
|
|
|
|
|
|
|
|
consumerRESTAPIServices.getAllApplications(applicationInfo, applicationName);
|
|
|
|
|
|
|
|
io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application application;
|
|
|
|
if (applications.length == 0) {
|
|
|
|
if (applications.length == 0) {
|
|
|
|
application = new io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application();
|
|
|
|
application = new io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application();
|
|
|
|
application.setName(applicationName);
|
|
|
|
application.setName(applicationName);
|
|
|
@ -151,13 +149,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
|
|
|
|
Arrays.stream(applications).findFirst();
|
|
|
|
Arrays.stream(applications).findFirst();
|
|
|
|
application = applicationOpt.get();
|
|
|
|
application = applicationOpt.get();
|
|
|
|
Subscription[] subscriptions = consumerRESTAPIServices.getAllSubscriptions(applicationInfo, application.getApplicationId());
|
|
|
|
Subscription[] subscriptions = consumerRESTAPIServices.getAllSubscriptions(applicationInfo, application.getApplicationId());
|
|
|
|
for (Subscription subscription : subscriptions) {
|
|
|
|
Arrays.stream(subscriptions).map(Subscription::getApiInfo).forEachOrdered(uniqueApiList::remove);
|
|
|
|
if (uniqueApiList.contains(subscription.getApiInfo())) {
|
|
|
|
|
|
|
|
uniqueApiList.remove(subscription.getApiInfo());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
uniqueApiList.add(subscription.getApiInfo());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
addSubscriptions(application, uniqueApiList, applicationInfo);
|
|
|
|
addSubscriptions(application, uniqueApiList, applicationInfo);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
String msg = "Found more than one application for application name: " + applicationName;
|
|
|
|
String msg = "Found more than one application for application name: " + applicationName;
|
|
|
|