Upgrading dependency versions to their respective latests

4.x.x
prabathabey 9 years ago
parent 9ce1c2002a
commit bce52e54a3

@ -22,6 +22,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIProvider; import org.wso2.carbon.apimgt.api.APIProvider;
import org.wso2.carbon.apimgt.api.FaultGatewaysException;
import org.wso2.carbon.apimgt.api.model.API; import org.wso2.carbon.apimgt.api.model.API;
import org.wso2.carbon.apimgt.api.model.APIIdentifier; import org.wso2.carbon.apimgt.api.model.APIIdentifier;
import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.APIManagerFactory;
@ -48,10 +49,15 @@ public class APIPublisherServiceImpl implements APIPublisherService {
log.info("Successfully published API '" + api.getId().getApiName() + "' with context '" + log.info("Successfully published API '" + api.getId().getApiName() + "' with context '" +
api.getContext() + "' and version '" + api.getId().getVersion() + "'"); api.getContext() + "' and version '" + api.getId().getVersion() + "'");
} else { } else {
provider.updateAPI(api); try {
log.info("An API already exists with the name '" + api.getId().getApiName() + "', context '" + provider.updateAPI(api);
api.getContext() + "' and version '" + api.getId().getVersion() + log.info("An API already exists with the name '" + api.getId().getApiName() + "', context '" +
"'. Thus, the API config is updated"); api.getContext() + "' and version '" + api.getId().getVersion() +
"'. Thus, the API config is updated");
} catch (FaultGatewaysException e) {
throw new APIManagementException("Error occurred while updating API " + api.getId().getApiName() +
"' with context '" + api.getContext() + "' and version '" + api.getId().getVersion() + "'");
}
} }
} else { } else {
throw new APIManagementException("API provider configured for the given API configuration is null. " + throw new APIManagementException("API provider configured for the given API configuration is null. " +

@ -67,30 +67,31 @@
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId> <artifactId>cxf-rt-frontend-jaxws</artifactId>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId> <artifactId>cxf-rt-frontend-jaxrs</artifactId>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId> <artifactId>cxf-rt-transports-http</artifactId>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId> <artifactId>cxf-rt-bindings-soap</artifactId>
<version>2.6.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-http</artifactId> <artifactId>cxf-rt-bindings-http</artifactId>
<version>2.5.11</version> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-extension-providers</artifactId> <artifactId>cxf-rt-rs-extension-providers</artifactId>
<version>2.6.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -102,10 +103,12 @@
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
<scope>provided</scope>
</dependency> </dependency>
<!-- Device management core dependencies --> <!-- Device management core dependencies -->
@ -143,6 +146,11 @@
<groupId>org.codehaus.jackson</groupId> <groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId> <artifactId>jackson-jaxrs</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -47,7 +47,7 @@
<Bundle-Name>${project.artifactId}</Bundle-Name> <Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version> <Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>Dynamic Client Registration Bundle</Bundle-Description> <Bundle-Description>Dynamic Client Registration Bundle</Bundle-Description>
<Bundle-Activator>org.wso2.carbon.dynamic.client.registration.internal.DynamicClientRegistrationBundleActivator</Bundle-Activator> <Bundle-Activator>org.wso2.carbon.dynamic.client.registration.internal.DynamicClientRegistrationServiceComponent</Bundle-Activator>
<Private-Package>org.wso2.carbon.dynamic.client.registration.internal</Private-Package> <Private-Package>org.wso2.carbon.dynamic.client.registration.internal</Private-Package>
<Export-Package> <Export-Package>
!org.wso2.carbon.dynamic.client.registration.internal, !org.wso2.carbon.dynamic.client.registration.internal,

@ -25,37 +25,39 @@ import org.wso2.carbon.dynamic.client.registration.profile.RegistrationProfile;
*/ */
public interface DynamicClientRegistrationService { public interface DynamicClientRegistrationService {
/** /**
* This method will register a new OAuth application using the data provided by * This method will register a new OAuth application using the data provided by
* RegistrationProfile. * RegistrationProfile.
* *
* @param profile - RegistrationProfile of the OAuth application to be created. * @param profile - RegistrationProfile of the OAuth application to be created.
* @return OAuthApplicationInfo object which holds the necessary data of created OAuth app. * @return OAuthApplicationInfo object which holds the necessary data of created OAuth app.
* @throws DynamicClientRegistrationException * @throws DynamicClientRegistrationException
*/ *
public OAuthApplicationInfo registerOAuthApplication(RegistrationProfile profile) throws */
DynamicClientRegistrationException; public OAuthApplicationInfo registerOAuthApplication(
RegistrationProfile profile) throws DynamicClientRegistrationException;
/** /**
* This method will unregister a created OAuth application. * This method will unregister a created OAuth application.
* *
* @param userName - Username of the owner * @param userName - Username of the owner
* @param applicationName - OAuth application name * @param applicationName - OAuth application name
* @param consumerKey - ConsumerKey of the OAuth application * @param consumerKey - ConsumerKey of the OAuth application
* @return The status of the operation * @return The status of the operation
* @throws DynamicClientRegistrationException * @throws DynamicClientRegistrationException
*/ *
public boolean unregisterOAuthApplication(String userName, String applicationName, */
String consumerKey) throws DynamicClientRegistrationException; public boolean unregisterOAuthApplication(String userName, String applicationName,
String consumerKey) throws DynamicClientRegistrationException;
/** /**
* This method will check the existence of an OAuth application provided application-name. * This method will check the existence of an OAuth application provided application-name.
* *
* @param applicationName - OAuth application name * @param applicationName - OAuth application name
* @return The status of the operation * @return The status of the operation
* @throws DynamicClientRegistrationException * @throws DynamicClientRegistrationException
*/ *
public boolean isOAuthApplicationExists(String applicationName) */
throws DynamicClientRegistrationException; public boolean isOAuthApplicationExists(String applicationName) throws DynamicClientRegistrationException;
} }

@ -0,0 +1,67 @@
/*
* Copyright (c) 2015, 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.dynamic.client.registration;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.dynamic.client.registration.internal.DataHolder;
import org.wso2.carbon.user.api.TenantManager;
import org.wso2.carbon.user.api.UserStoreException;
public class DynamicClientRegistrationUtil {
public static String getTenantDomain() throws DynamicClientRegistrationException {
CarbonContext ctx = CarbonContext.getThreadLocalCarbonContext();
String tenantDomain = ctx.getTenantDomain();
if (tenantDomain != null && !tenantDomain.isEmpty()) {
return tenantDomain;
}
int tenantId = ctx.getTenantId();
if (tenantId == MultitenantConstants.INVALID_TENANT_ID) {
throw new IllegalStateException("Invalid tenant Id found. This might likely have caused by improper " +
"handling of multi-tenancy");
}
TenantManager tenantManager = DataHolder.getInstance().getTenantManager();
try {
return tenantManager.getDomain(tenantId);
} catch (UserStoreException e) {
throw new DynamicClientRegistrationException("Error occurred while retrieving tenant domain from " +
"the tenant id derived out of the underlying carbon context", e);
}
}
public static void validateUsername(String username) {
if (username == null || username.isEmpty()) {
throw new IllegalArgumentException("Username cannot be null or empty");
}
}
public static void validateApplicationName(String applicationName) {
if (applicationName == null || applicationName.isEmpty()) {
throw new IllegalArgumentException("Application name cannot be null or empty");
}
}
public static void validateConsumerKey(String consumerKey) {
if (consumerKey == null || consumerKey.isEmpty()) {
throw new IllegalArgumentException("Consumer Key cannot be null or empty");
}
}
}

@ -15,7 +15,6 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.wso2.carbon.dynamic.client.registration.impl; package org.wso2.carbon.dynamic.client.registration.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -24,10 +23,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.dynamic.client.registration.ApplicationConstants; import org.wso2.carbon.dynamic.client.registration.*;
import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationException;
import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService;
import org.wso2.carbon.dynamic.client.registration.OAuthApplicationInfo;
import org.wso2.carbon.dynamic.client.registration.profile.RegistrationProfile; import org.wso2.carbon.dynamic.client.registration.profile.RegistrationProfile;
import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException; import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException;
import org.wso2.carbon.identity.application.common.model.InboundAuthenticationConfig; import org.wso2.carbon.identity.application.common.model.InboundAuthenticationConfig;
@ -36,6 +32,7 @@ import org.wso2.carbon.identity.application.common.model.Property;
import org.wso2.carbon.identity.application.common.model.ServiceProvider; import org.wso2.carbon.identity.application.common.model.ServiceProvider;
import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
import org.wso2.carbon.identity.base.IdentityException; import org.wso2.carbon.identity.base.IdentityException;
import org.wso2.carbon.identity.oauth.IdentityOAuthAdminException;
import org.wso2.carbon.identity.oauth.OAuthAdminService; import org.wso2.carbon.identity.oauth.OAuthAdminService;
import org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO; import org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
@ -89,16 +86,16 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
if (jsonObject.has(ApplicationConstants.ClientMetadata.OAUTH_REDIRECT_URIS)) { if (jsonObject.has(ApplicationConstants.ClientMetadata.OAUTH_REDIRECT_URIS)) {
oAuthApplicationInfo oAuthApplicationInfo
.addParameter(ApplicationConstants.ClientMetadata.OAUTH_REDIRECT_URIS, .addParameter(ApplicationConstants.ClientMetadata.OAUTH_REDIRECT_URIS,
jsonObject jsonObject
.get(ApplicationConstants.ClientMetadata. .get(ApplicationConstants.ClientMetadata.
OAUTH_REDIRECT_URIS)); OAUTH_REDIRECT_URIS));
} }
if (jsonObject.has(ApplicationConstants.ClientMetadata.OAUTH_CLIENT_GRANT)) { if (jsonObject.has(ApplicationConstants.ClientMetadata.OAUTH_CLIENT_GRANT)) {
oAuthApplicationInfo.addParameter(ApplicationConstants.ClientMetadata. oAuthApplicationInfo.addParameter(ApplicationConstants.ClientMetadata.
OAUTH_CLIENT_GRANT, jsonObject OAUTH_CLIENT_GRANT, jsonObject
.get(ApplicationConstants.ClientMetadata. .get(ApplicationConstants.ClientMetadata.
OAUTH_CLIENT_GRANT)); OAUTH_CLIENT_GRANT));
} }
} catch (JSONException e) { } catch (JSONException e) {
throw new DynamicClientRegistrationException( throw new DynamicClientRegistrationException(
@ -148,11 +145,11 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
if (appMgtService == null) { if (appMgtService == null) {
throw new IllegalStateException( throw new IllegalStateException(
"Error occurred while retrieving Application Management" + "Error occurred while retrieving Application Management" +
"Service"); "Service");
} }
appMgtService.createApplication(serviceProvider); appMgtService.createApplication(serviceProvider, tenantDomain, userName);
ServiceProvider createdServiceProvider = appMgtService.getApplication(applicationName); ServiceProvider createdServiceProvider = appMgtService.getServiceProvider(applicationName, tenantDomain);
if (createdServiceProvider == null) { if (createdServiceProvider == null) {
throw new DynamicClientRegistrationException( throw new DynamicClientRegistrationException(
"Couldn't create Service Provider Application " + applicationName); "Couldn't create Service Provider Application " + applicationName);
@ -162,22 +159,21 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
// Then Create OAuthApp // Then Create OAuthApp
OAuthAdminService oAuthAdminService = new OAuthAdminService(); OAuthAdminService oAuthAdminService = new OAuthAdminService();
OAuthConsumerAppDTO oAuthConsumerAppDTO = new OAuthConsumerAppDTO(); OAuthConsumerAppDTO oAuthConsumerApp = new OAuthConsumerAppDTO();
oAuthConsumerAppDTO.setApplicationName(applicationName); oAuthConsumerApp.setApplicationName(applicationName);
oAuthConsumerAppDTO.setCallbackUrl(callbackUrl); oAuthConsumerApp.setCallbackUrl(callbackUrl);
oAuthConsumerAppDTO.setGrantTypes(grantType); oAuthConsumerApp.setGrantTypes(grantType);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Creating OAuth App " + applicationName); log.debug("Creating OAuth App " + applicationName);
} }
oAuthAdminService.registerOAuthApplicationData(oAuthConsumerAppDTO); oAuthAdminService.registerOAuthApplicationData(oAuthConsumerApp);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Created OAuth App " + applicationName); log.debug("Created OAuth App " + applicationName);
} }
OAuthConsumerAppDTO createdApp = OAuthConsumerAppDTO createdApp =
oAuthAdminService.getOAuthApplicationDataByAppName(oAuthConsumerAppDTO oAuthAdminService.getOAuthApplicationDataByAppName(oAuthConsumerApp.getApplicationName());
.getApplicationName());
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Retrieved Details for OAuth App " + createdApp.getApplicationName()); log.debug("Retrieved Details for OAuth App " + createdApp.getApplicationName());
} }
@ -192,12 +188,12 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
inboundAuthenticationRequestConfig.setInboundAuthKey(createdApp.getOauthConsumerKey()); inboundAuthenticationRequestConfig.setInboundAuthKey(createdApp.getOauthConsumerKey());
inboundAuthenticationRequestConfig.setInboundAuthType("oauth2"); inboundAuthenticationRequestConfig.setInboundAuthType("oauth2");
if (createdApp.getOauthConsumerSecret() != null && !createdApp. if (createdApp.getOauthConsumerSecret() != null && !createdApp.
getOauthConsumerSecret() getOauthConsumerSecret()
.isEmpty()) { .isEmpty()) {
Property property = new Property(); Property property = new Property();
property.setName("oauthConsumerSecret"); property.setName("oauthConsumerSecret");
property.setValue(createdApp.getOauthConsumerSecret()); property.setValue(createdApp.getOauthConsumerSecret());
Property[] properties = { property }; Property[] properties = {property};
inboundAuthenticationRequestConfig.setProperties(properties); inboundAuthenticationRequestConfig.setProperties(properties);
} }
@ -207,7 +203,7 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
createdServiceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig); createdServiceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
// Update the Service Provider app to add OAuthApp as an Inbound Authentication Config // Update the Service Provider app to add OAuthApp as an Inbound Authentication Config
appMgtService.updateApplication(createdServiceProvider); appMgtService.updateApplication(createdServiceProvider, tenantDomain, userName);
OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo(); OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo();
oAuthApplicationInfo.setClientId(createdApp.getOauthConsumerKey()); oAuthApplicationInfo.setClientId(createdApp.getOauthConsumerKey());
@ -236,8 +232,11 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
@Override @Override
public boolean unregisterOAuthApplication(String userId, String applicationName, public boolean unregisterOAuthApplication(String userId, String applicationName,
String consumerKey) String consumerKey) throws DynamicClientRegistrationException {
throws DynamicClientRegistrationException { DynamicClientRegistrationUtil.validateUsername(userId);
DynamicClientRegistrationUtil.validateApplicationName(applicationName);
DynamicClientRegistrationUtil.validateConsumerKey(consumerKey);
boolean status = false; boolean status = false;
String tenantDomain = MultitenantUtils.getTenantDomain(userId); String tenantDomain = MultitenantUtils.getTenantDomain(userId);
String baseUser = CarbonContext.getThreadLocalCarbonContext().getUsername(); String baseUser = CarbonContext.getThreadLocalCarbonContext().getUsername();
@ -247,44 +246,37 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(userName); PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(userName);
if (userId == null || userId.isEmpty()) { OAuthAdminService oAuthAdminService;
OAuthConsumerAppDTO oAuthConsumerApp;
try {
oAuthAdminService = new OAuthAdminService();
oAuthConsumerApp = oAuthAdminService.getOAuthApplicationData(consumerKey);
} catch (IdentityOAuthAdminException e) {
throw new DynamicClientRegistrationException("Error occurred while retrieving application data", e);
}
if (oAuthConsumerApp == null) {
throw new DynamicClientRegistrationException( throw new DynamicClientRegistrationException(
"Error occurred while unregistering Application: userId cannot " + "No OAuth Consumer Application is associated with the given consumer key: " + consumerKey);
"be null/empty");
} }
try {
OAuthAdminService oAuthAdminService = new OAuthAdminService();
OAuthConsumerAppDTO oAuthConsumerAppDTO =
oAuthAdminService.getOAuthApplicationData(consumerKey);
if (oAuthConsumerAppDTO == null) { try {
throw new DynamicClientRegistrationException(
"Couldn't retrieve OAuth Consumer Application associated with the " +
"given consumer key: " + consumerKey);
}
oAuthAdminService.removeOAuthApplicationData(consumerKey); oAuthAdminService.removeOAuthApplicationData(consumerKey);
ApplicationManagementService appMgtService = ApplicationManagementService.getInstance(); ApplicationManagementService appMgtService = ApplicationManagementService.getInstance();
ServiceProvider createdServiceProvider = appMgtService.getServiceProvider(applicationName, tenantDomain);
if (appMgtService == null) {
throw new IllegalStateException(
"Error occurred while retrieving Application Management" +
"Service");
}
ServiceProvider createdServiceProvider = appMgtService.getApplication(applicationName);
if (createdServiceProvider == null) { if (createdServiceProvider == null) {
throw new DynamicClientRegistrationException( throw new DynamicClientRegistrationException(
"Couldn't retrieve Service Provider Application " + applicationName); "Couldn't retrieve Service Provider Application " + applicationName);
} }
appMgtService.deleteApplication(applicationName); appMgtService.deleteApplication(applicationName, tenantDomain, userName);
status = true; status = true;
} catch (IdentityApplicationManagementException e) { } catch (IdentityApplicationManagementException e) {
throw new DynamicClientRegistrationException( throw new DynamicClientRegistrationException(
"Error occurred while removing ServiceProvider for app " + applicationName, e); "Error occurred while removing ServiceProvider for application '" + applicationName + "'", e);
} catch (Exception e) { } catch (IdentityOAuthAdminException e) {
throw new DynamicClientRegistrationException( throw new DynamicClientRegistrationException("Error occurred while removing application '" +
"Error occurred while removing OAuthApp " + applicationName, e); applicationName + "'", e);
} finally { } finally {
PrivilegedCarbonContext.endTenantFlow(); PrivilegedCarbonContext.endTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(baseUser); PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(baseUser);
@ -293,23 +285,17 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
} }
@Override @Override
public boolean isOAuthApplicationExists(String applicationName) public boolean isOAuthApplicationExists(String applicationName) throws DynamicClientRegistrationException {
throws DynamicClientRegistrationException {
ApplicationManagementService appMgtService = ApplicationManagementService.getInstance();
if (appMgtService == null) {
throw new IllegalStateException(
"Error occurred while retrieving Application Management" +
"Service");
}
try { try {
if (appMgtService.getApplication(applicationName) != null) { if (ApplicationManagementService.getInstance().getServiceProvider(applicationName,
CarbonContext.getThreadLocalCarbonContext().getTenantDomain()) != null) {
return true; return true;
} }
} catch (IdentityApplicationManagementException e) { } catch (IdentityApplicationManagementException e) {
throw new DynamicClientRegistrationException( throw new DynamicClientRegistrationException(
"Error occurred while retrieving information of OAuthApp " + applicationName, "Error occurred while retrieving information of OAuthApp " + applicationName, e);
e);
} }
return false; return false;
} }
} }

@ -0,0 +1,48 @@
/*
* Copyright (c) 2015, 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.dynamic.client.registration.internal;
import org.wso2.carbon.user.api.TenantManager;
import org.wso2.carbon.user.core.service.RealmService;
public class DataHolder {
private RealmService realmService;
private static DataHolder thisInstance = new DataHolder();
private DataHolder() {}
public static DataHolder getInstance() {
return thisInstance;
}
public void setRealmService(RealmService realmService) {
this.realmService = realmService;
}
public RealmService getRealmService() {
return realmService;
}
public TenantManager getTenantManager() {
return realmService.getTenantManager();
}
}

@ -20,25 +20,30 @@ package org.wso2.carbon.dynamic.client.registration.internal;
import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService; import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService;
import org.wso2.carbon.dynamic.client.registration.impl.DynamicClientRegistrationImpl; import org.wso2.carbon.dynamic.client.registration.impl.DynamicClientRegistrationImpl;
/** /**
* BundleActivator class of DynamicClientRegistration component. * @scr.component name="org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationServiceComponent"
* immediate="true"
* @scr.reference name="user.realmservice.default"
* interface="org.wso2.carbon.user.core.service.RealmService"
* cardinality="1..1"
* policy="dynamic"
* bind="setRealmService"
* unbind="unsetRealmService"
*/ */
public class DynamicClientRegistrationBundleActivator implements BundleActivator{ public class DynamicClientRegistrationServiceComponent {
@Override protected void activate(ComponentContext componentContext) {
public void start(BundleContext bundleContext) throws Exception { BundleContext bundleContext = componentContext.getBundleContext();
DynamicClientRegistrationService dynamicClientRegistrationService = bundleContext.registerService(DynamicClientRegistrationService.class.getName(),
new DynamicClientRegistrationImpl(); new DynamicClientRegistrationImpl(), null);
bundleContext.registerService(DynamicClientRegistrationService.class.getName(), }
dynamicClientRegistrationService, null);
}
@Override protected void deactivate(ComponentContext componentContext) {
public void stop(BundleContext bundleContext) throws Exception { //do nothing
}
}
} }

@ -37,7 +37,6 @@ import org.wso2.carbon.webapp.authenticator.framework.config.WebappAuthenticator
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* @scr.component name="org.wso2.carbon.webapp.authenticator" immediate="true" * @scr.component name="org.wso2.carbon.webapp.authenticator" immediate="true"
* @scr.reference name="user.realmservice.default" * @scr.reference name="user.realmservice.default"

@ -37,14 +37,14 @@
<modules> <modules>
<module>components/device-mgt</module> <module>components/device-mgt</module>
<module>components/apimgt-extensions</module> <module>components/apimgt-extensions</module>
<module>components/policy-mgt</module> <module>components/policy-mgt</module>
<module>components/certificate-mgt</module> <module>components/certificate-mgt</module>
<module>components/webapp-authenticator-framework</module> <module>components/webapp-authenticator-framework</module>
<module>components/dynamic-client-registration</module> <module>components/dynamic-client-registration</module>
<module>features/device-mgt</module> <module>features/device-mgt</module>
<module>features/apimgt-extensions</module> <module>features/apimgt-extensions</module>
<module>features/policy-mgt</module> <module>features/policy-mgt</module>
<module>features/webapp-authenticator-framework</module> <module>features/webapp-authenticator-framework</module>
<module>features/certificate-mgt</module> <module>features/certificate-mgt</module>
<module>features/dynamic-client-registration</module> <module>features/dynamic-client-registration</module>
@ -1001,6 +1001,11 @@
<artifactId>json</artifactId> <artifactId>json</artifactId>
<version>${json.wso2.version}</version> <version>${json.wso2.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${google.gson.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -1206,7 +1211,7 @@
<carbon.p2.plugin.version>1.5.4</carbon.p2.plugin.version> <carbon.p2.plugin.version>1.5.4</carbon.p2.plugin.version>
<!-- Jaggery --> <!-- Jaggery -->
<jaggery.version>0.10.0</jaggery.version> <jaggery.version>0.10.2</jaggery.version>
<jaggery.extensions.version>1.3.0</jaggery.extensions.version> <jaggery.extensions.version>1.3.0</jaggery.extensions.version>
<jaggery.extensions.sso.version>1.3.0</jaggery.extensions.sso.version> <jaggery.extensions.sso.version>1.3.0</jaggery.extensions.sso.version>
<jaggery.extensions.carbon.version>1.3.0</jaggery.extensions.carbon.version> <jaggery.extensions.carbon.version>1.3.0</jaggery.extensions.carbon.version>
@ -1230,19 +1235,19 @@
<tomcat.jdbc.pooling.version>7.0.34.wso2v2</tomcat.jdbc.pooling.version> <tomcat.jdbc.pooling.version>7.0.34.wso2v2</tomcat.jdbc.pooling.version>
<!-- Carbon Deployment --> <!-- Carbon Deployment -->
<carbon.deployment.version>4.4.0</carbon.deployment.version> <carbon.deployment.version>4.5.2</carbon.deployment.version>
<!-- Carbon Identity --> <!-- Carbon Identity -->
<carbon.identity.version>4.4.0</carbon.identity.version> <carbon.identity.version>4.6.0-M2</carbon.identity.version>
<!-- Carbon Multi-tenancy --> <!-- Carbon Multi-tenancy -->
<carbon.multitenancy.version>4.4.0</carbon.multitenancy.version> <carbon.multitenancy.version>4.4.1</carbon.multitenancy.version>
<!-- Carbon Registry --> <!-- Carbon Registry -->
<carbon.registry.version>4.4.1</carbon.registry.version> <carbon.registry.version>4.4.8</carbon.registry.version>
<!-- Carbon Governance --> <!-- Carbon Governance -->
<carbon.governance.version>4.4.1</carbon.governance.version> <carbon.governance.version>4.5.8</carbon.governance.version>
<!-- Axiom --> <!-- Axiom -->
<axiom.version>1.2.11-wso2v5</axiom.version> <axiom.version>1.2.11-wso2v5</axiom.version>
@ -1253,13 +1258,13 @@
<carbon.device.mgt.version>0.9.2-SNAPSHOT</carbon.device.mgt.version> <carbon.device.mgt.version>0.9.2-SNAPSHOT</carbon.device.mgt.version>
<!-- Carbon Commons --> <!-- Carbon Commons -->
<carbon.commons.version>4.4.0</carbon.commons.version> <carbon.commons.version>4.4.7</carbon.commons.version>
<version.commons.codec>1.4.0.wso2v1</version.commons.codec> <version.commons.codec>1.4.0.wso2v1</version.commons.codec>
<version.commons.io>2.4.0.wso2v1</version.commons.io> <version.commons.io>2.4.0.wso2v1</version.commons.io>
<version.commons.lang>2.6.0.wso2v1</version.commons.lang> <version.commons.lang>2.6.0.wso2v1</version.commons.lang>
<!-- Carbon API Management --> <!-- Carbon API Management -->
<carbon.api.mgt.version>1.4.0</carbon.api.mgt.version> <carbon.api.mgt.version>4.3.0-SNAPSHOT</carbon.api.mgt.version>
<!--CXF properties--> <!--CXF properties-->
<cxf.version>2.6.1</cxf.version> <cxf.version>2.6.1</cxf.version>
@ -1281,6 +1286,7 @@
<nimbus.orbit.version>2.26.1.wso2v3</nimbus.orbit.version> <nimbus.orbit.version>2.26.1.wso2v3</nimbus.orbit.version>
<json.wso2.version>2.0.0.wso2v1</json.wso2.version> <json.wso2.version>2.0.0.wso2v1</json.wso2.version>
<google.gson.version>2.3.1</google.gson.version>
</properties> </properties>
</project> </project>

Loading…
Cancel
Save