From 52b4902aa5d0f4ed9a2b96fef27fc08feb86074c Mon Sep 17 00:00:00 2001 From: mharindu Date: Wed, 8 Jul 2015 22:27:24 +0530 Subject: [PATCH] Refactored dynamic-client-registration unregister function --- .../oauth/extension/RegistrationService.java | 5 +- .../extension/UnregistrationProfile.java | 51 ------------------- .../impl/ClientRegistrationServiceImpl.java | 9 ++-- 3 files changed, 8 insertions(+), 57 deletions(-) delete mode 100644 components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/UnregistrationProfile.java diff --git a/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/RegistrationService.java b/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/RegistrationService.java index a8660aec90..32893e3e1e 100644 --- a/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/RegistrationService.java +++ b/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/RegistrationService.java @@ -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); } \ No newline at end of file diff --git a/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/UnregistrationProfile.java b/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/UnregistrationProfile.java deleted file mode 100644 index ac3f4f317b..0000000000 --- a/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/UnregistrationProfile.java +++ /dev/null @@ -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; - } -} diff --git a/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/impl/ClientRegistrationServiceImpl.java b/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/impl/ClientRegistrationServiceImpl.java index dd27729564..f06767e302 100644 --- a/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/impl/ClientRegistrationServiceImpl.java +++ b/components/oauth-extensions/dynamic-client-manager/src/main/java/org/wso2/carbon/identity/oauth/extension/impl/ClientRegistrationServiceImpl.java @@ -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();