revert-70aa11f8
manoj 9 years ago
commit 3bbbed40e6

@ -145,7 +145,7 @@ public class DeviceDAOImpl implements DeviceDAO {
List<Device> devices = null;
try {
conn = this.getConnection();
String sql = "SELECT d1.DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " +
String sql = "SELECT d1.DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, d1.DEVICE_IDENTIFICATION, " +
"e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, e.DATE_OF_ENROLMENT FROM DM_ENROLMENT e, (SELECT d.ID AS DEVICE_ID, d.DESCRIPTION, d.NAME," +
"d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t " +
"WHERE d.DEVICE_TYPE_ID = t.ID AND d.TENANT_ID = ?) d1 WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?";
@ -175,7 +175,7 @@ public class DeviceDAOImpl implements DeviceDAO {
List<Device> devices = null;
try {
conn = this.getConnection();
String selectDBQueryForType = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " +
String selectDBQueryForType = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, d1.DEVICE_IDENTIFICATION," +
"e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, e.DATE_OF_ENROLMENT FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " +
"d.DEVICE_IDENTIFICATION, d.OWNER, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t " +
"WHERE d.DM_DEVICE.DEVICE_TYPE_ID = t.ID AND t.NAME = ? AND d.TENANT_ID = ?) d1 WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?";

@ -242,8 +242,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
this.getPluginRepository().getDeviceManagementService(
device.getType()).getDeviceManager().getDevice(
new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
if (dmsDevice != null) {
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
}
devices.add(device);
}
return devices;
@ -273,8 +275,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
this.getPluginRepository().getDeviceManagementService(
device.getType()).getDeviceManager().getDevice(
new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
if (dmsDevice != null) {
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
}
devices.add(device);
}
return devices;
@ -424,8 +428,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
DeviceManager dms =
this.getPluginRepository().getDeviceManagementService(deviceId.getType()).getDeviceManager();
Device pluginSpecificInfo = dms.getDevice(deviceId);
device.setProperties(pluginSpecificInfo.getProperties());
device.setFeatures(pluginSpecificInfo.getFeatures());
if (pluginSpecificInfo != null) {
device.setFeatures(pluginSpecificInfo.getFeatures());
device.setProperties(pluginSpecificInfo.getProperties());
}
}
return device;
}
@ -570,8 +576,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
this.getPluginRepository().getDeviceManagementService(
device.getType()).getDeviceManager().getDevice(
new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
if (dmsDevice != null) {
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
}
devices.add(device);
}
return devices;
@ -612,8 +620,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
this.getPluginRepository().getDeviceManagementService(
device.getType()).getDeviceManager().getDevice(
new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
if (dmsDevice != null) {
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
}
devices.add(device);
}
}
@ -660,8 +670,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
this.getPluginRepository().getDeviceManagementService(
device.getType()).getDeviceManager().getDevice(
new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
if (dmsDevice != null) {
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
}
devices.add(device);
}
return devices;

@ -35,9 +35,10 @@ import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
import org.wso2.carbon.identity.base.IdentityException;
import org.wso2.carbon.identity.oauth.OAuthAdminService;
import org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO;
import org.wso2.carbon.identity.oauth.extension.profile.RegistrationProfile;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
import org.wso2.carbon.identity.oauth.extension.profile.RegistrationProfile;
import java.util.Arrays;
public class DynamicClientRegistrationUtil {

@ -19,12 +19,12 @@
package org.wso2.carbon.identity.oauth.extension;
import org.wso2.carbon.identity.oauth.extension.profile.RegistrationProfile;
import org.wso2.carbon.identity.oauth.extension.profile.UnregistrationProfile;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.POST;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@ -49,6 +49,8 @@ public interface RegistrationService {
Response register(RegistrationProfile profile);
@DELETE
Response unregister(UnregistrationProfile profile);
public Response unregister(@QueryParam("applicationName") String applicationName,
@QueryParam("userId") String userId,
@QueryParam("consumerKey") String consumerKey);
}

@ -20,26 +20,14 @@ package org.wso2.carbon.identity.oauth.extension.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.JSONException;
import org.json.JSONObject;
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
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.InboundAuthenticationRequestConfig;
import org.wso2.carbon.identity.application.common.model.Property;
import org.wso2.carbon.identity.application.common.model.ServiceProvider;
import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
import org.wso2.carbon.identity.base.IdentityException;
import org.wso2.carbon.identity.oauth.OAuthAdminService;
import org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO;
import org.wso2.carbon.identity.oauth.extension.*;
import org.wso2.carbon.identity.oauth.extension.DynamicClientRegistrationUtil;
import org.wso2.carbon.identity.oauth.extension.FaultResponse;
import org.wso2.carbon.identity.oauth.extension.OAuthApplicationInfo;
import org.wso2.carbon.identity.oauth.extension.RegistrationService;
import org.wso2.carbon.identity.oauth.extension.profile.RegistrationProfile;
import org.wso2.carbon.identity.oauth.extension.profile.UnregistrationProfile;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@ -47,7 +35,7 @@ import javax.ws.rs.POST;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Arrays;
import javax.ws.rs.QueryParam;
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ -78,10 +66,9 @@ public class RegistrationServiceImpl implements RegistrationService {
@DELETE
@Override
public Response unregister(UnregistrationProfile profile) {
String applicationName = profile.getApplicationName();
String consumerKey = profile.getConsumerKey();
String userId = profile.getUserId();
public Response unregister(@QueryParam("applicationName") String applicationName,
@QueryParam("userId") String userId,
@QueryParam("consumerKey") String consumerKey) {
try {
DynamicClientRegistrationUtil.unregisterApplication(userId, applicationName, consumerKey);
return Response.status(Response.Status.ACCEPTED).build();

@ -1,52 +0,0 @@
/*
* Copyright (c) 2014, 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.identity.oauth.extension.profile;
/**
* This bean class represents the data that are required to unregister
* the oauth application.
*/
public class UnregistrationProfile {
private String applicationName;
private String consumerKey;
private String userId;
public String getApplicationName() {
return applicationName;
}
public void setApplicationName(String applicationName) {
this.applicationName = applicationName;
}
public String getConsumerKey() {
return consumerKey;
}
public void setConsumerKey(String consumerKey) {
this.consumerKey = consumerKey;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
}
Loading…
Cancel
Save