apim seperation

revert-70aa11f8
ayyoob 8 years ago
parent 4128e2d355
commit 5927064435

@ -104,27 +104,11 @@ public class ApiApplicationRegistrationServiceImpl implements ApiApplicationRegi
} else {
validityPeriod = registrationProfile.getValidityPeriod();
}
if (registrationProfile.isMappingAnExistingOAuthApp()) {
JSONObject jsonStringObject = new JSONObject();
jsonStringObject.put(ApiApplicationConstants.JSONSTRING_USERNAME_TAG, username);
jsonStringObject.put(ApiApplicationConstants.JSONSTRING_KEY_TYPE_TAG,
ApiApplicationConstants.DEFAULT_TOKEN_TYPE);
jsonStringObject.put(ApiApplicationConstants.OAUTH_CLIENT_ID, registrationProfile.getConsumerKey());
jsonStringObject.put(ApiApplicationConstants.OAUTH_CLIENT_SECRET,
registrationProfile.getConsumerSecret());
jsonStringObject.put(ApiApplicationConstants.JSONSTRING_VALIDITY_PERIOD_TAG, validityPeriod);
apiManagementProviderService.registerExistingOAuthApplicationToAPIApplication(
jsonStringObject.toJSONString(), registrationProfile.getApplicationName(),
registrationProfile.getConsumerKey(), username, registrationProfile.isAllowedToAllDomains(),
ApiApplicationConstants.DEFAULT_TOKEN_TYPE, registrationProfile.getTags());
return Response.status(Response.Status.ACCEPTED).entity("true").build();
} else {
ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
registrationProfile.getApplicationName(), registrationProfile.getTags(),
ApiApplicationConstants.DEFAULT_TOKEN_TYPE, username,
registrationProfile.isAllowedToAllDomains(), validityPeriod);
return Response.status(Response.Status.CREATED).entity(apiApplicationKey.toString()).build();
}
ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
registrationProfile.getApplicationName(), registrationProfile.getTags(),
ApiApplicationConstants.DEFAULT_TOKEN_TYPE, username,
registrationProfile.isAllowedToAllDomains(), validityPeriod);
return Response.status(Response.Status.CREATED).entity(apiApplicationKey.toString()).build();
} catch (APIManagerException e) {
String msg = "Error occurred while registering an application '"
+ registrationProfile.getApplicationName() + "'";

@ -37,10 +37,6 @@ public class RegistrationProfile {
private String tags[];
@XmlElement(required = true)
private boolean isAllowedToAllDomains;
@XmlElement(required = true)
private boolean isMappingAnExistingOAuthApp;
private String consumerKey;
private String consumerSecret;
@XmlElement(required = false)
private String validityPeriod;
@ -68,30 +64,6 @@ public class RegistrationProfile {
this.isAllowedToAllDomains = isAllowedToAllDomains;
}
public boolean isMappingAnExistingOAuthApp() {
return isMappingAnExistingOAuthApp;
}
public void setIsMappingAnExistingOAuthApp(boolean isMappingAnExistingOAuthApp) {
this.isMappingAnExistingOAuthApp = isMappingAnExistingOAuthApp;
}
public String getConsumerKey() {
return consumerKey;
}
public void setConsumerKey(String consumerKey) {
this.consumerKey = consumerKey;
}
public String getConsumerSecret() {
return consumerSecret;
}
public void setConsumerSecret(String consumerSecret) {
this.consumerSecret = consumerSecret;
}
public String getValidityPeriod() {
return validityPeriod;
}

@ -51,6 +51,10 @@
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>

@ -41,15 +41,7 @@ public interface APIManagementProviderService {
*/
ApiApplicationKey generateAndRetrieveApplicationKeys(String apiApplicationName, String tags[],
String keyType, String username, boolean isAllowedAllDomains,
String validityTime)
throws APIManagerException;
/**
* Register existing Oauth application as apim application.
*/
void registerExistingOAuthApplicationToAPIApplication(String jsonString, String applicationName, String clientId,
String username, boolean isAllowedAllDomains, String keyType,
String tags[]) throws APIManagerException;
String validityTime) throws APIManagerException;
/**
* Remove APIM Application.

@ -0,0 +1,151 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.application.extension;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.apimgt.application.extension.constants.ApiApplicationConstants;
import org.wso2.carbon.apimgt.application.extension.dto.ApiApplicationKey;
import org.wso2.carbon.apimgt.application.extension.exception.APIManagerException;
import org.wso2.carbon.apimgt.application.extension.internal.APIApplicationManagerExtensionDataHolder;
import org.wso2.carbon.apimgt.application.extension.util.APIManagerUtil;
import org.wso2.carbon.apimgt.integration.client.StoreClient;
import org.wso2.carbon.apimgt.store.client.model.APIInfo;
import org.wso2.carbon.apimgt.store.client.model.APIList;
import org.wso2.carbon.apimgt.store.client.model.Application;
import org.wso2.carbon.apimgt.store.client.model.ApplicationInfo;
import org.wso2.carbon.apimgt.store.client.model.ApplicationKey;
import org.wso2.carbon.apimgt.store.client.model.ApplicationKeyGenerateRequest;
import org.wso2.carbon.apimgt.store.client.model.ApplicationList;
import org.wso2.carbon.apimgt.store.client.model.Subscription;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import java.util.ArrayList;
import java.util.List;
/**
* This class represents an implementation of APIManagementProviderService.
*/
public class APIManagementRestProviderServiceImpl implements APIManagementProviderService {
private static final Log log = LogFactory.getLog(APIManagementRestProviderServiceImpl.class);
private static final String CONTENT_TYPE = "application/json";
private static final int MAX_API_PER_TAG = 200;
@Override
public void removeAPIApplication(String applicationName, String username) throws APIManagerException {
StoreClient storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService()
.getStoreClient();
ApplicationList applicationList = storeClient.getApplications()
.applicationsGet("", applicationName, 1, 0, CONTENT_TYPE, null);
if (applicationList.getList() != null && applicationList.getList().size() > 0) {
ApplicationInfo applicationInfo = applicationList.getList().get(0);
storeClient.getIndividualApplication().applicationsApplicationIdDelete(applicationInfo.getApplicationId(),
null, null);
}
}
/**
* {@inheritDoc}
*/
@Override
public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String tags[],
String keyType, String username,
boolean isAllowedAllDomains, String validityTime)
throws APIManagerException {
StoreClient storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService()
.getStoreClient();
ApplicationList applicationList = storeClient.getApplications()
.applicationsGet("", applicationName, 1, 0, CONTENT_TYPE, null);
Application application;
if (applicationList == null || applicationList.getList() == null || applicationList.getList().size() == 0) {
//create application;
application = new Application();
application.setName(applicationName);
application.setSubscriber(username);
application.setDescription("");
application.setThrottlingTier(ApiApplicationConstants.DEFAULT_TIER);
application.setGroupId("");
application = storeClient.getIndividualApplication().applicationsPost(application, CONTENT_TYPE);
} else {
ApplicationInfo applicationInfo = applicationList.getList().get(0);
application = storeClient.getIndividualApplication()
.applicationsApplicationIdGet(applicationInfo.getApplicationId(), CONTENT_TYPE, null, null);
}
if (application == null) {
throw new APIManagerException (
"Api application creation failed for " + applicationName + " to the user " + username);
}
// subscribe to apis.
if (tags != null && tags.length > 0) {
for (String tag: tags) {
APIList apiList = storeClient.getApis().apisGet(MAX_API_PER_TAG, 0, null, "tag:" + tag, CONTENT_TYPE, null);
if (apiList.getList() != null && apiList.getList().size() == 0) {
apiList = storeClient.getApis().apisGet(MAX_API_PER_TAG, 0
, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, "tag:" + tag, CONTENT_TYPE, null);
}
if (apiList.getList() != null && apiList.getList().size() > 0) {
for (APIInfo apiInfo :apiList.getList()) {
Subscription subscription = new Subscription();
subscription.setApiIdentifier(apiInfo.getId());
subscription.setApplicationId(application.getApplicationId());
subscription.tier(ApiApplicationConstants.DEFAULT_TIER);
storeClient.getIndividualSubscription().subscriptionsPost(subscription, CONTENT_TYPE);
}
}
}
}
//end of subscription
List<ApplicationKey> applicationKeys = application.getKeys();
if (applicationKeys != null) {
for (ApplicationKey applicationKey : applicationKeys) {
if (keyType.equals(applicationKey.getKeyType())) {
ApiApplicationKey apiApplicationKey = new ApiApplicationKey();
apiApplicationKey.setConsumerKey(applicationKey.getConsumerKey());
apiApplicationKey.setConsumerSecret(applicationKey.getConsumerSecret());
return apiApplicationKey;
}
}
}
ApplicationKeyGenerateRequest applicationKeyGenerateRequest = new ApplicationKeyGenerateRequest();
List<String> allowedDomains = new ArrayList<>();
if (isAllowedAllDomains) {
allowedDomains.add(ApiApplicationConstants.ALLOWED_DOMAINS);
} else {
allowedDomains.add(APIManagerUtil.getTenantDomain());
}
applicationKeyGenerateRequest.setAccessAllowDomains(allowedDomains);
applicationKeyGenerateRequest.setCallbackUrl("");
applicationKeyGenerateRequest.setKeyType(ApplicationKeyGenerateRequest.KeyTypeEnum.PRODUCTION);
applicationKeyGenerateRequest.setValidityTime(validityTime);
ApplicationKey applicationKey = storeClient.getIndividualApplication().applicationsGenerateKeysPost(
application.getApplicationId(), applicationKeyGenerateRequest, CONTENT_TYPE, null, null);
ApiApplicationKey apiApplicationKey = new ApiApplicationKey();
apiApplicationKey.setConsumerKey(applicationKey.getConsumerKey());
apiApplicationKey.setConsumerSecret(applicationKey.getConsumerSecret());
return apiApplicationKey;
}
}

@ -18,6 +18,7 @@
package org.wso2.carbon.apimgt.application.extension.internal;
import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService;
import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService;
import org.wso2.carbon.registry.core.service.TenantRegistryLoader;
import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader;
import org.wso2.carbon.user.core.service.RealmService;
@ -30,6 +31,7 @@ public class APIApplicationManagerExtensionDataHolder {
private TenantManager tenantManager;
private TenantRegistryLoader tenantRegistryLoader;
private TenantIndexingLoader indexLoader;
private IntegrationClientService integrationClientService;
private APIApplicationManagerExtensionDataHolder() {
}
@ -86,4 +88,13 @@ public class APIApplicationManagerExtensionDataHolder {
public TenantIndexingLoader getIndexLoaderService(){
return indexLoader;
}
public IntegrationClientService getIntegrationClientService() {
return integrationClientService;
}
public void setIntegrationClientService(
IntegrationClientService integrationClientService) {
this.integrationClientService = integrationClientService;
}
}

@ -23,6 +23,8 @@ import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;;
import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService;
import org.wso2.carbon.apimgt.application.extension.APIManagementProviderServiceImpl;
import org.wso2.carbon.apimgt.application.extension.APIManagementRestProviderServiceImpl;
import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService;
import org.wso2.carbon.registry.core.service.TenantRegistryLoader;
import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader;
import org.wso2.carbon.user.core.service.RealmService;
@ -48,6 +50,11 @@ import org.wso2.carbon.user.core.service.RealmService;
* policy="dynamic"
* bind="setRealmService"
* unbind="unsetRealmService"
* interface="org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService"
* cardinality="1..1"
* policy="dynamic"
* bind="setIntegrationClientService"
* unbind="unsetIntegrationClientService"
*/
public class APIApplicationManagerExtensionServiceComponent {
@ -57,7 +64,7 @@ public class APIApplicationManagerExtensionServiceComponent {
if (log.isDebugEnabled()) {
log.debug("Initializing device extension bundle");
}
APIManagementProviderService apiManagementProviderService = new APIManagementProviderServiceImpl();
APIManagementProviderService apiManagementProviderService = new APIManagementRestProviderServiceImpl();
APIApplicationManagerExtensionDataHolder.getInstance().setAPIManagementProviderService(apiManagementProviderService);
BundleContext bundleContext = componentContext.getBundleContext();
bundleContext.registerService(APIManagementProviderService.class.getName(), apiManagementProviderService, null);
@ -86,6 +93,17 @@ public class APIApplicationManagerExtensionServiceComponent {
APIApplicationManagerExtensionDataHolder.getInstance().setIndexLoaderService(null);
}
protected void setIntegrationClientService(IntegrationClientService integrationClientService) {
if (integrationClientService != null && log.isDebugEnabled()) {
log.debug("integrationClientService initialized");
}
APIApplicationManagerExtensionDataHolder.getInstance().setIntegrationClientService(integrationClientService);
}
protected void unsetIntegrationClientService(IntegrationClientService integrationClientService) {
APIApplicationManagerExtensionDataHolder.getInstance().setIntegrationClientService(null);
}
/**
* Sets Realm Service.
*

@ -0,0 +1,159 @@
<!-- ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ ~ WSO2 Inc. licenses this file to you under the Apache License, ~ Version
2.0 (the "License"); you may not use this file except ~ in compliance with
the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0
~ ~ Unless required by applicable law or agreed to in writing, ~ software
distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
License for the ~ specific language governing permissions and limitations
~ under the License. -->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
<version>2.0.8-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Client</name>
<description>WSO2 Carbon - API Management Integration Client</description>
<url>http://wso2.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Description>APIM Integration</Bundle-Description>
<Private-Package>org.wso2.carbon.apimgt.integration.client.internal</Private-Package>
<Export-Package>
org.wso2.carbon.apimgt.integration.client.*,
!org.wso2.carbon.apimgt.integration.client.internal
</Export-Package>
<Import-Package>
org.osgi.framework,
org.osgi.service.component,
org.wso2.carbon.logging,
io.swagger,
junit,
feign,
feign.jackson,
feign.codec,
com.google.gson,
feign.auth,
feign.gson,
feign.slf4j,
feign.jaxrs,
com.fasterxml.jackson.core,
org.wso2.carbon.apimgt.publisher.client.*,
org.wso2.carbon.apimgt.store.client.*,
</Import-Package>
<Embed-Dependency>
javax.ws.rs-api
</Embed-Dependency>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-gson</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.publisher.client</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.store.client</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.identity.jwt.client.extension</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,43 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client;
import feign.RequestInterceptor;
import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService;
public class IntegrationClientServiceImpl implements IntegrationClientService {
private static StoreClient storeClient;
private static PublisherClient publisherClient;
public IntegrationClientServiceImpl() {
RequestInterceptor oAuthRequestInterceptor = new OAuthRequestInterceptor();
storeClient = new StoreClient(oAuthRequestInterceptor);
publisherClient = new PublisherClient(oAuthRequestInterceptor);
}
@Override
public StoreClient getStoreClient() {
return storeClient;
}
@Override
public PublisherClient getPublisherClient() {
return publisherClient;
}
}

@ -0,0 +1,111 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*
*/
package org.wso2.carbon.apimgt.integration.client;
import feign.Feign;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import feign.auth.BasicAuthRequestInterceptor;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import feign.jaxrs.JAXRSContract;
import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader;
import org.wso2.carbon.apimgt.integration.client.exception.APIMClientOAuthException;
import org.wso2.carbon.apimgt.integration.client.internal.APIIntegrationClientDataHolder;
import org.wso2.carbon.apimgt.integration.client.model.ClientProfile;
import org.wso2.carbon.apimgt.integration.client.model.DCRClient;
import org.wso2.carbon.apimgt.integration.client.model.OAuthApplication;
import org.wso2.carbon.apimgt.integration.client.util.PropertyUtils;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.jwt.client.extension.JWTClient;
import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo;
import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException;
import org.wso2.carbon.user.api.UserStoreException;
import java.util.HashMap;
import java.util.Map;
/**
* This is a request interceptor to add oauth token header.
*/
public class OAuthRequestInterceptor implements RequestInterceptor {
private static final String APPLICATION_NAME = "api_integration_client";
private static final String GRANT_TYPES = "password refresh_token urn:ietf:params:oauth:grant-type:jwt-bearer";
private static final String REQUIRED_SCOPE =
"apim:api_create apim:api_view apim:api_publish apim:subscribe apim:tier_view apim:tier_manage " +
"apim:subscription_view apim:subscription_block";
private static final long DEFAULT_REFRESH_TIME_OFFSET_IN_MILLIS = 100000;
private DCRClient dcrClient;
private static OAuthApplication oAuthApplication;
private static Map<String, AccessTokenInfo> tenantTokenMap = new HashMap<>();
/**
* Creates an interceptor that authenticates all requests.
*/
public OAuthRequestInterceptor() {
String username = APIMConfigReader.getInstance().getConfig().getUsername();
String password = APIMConfigReader.getInstance().getConfig().getPassword();
dcrClient = Feign.builder().requestInterceptor(
new BasicAuthRequestInterceptor(username, password))
.contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder())
.target(DCRClient.class, PropertyUtils.replaceProperties(
APIMConfigReader.getInstance().getConfig().getDcrEndpoint()));
}
@Override
public void apply(RequestTemplate template) {
if (oAuthApplication == null) {
//had to do on demand initialization due to start up error.
ClientProfile clientProfile = new ClientProfile();
clientProfile.setClientName(APPLICATION_NAME);
clientProfile.setCallbackUrl("");
clientProfile.setGrantType(GRANT_TYPES);
clientProfile.setOwner(APIMConfigReader.getInstance().getConfig().getUsername());
clientProfile.setSaasApp(true);
oAuthApplication = dcrClient.register(clientProfile);
}
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
AccessTokenInfo tenantBasedAccessTokenInfo = tenantTokenMap.get(tenantDomain);
if ((tenantBasedAccessTokenInfo == null ||
((System.currentTimeMillis() + DEFAULT_REFRESH_TIME_OFFSET_IN_MILLIS) >
tenantBasedAccessTokenInfo.getExpiresIn()))) {
try {
JWTClient jwtClient = APIIntegrationClientDataHolder.getInstance().getJwtClientManagerService()
.getJWTClient();
String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm()
.getRealmConfiguration().getAdminUserName() + "@" + tenantDomain;
tenantBasedAccessTokenInfo = jwtClient.getAccessToken(oAuthApplication.getClientId(),
oAuthApplication.getClientSecret(), username,
REQUIRED_SCOPE);
tenantBasedAccessTokenInfo.setExpiresIn(
System.currentTimeMillis() + (tenantBasedAccessTokenInfo.getExpiresIn() * 1000));
tenantTokenMap.put(tenantDomain, tenantBasedAccessTokenInfo);
} catch (JWTClientException e) {
throw new APIMClientOAuthException("failed to retrieve oauth token using jwt", e);
} catch (UserStoreException e) {
throw new APIMClientOAuthException("failed to retrieve tenant admin username", e);
}
}
if (tenantBasedAccessTokenInfo.getAccessToken() != null) {
String headerValue = "Bearer " + tenantBasedAccessTokenInfo.getAccessToken();
template.header("Authorization", headerValue);
}
}
}

@ -0,0 +1,92 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client;
import feign.Feign;
import feign.RequestInterceptor;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import feign.jaxrs.JAXRSContract;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader;
import org.wso2.carbon.apimgt.publisher.client.api.APIDocumentApi;
import org.wso2.carbon.apimgt.publisher.client.api.APIsApi;
import org.wso2.carbon.apimgt.publisher.client.api.ApplicationsApi;
import org.wso2.carbon.apimgt.publisher.client.api.EnvironmentsApi;
import org.wso2.carbon.apimgt.publisher.client.api.SubscriptionsApi;
import org.wso2.carbon.apimgt.publisher.client.api.TiersApi;
import org.wso2.carbon.apimgt.publisher.client.invoker.ApiClient;
/**
* Publisher client generated using swagger.
*/
public class PublisherClient {
private static final org.apache.commons.logging.Log log = LogFactory.getLog(PublisherClient.class);
private APIsApi api = null;
private APIDocumentApi document = null;
private ApplicationsApi application = null;
private EnvironmentsApi environments = null;
private SubscriptionsApi subscriptions = null;
private TiersApi tiers = null;
/**
* PublisherClient constructor - Initialize a PublisherClient instance
*
*/
public PublisherClient(RequestInterceptor requestInterceptor) {
Feign.Builder builder = Feign.builder().requestInterceptor(requestInterceptor)
.contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder());
ApiClient client = new ApiClient();
client.setBasePath(APIMConfigReader.getInstance().getConfig().getPublisherEndpoint());
client.setFeignBuilder(builder);
api = client.buildClient(APIsApi.class);
document = client.buildClient(APIDocumentApi.class);
application = client.buildClient(ApplicationsApi.class);
environments = client.buildClient(EnvironmentsApi.class);
subscriptions = client.buildClient(SubscriptionsApi.class);
tiers = client.buildClient(TiersApi.class);
}
public APIsApi getApi() {
return api;
}
public APIDocumentApi getDocument() {
return document;
}
public ApplicationsApi getApplication() {
return application;
}
public EnvironmentsApi getEnvironments() {
return environments;
}
public SubscriptionsApi getSubscriptions() {
return subscriptions;
}
public TiersApi getTiers() {
return tiers;
}
}

@ -0,0 +1,103 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client;
import feign.Feign;
import feign.RequestInterceptor;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import feign.jaxrs.JAXRSContract;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader;
import org.wso2.carbon.apimgt.store.client.api.*;
import org.wso2.carbon.apimgt.store.client.invoker.ApiClient;
/**
* API Store client, created using swagger gen.
*/
public class StoreClient {
private static final org.apache.commons.logging.Log log = LogFactory.getLog(StoreClient.class);
private ApisAPIApi apis = null;
private APIindividualApi individualApi = null;
private ApplicationCollectionApi applications = null;
private ApplicationindividualApi individualApplication = null;
private SubscriptionCollectionApi subscriptions = null;
private SubscriptionindividualApi individualSubscription = null;
private TierindividualApi individualTier = null;
private TagCollectionApi tags = null;
private TierCollectionApi tiers = null;
public StoreClient(RequestInterceptor requestInterceptor) {
Feign.Builder builder = Feign.builder().requestInterceptor(requestInterceptor)
.contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder());
ApiClient client = new ApiClient();
client.setBasePath(APIMConfigReader.getInstance().getConfig().getStoreEndpoint());
client.setFeignBuilder(builder);
apis = client.buildClient(ApisAPIApi.class);
individualApi = client.buildClient(APIindividualApi.class);
applications = client.buildClient(ApplicationCollectionApi.class);
individualApplication = client.buildClient(ApplicationindividualApi.class);
subscriptions = client.buildClient(SubscriptionCollectionApi.class);
individualSubscription = client.buildClient(SubscriptionindividualApi.class);
tags = client.buildClient(TagCollectionApi.class);
tiers = client.buildClient(TierCollectionApi.class);
individualTier = client.buildClient(TierindividualApi.class);
}
public ApisAPIApi getApis() {
return apis;
}
public APIindividualApi getIndividualApi() {
return individualApi;
}
public ApplicationCollectionApi getApplications() {
return applications;
}
public ApplicationindividualApi getIndividualApplication() {
return individualApplication;
}
public SubscriptionCollectionApi getSubscriptions() {
return subscriptions;
}
public SubscriptionindividualApi getIndividualSubscription() {
return individualSubscription;
}
public TierindividualApi getIndividualTier() {
return individualTier;
}
public TagCollectionApi getTags() {
return tags;
}
public TierCollectionApi getTiers() {
return tiers;
}
}

@ -0,0 +1,90 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client.configs;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* This holds the configuration api manager integration.
*/
@XmlRootElement(name = "APIMConfiguration")
public class APIMConfig {
String dcrEndpoint;
String tokenEndpoint;
String publisherEndpoint;
String storeEndpoint;
String username;
String password;
@XmlElement(name = "DCREndpoint", required = true)
public String getDcrEndpoint() {
return dcrEndpoint;
}
public void setDcrEndpoint(String dcrEndpoint) {
this.dcrEndpoint = dcrEndpoint;
}
@XmlElement(name = "TokenEndpoint", required = true)
public String getTokenEndpoint() {
return tokenEndpoint;
}
public void setTokenEndpoint(String tokenEndpoint) {
this.tokenEndpoint = tokenEndpoint;
}
@XmlElement(name = "PublisherEndpoint", required = true)
public String getPublisherEndpoint() {
return publisherEndpoint;
}
public void setPublisherEndpoint(String publisherEndpoint) {
this.publisherEndpoint = publisherEndpoint;
}
@XmlElement(name = "StoreEndpoint", required = true)
public String getStoreEndpoint() {
return storeEndpoint;
}
public void setStoreEndpoint(String storeEndpoint) {
this.storeEndpoint = storeEndpoint;
}
@XmlElement(name = "Username", required = true)
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@XmlElement(name = "Password", required = true)
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}

@ -0,0 +1,94 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client.configs;
import org.w3c.dom.Document;
import org.wso2.carbon.apimgt.integration.client.exception.APIMClientException;
import org.wso2.carbon.apimgt.integration.client.exception.InvalidConfigurationStateException;
import org.wso2.carbon.utils.CarbonUtils;
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
/**
* This holds the configuration parser for api integration.xml
*/
public class APIMConfigReader {
private static APIMConfig config;
private static APIMConfigReader configReader= new APIMConfigReader();
private static boolean isInitialized = false;
private static final String API_INTEGRATION_CONFIG_PATH =
CarbonUtils.getCarbonConfigDirPath() + File.separator + "apim-integration.xml";
private APIMConfigReader() {
}
private static String apimIntegrationXmlFilePath = "";
//TOD file may be a part of another file
public static APIMConfigReader getInstance() {
if (!isInitialized) {
try {
init();
} catch (APIMClientException e) {
throw new InvalidConfigurationStateException("Webapp Authenticator Configuration is not " +
"initialized properly");
}
}
return configReader;
}
public static void init() throws APIMClientException {
try {
File apimConfigFile = new File(API_INTEGRATION_CONFIG_PATH);
Document doc = convertToDocument(apimConfigFile);
JAXBContext ctx = JAXBContext.newInstance(APIMConfig.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
config = (APIMConfig) unmarshaller.unmarshal(doc);
isInitialized = true;
} catch (JAXBException e) {
throw new APIMClientException("Error occurred while un-marshalling APIMConfig", e);
}
}
private static Document convertToDocument(File file) throws APIMClientException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder docBuilder = factory.newDocumentBuilder();
return docBuilder.parse(file);
} catch (Exception e) {
throw new APIMClientException("Error occurred while parsing file 'apim-integration.xml' to a org.w3c.dom.Document", e);
}
}
public APIMConfig getConfig() {
return config;
}
}

@ -0,0 +1,58 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client.exception;
/**
* This holds api client exception.
*/
public class APIMClientException extends Exception {
private static final long serialVersionUID = -3976392476319079281L;
private String responseReason;
private int responseStatus;
private String methodKey;
APIMClientException(String methodKey, String reason, int status) {
super("Exception occured while invoking " + methodKey + " status = " + status + " reason = " + reason);
this.methodKey = methodKey;
this.responseReason = reason;
this.responseStatus = status;
}
APIMClientException(String message) {
super(message);
}
public APIMClientException(String message, Exception e) {
super(message, e);
}
public String getResponseReason() {
return responseReason;
}
public int getResponseStatus() {
return responseStatus;
}
public String getMethodKey() {
return methodKey;
}
}

@ -0,0 +1,58 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client.exception;
/**
* This holds api client exception.
*/
public class APIMClientOAuthException extends RuntimeException {
private static final long serialVersionUID = -3976392476319079281L;
private String responseReason;
private int responseStatus;
private String methodKey;
APIMClientOAuthException(String methodKey, String reason, int status) {
super("Exception occured while invoking " + methodKey + " status = " + status + " reason = " + reason);
this.methodKey = methodKey;
this.responseReason = reason;
this.responseStatus = status;
}
APIMClientOAuthException(String message) {
super(message);
}
public APIMClientOAuthException(String message, Exception e) {
super(message, e);
}
public String getResponseReason() {
return responseReason;
}
public int getResponseStatus() {
return responseStatus;
}
public String getMethodKey() {
return methodKey;
}
}

@ -0,0 +1,78 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.apimgt.integration.client.exception;
/**
* This error is thrown when there is an issue with the client.
*/
public class InvalidConfigurationStateException extends RuntimeException {
private static final long serialVersionUID = -3151279311329070397L;
private String errorMessage;
private int errorCode;
public InvalidConfigurationStateException(int errorCode, String message) {
super(message);
this.errorCode = errorCode;
}
public InvalidConfigurationStateException(int errorCode, String message, Throwable cause) {
super(message, cause);
this.errorCode = errorCode;
}
public int getErrorCode() {
return errorCode;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public InvalidConfigurationStateException(String msg, Exception nestedEx) {
super(msg, nestedEx);
setErrorMessage(msg);
}
public InvalidConfigurationStateException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
public InvalidConfigurationStateException(String msg) {
super(msg);
setErrorMessage(msg);
}
public InvalidConfigurationStateException() {
super();
}
public InvalidConfigurationStateException(Throwable cause) {
super(cause);
}
}

@ -0,0 +1,45 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.apimgt.integration.client.internal;
import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService;
/**
* This holds the required service for this component
*/
public class APIIntegrationClientDataHolder {
private static APIIntegrationClientDataHolder thisInstance = new APIIntegrationClientDataHolder();
private JWTClientManagerService jwtClientManagerService;
private APIIntegrationClientDataHolder() {
}
public static APIIntegrationClientDataHolder getInstance() {
return thisInstance;
}
public void setJwtClientManagerService(JWTClientManagerService jwtClientManagerService) {
this.jwtClientManagerService = jwtClientManagerService;
}
public JWTClientManagerService getJwtClientManagerService() {
return jwtClientManagerService;
}
}

@ -0,0 +1,77 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.apimgt.integration.client.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.apimgt.integration.client.IntegrationClientServiceImpl;
import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader;
import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService;
import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService;
/**
* @scr.component name="org.wso2.carbon.api.integration.client" immediate="true"
* @scr.reference name="api.integration.client.service"
* interface="org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService"
* cardinality="1..1"
* policy="dynamic"
* bind="setJWTClientManagerService"
* unbind="unsetJWTClientManagerService"
*/
public class APIIntegrationClientServiceComponent {
private static Log log = LogFactory.getLog(APIIntegrationClientServiceComponent.class);
protected void activate(ComponentContext componentContext) {
try {
if (log.isDebugEnabled()) {
log.debug("Initializing apimgt client bundle");
}
/* Initializing webapp publisher configuration */
APIMConfigReader.init();
BundleContext bundleContext = componentContext.getBundleContext();
bundleContext.registerService(IntegrationClientService.class.getName(), new IntegrationClientServiceImpl(), null);
if (log.isDebugEnabled()) {
log.debug("apimgt client bundle has been successfully initialized");
}
} catch (Throwable e) {
log.error("Error occurred while initializing apimgt client bundle", e);
}
}
protected void deactivate(ComponentContext componentContext) {
//do nothing
}
protected void setJWTClientManagerService(JWTClientManagerService jwtClientManagerService) {
if (jwtClientManagerService != null) {
log.debug("jwtClientManagerService service is initialized");
}
APIIntegrationClientDataHolder.getInstance().setJwtClientManagerService(jwtClientManagerService);
}
protected void unsetJWTClientManagerService(JWTClientManagerService jwtClientManagerService) {
APIIntegrationClientDataHolder.getInstance().setJwtClientManagerService(null);
}
}

@ -0,0 +1,96 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client.model;
/**
* DTO fo DCR request.
*/
public class ClientProfile {
private String clientName;
private String callbackUrl;
private String tokenScope;
private String owner;
private String grantType;
private boolean saasApp;
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public String getCallbackUrl() {
return callbackUrl;
}
public void setCallbackUrl(String callbackUrl) {
this.callbackUrl = callbackUrl;
}
public String getTokenScope() {
return tokenScope;
}
public void setTokenScope(String tokenScope) {
this.tokenScope = tokenScope;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getGrantType() {
return grantType;
}
public void setGrantType(String grantTypem) {
this.grantType = grantTypem;
}
public boolean isSaasApp() {
return saasApp;
}
public void setSaasApp(boolean saasApp) {
this.saasApp = saasApp;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{\n");
sb.append(" clientName: ").append(clientName).append("\n");
sb.append(" callbackUrl: ").append("callbackUrl").append("\n");
sb.append(" grantType: ").append(grantType).append("\n");
sb.append(" tokenScope: ").append(tokenScope).append("\n");
sb.append(" owner: ").append(owner).append("\n");
sb.append(" saasApp: ").append(saasApp).append("\n");
sb.append("}\n");
return sb.toString();
}
}

@ -0,0 +1,36 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client.model;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
/**
* DCR Rest resource.
*/
@Path("/")
public interface DCRClient {
// DCR APIs
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
OAuthApplication register(ClientProfile registrationProfile);
}

@ -0,0 +1,103 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client.model;
public class OAuthApplication {
private String jsonString;
private String appOwner;
private String clientName;
private String callBackURL;
private String isSaasApplication;
private String clientId;
private String clientSecret;
public String getJsonString() {
return jsonString;
}
public void setJsonString(String jsonString) {
this.jsonString = jsonString;
}
public String getAppOwner() {
return appOwner;
}
public void setAppOwner(String appOwner) {
this.appOwner = appOwner;
}
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public String getCallBackURL() {
return callBackURL;
}
public void setCallBackURL(String callBackURL) {
this.callBackURL = callBackURL;
}
public String getIsSaasApplication() {
return isSaasApplication;
}
public void setIsSaasApplication(String isSaasApplication) {
this.isSaasApplication = isSaasApplication;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getClientSecret() {
return clientSecret;
}
public void setClientSecret(String clientSecret) {
this.clientSecret = clientSecret;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OAuthApplication {\n");
sb.append(" jsonString: ").append(jsonString).append("\n");
sb.append(" appOwner: ").append(appOwner).append("\n");
sb.append(" clientName: ").append(clientName).append("\n");
sb.append(" callBackURL: ").append(callBackURL).append("\n");
sb.append(" isSaasApplication: ").append(isSaasApplication).append("\n");
sb.append(" clientId: ").append(isSaasApplication).append("\n");
sb.append(" clientSecret: ").append(clientSecret).append("\n");
sb.append("}\n");
return sb.toString();
}
}

@ -0,0 +1,41 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client.service;
import org.wso2.carbon.apimgt.integration.client.PublisherClient;
import org.wso2.carbon.apimgt.integration.client.StoreClient;
/**
* This is a service that can be called upon to access store and publisher.
*/
public interface IntegrationClientService {
/**
*
* @return API Store Client.
*/
StoreClient getStoreClient();
/**
*
* @return API Publisher Client.
*/
PublisherClient getPublisherClient();
}

@ -0,0 +1,41 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.integration.client.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PropertyUtils {
//This method is only used if the mb features are within DAS.
public static String replaceProperties(String text) {
String regex = "\\$\\{(.*?)\\}";
Pattern pattern = Pattern.compile(regex);
Matcher matchPattern = pattern.matcher(text);
while (matchPattern.find()) {
String sysPropertyName = matchPattern.group(1);
String sysPropertyValue = System.getProperty(sysPropertyName);
if (sysPropertyValue != null && !sysPropertyName.isEmpty()) {
text = text.replaceAll("\\$\\{(" + sysPropertyName + ")\\}", sysPropertyValue);
}
}
return text;
}
}

@ -0,0 +1,173 @@
<!-- ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ ~ WSO2 Inc. licenses this file to you under the Apache License, ~ Version
2.0 (the "License"); you may not use this file except ~ in compliance with
the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0
~ ~ Unless required by applicable law or agreed to in writing, ~ software
distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
License for the ~ specific language governing permissions and limitations
~ under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.publisher.client</artifactId>
<packaging>bundle</packaging>
<name>org.wso2.carbon.apimgt.publisher.client</name>
<build>
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/publisher-api.yaml</inputSpec>
<language>java</language>
<configOptions>
<apiPackage>${project.artifactId}.api</apiPackage>
<modelPackage>${project.artifactId}.model</modelPackage>
<invokerPackage>${project.artifactId}.invoker</invokerPackage>
</configOptions>
<library>feign</library>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>process-resources</phase>
<configuration>
<tasks>
<delete file="${project.build.directory}/generated-sources/swagger/build.gradle"/>
<delete file="${project.build.directory}/generated-sources/swagger/build.sbt"/>
<delete file="${project.build.directory}/generated-sources/swagger/git_push.sh"/>
<delete file="${project.build.directory}/generated-sources/swagger/gradlew.bat"/>
<delete file="${project.build.directory}/generated-sources/swagger/gradlew"/>
<delete file="${project.build.directory}/generated-sources/swagger/gradle.properties"/>
<delete file="${project.build.directory}/generated-sources/swagger/settings.gradle"/>
<delete dir="${project.build.directory}/generated-sources/swagger/gradle"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Description>APIM publisher client</Bundle-Description>
<Export-Package>
org.wso2.carbon.apimgt.publisher.client.model,
org.wso2.carbon.apimgt.publisher.client.api,
org.wso2.carbon.apimgt.publisher.client.invoker
</Export-Package>
<Import-Package>
org.osgi.framework,
org.osgi.service.component,
org.wso2.carbon.logging,
io.swagger,
junit,
javax.ws.rs,
feign,
feign.jackson,
feign.codec,
feign.auth,
feign.gson,
feign.slf4j,
com.google.gson,
com.fasterxml.jackson.core,
com.fasterxml.jackson.annotation,
com.fasterxml.jackson.databind,
com.fasterxml.jackson.datatype.joda, i
o.swagger.annotations,
javax.net.ssl,
org.apache.oltu.oauth2.client.*,
org.apache.oltu.oauth2.common.*,
org.junit;resolution:=optional
</Import-Package>
<Embed-Dependency>
</Embed-Dependency>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- dependencies are needed for the client being generated -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-gson</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-slf4j</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,176 @@
<!-- ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ ~ WSO2 Inc. licenses this file to you under the Apache License, ~ Version
2.0 (the "License"); you may not use this file except ~ in compliance with
the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0
~ ~ Unless required by applicable law or agreed to in writing, ~ software
distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
License for the ~ specific language governing permissions and limitations
~ under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>2.0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.store.client</artifactId>
<packaging>bundle</packaging>
<name>org.wso2.carbon.apimgt.store.client</name>
<build>
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/store-api.yaml</inputSpec>
<language>java</language>
<configOptions>
<apiPackage>${project.artifactId}.api</apiPackage>
<modelPackage>${project.artifactId}.model</modelPackage>
<invokerPackage>${project.artifactId}.invoker</invokerPackage>
</configOptions>
<library>feign</library>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>copy</id>
<phase>process-resources</phase>
<configuration>
<tasks>
<delete file="${project.build.directory}/generated-sources/swagger/build.gradle"/>
<delete file="${project.build.directory}/generated-sources/swagger/build.sbt"/>
<delete file="${project.build.directory}/generated-sources/swagger/git_push.sh"/>
<delete file="${project.build.directory}/generated-sources/swagger/gradlew.bat"/>
<delete file="${project.build.directory}/generated-sources/swagger/gradlew"/>
<delete file="${project.build.directory}/generated-sources/swagger/gradle.properties"/>
<delete file="${project.build.directory}/generated-sources/swagger/settings.gradle"/>
<delete dir="${project.build.directory}/generated-sources/swagger/gradle"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Description>APIM Integration</Bundle-Description>
<Export-Package>
org.wso2.carbon.apimgt.store.client.model,
org.wso2.carbon.apimgt.store.client.api,
org.wso2.carbon.apimgt.store.client.invoker
</Export-Package>
<Import-Package>
org.osgi.framework,
org.osgi.service.component,
org.wso2.carbon.logging,
io.swagger,
junit,
javax.ws.rs,
feign,
feign.jackson,
feign.codec,
feign.auth,
feign.gson,
feign.slf4j,
feign.jaxrs,
com.google.gson,
com.fasterxml.jackson.core,
com.fasterxml.jackson.annotation,
com.fasterxml.jackson.databind,
com.fasterxml.jackson.datatype.joda, i
o.swagger.annotations,
javax.net.ssl,
org.apache.oltu.oauth2.client.*,
org.apache.oltu.oauth2.common.*,
org.junit;resolution:=optional
</Import-Package>
<Embed-Dependency>
</Embed-Dependency>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- dependencies are needed for the client being generated -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-gson</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-slf4j</artifactId>
</dependency>
</dependencies>
</project>

@ -41,19 +41,4 @@ public interface APIPublisherService {
*/
void publishAPI(API api) throws APIManagementException, FaultGatewaysException;
/**
* This method removes an API that's already published within the underlying API-Management infrastructure.
*
* @param id An instance of the bean that carries API identification related metadata
* @throws APIManagementException Is thrown if some unexpected event occurs while removing the API
*/
void removeAPI(APIIdentifier id) throws APIManagementException;
/**
* This method registers a collection of APIs within the underlying API-Management infrastructure.
*
* @param apis A list of the beans that passes metadata related to the APIs being published
* @throws APIManagementException Is thrown if some unexpected event occurs while publishing the APIs
*/
void publishAPIs(List<API> apis) throws APIManagementException, FaultGatewaysException;
}

@ -34,6 +34,9 @@
<url>http://wso2.org</url>
<modules>
<module>org.wso2.carbon.apimgt.publisher.client</module>
<module>org.wso2.carbon.apimgt.store.client</module>
<module>org.wso2.carbon.apimgt.integration.client</module>
<module>org.wso2.carbon.apimgt.webapp.publisher</module>
<module>org.wso2.carbon.apimgt.application.extension</module>
<module>org.wso2.carbon.apimgt.application.extension.api</module>

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>2.0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client.feature</artifactId>
<packaging>pom</packaging>
<name>WSO2 Carbon - APIM Integration Client Feature</name>
<url>http://wso2.org</url>
<description>This feature contains a http client implementation to communicate with WSO2-APIM server</description>
<dependencies>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/resources</outputDirectory>
<resources>
<resource>
<directory>resources</directory>
<includes>
<include>build.properties</include>
<include>p2.inf</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
<executions>
<execution>
<id>p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.carbon.apimgt.client</id>
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
<adviceFile>
<properties>
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
</properties>
</adviceFile>
<bundles>
<bundleDef>
javax.ws.rs:jsr311-api:${jsr311.version}
</bundleDef>
<bundleDef>
io.swagger:swagger-annotations:${swagger.annotations.version}
</bundleDef>
<bundleDef>
io.github.openfeign:feign-slf4j:${io.github.openfeign.version}
</bundleDef>
<bundleDef>
io.github.openfeign:feign-jaxrs:${io.github.openfeign.version}
</bundleDef>
<bundleDef>
io.github.openfeign:feign-jackson:${io.github.openfeign.version}
</bundleDef>
<bundleDef>
io.github.openfeign:feign-core:${io.github.openfeign.version}
</bundleDef>
<bundleDef>
io.github.openfeign:feign-gson:${io.github.openfeign.version}
</bundleDef>
<bundleDef>
org.wso2.carbon:org.wso2.carbon.apimgt.integration.client:${project.version}
</bundleDef>
<bundleDef>
org.wso2.carbon:org.wso2.carbon.apimgt.publisher.client:${project.version}
</bundleDef>
<bundleDef>
org.wso2.carbon:org.wso2.carbon.apimgt.store.client:${project.version}
</bundleDef>
<bundleDef>
org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:${oltu.client.version}
</bundleDef>
<bundleDef>
com.fasterxml.jackson.datatype:jackson-datatype-joda:${jackson.datatype.joda.version}
</bundleDef>
</bundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
</importFeatureDef>
</importFeatures>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<carbon.p2.plugin.version>1.5.4</carbon.p2.plugin.version>
<carbon.kernel.version>4.4.10</carbon.kernel.version>
<io.github.openfeign.version>9.3.1</io.github.openfeign.version>
</properties>
</project>

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?><!--
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<APIMConfiguration>
<DCREndpoint>http://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.10/register</DCREndpoint>
<TokenEndpoint>https://${iot.gateway.host}:${iot.gateway.https.port}/token</TokenEndpoint>
<PublisherEndpoint>https://localhost:9443/api/am/publisher/v0.10</PublisherEndpoint>
<StoreEndpoint>https://localhost:9443/api/am/store/v0.10</StoreEndpoint>
<UserName>admin</UserName>
<Password>admin</Password>
</APIMConfiguration>

@ -0,0 +1,2 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.apimgt.apim.integration_${feature.version}/conf/apim-integration.xml,target:${installFolder}/../../conf/apim-integration.xml,overwrite:true);\

@ -35,6 +35,7 @@
<url>http://wso2.org</url>
<modules>
<module>org.wso2.carbon.apimgt.integration.client.feature</module>
<module>org.wso2.carbon.apimgt.webapp.publisher.feature</module>
<module>org.wso2.carbon.apimgt.application.extension.feature</module>
<module>org.wso2.carbon.apimgt.handler.server.feature</module>

@ -37,11 +37,11 @@
<modules>
<module>components/device-mgt</module>
<module>components/device-mgt-extensions</module>
<module>components/identity-extensions</module>
<module>components/apimgt-extensions</module>
<module>components/policy-mgt</module>
<module>components/certificate-mgt</module>
<module>components/webapp-authenticator-framework</module>
<module>components/identity-extensions</module>
<module>components/email-sender</module>
<module>features/device-mgt</module>
<module>features/apimgt-extensions</module>
@ -208,6 +208,21 @@
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>${carbon.device.mgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.publisher.client</artifactId>
<version>${carbon.device.mgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.store.client</artifactId>
<version>${carbon.device.mgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
<version>${carbon.device.mgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
@ -1364,6 +1379,7 @@
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.commons</groupId>
<artifactId>org.wso2.carbon.ntask.core</artifactId>
@ -1628,6 +1644,17 @@
<artifactId>jackson-annotations</artifactId>
<version>${jackson-annotations.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.orbit.com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.orbit.joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.orbit.org.owasp.encoder</groupId>
<artifactId>encoder</artifactId>
@ -1669,6 +1696,41 @@
<artifactId>org.wso2.store.sso.common</artifactId>
<version>${carbon.store.sso.common.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<version>${io.github.openfeign.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jaxrs</artifactId>
<version>${io.github.openfeign.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-gson</artifactId>
<version>${io.github.openfeign.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jackson</artifactId>
<version>${io.github.openfeign.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-slf4j</artifactId>
<version>${io.github.openfeign.version}</version>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>${oltu.client.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>${jackson.datatype.joda.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -2047,6 +2109,8 @@
<!--JWT grant type extension feature-->
<identity.jwt.extension.version>1.0.2</identity.jwt.extension.version>
<jackson-annotations.version>2.6.1.wso2v1</jackson-annotations.version>
<jackson-databind.version>2.6.1.wso2v3</jackson-databind.version>
<joda-time.version>2.8.2.wso2v1</joda-time.version>
<owasp.encoder.version>1.2.0.wso2v1</owasp.encoder.version>
<hibernate-validator.version>5.0.2.Final</hibernate-validator.version>
@ -2067,6 +2131,12 @@
<!--carbon store version-->
<carbon.store.sso.common.version>1.4.4</carbon.store.sso.common.version>
<!--Feign Version-->
<io.github.openfeign.version>9.3.1</io.github.openfeign.version>
<!--Oltu client Version-->
<oltu.client.version>1.0.1</oltu.client.version>
<jackson.datatype.joda.version>2.1.5</jackson.datatype.joda.version>
</properties>
</project>

Loading…
Cancel
Save