Refactored dynamic-client-registration unregister function

revert-70aa11f8
mharindu 10 years ago
parent 440194632c
commit 52b4902aa5

@ -22,6 +22,7 @@ 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;
@ -33,6 +34,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);
}

@ -1,51 +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;
/**
* 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;
}
}

@ -39,7 +39,6 @@ import org.wso2.carbon.identity.oauth.extension.ApplicationConstants;
import org.wso2.carbon.identity.oauth.extension.OAuthApplicationInfo;
import org.wso2.carbon.identity.oauth.extension.RegistrationProfile;
import org.wso2.carbon.identity.oauth.extension.RegistrationService;
import org.wso2.carbon.identity.oauth.extension.UnregistrationProfile;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
@ -47,6 +46,7 @@ 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;
import java.util.Arrays;
@ -79,10 +79,9 @@ public class ClientRegistrationServiceImpl 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 {
this.unregisterApplication(userId, applicationName, consumerKey);
return Response.status(Response.Status.ACCEPTED).build();

Loading…
Cancel
Save