From eb89aa4ff4fee3b54616b5e2fbf243379de9c4d2 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Tue, 27 Jun 2017 23:20:04 +0530 Subject: [PATCH 1/3] Removed DCR feature --- .../dynamic-client-web-proxy/pom.xml | 110 ----- .../client/web/proxy/OAuthEndpointProxy.java | 72 ---- .../client/web/proxy/RegistrationProxy.java | 129 ------ .../client/web/proxy/util/Constants.java | 52 --- .../client/web/proxy/util/DCRProxyUtils.java | 122 ------ .../webapp/META-INF/webapp-classloading.xml | 35 -- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 51 --- .../src/main/webapp/WEB-INF/web.xml | 37 -- .../src/main/webapp/servicelist.css | 125 ------ .../src/test/resources/log4j.properties | 32 -- .../src/test/resources/testng.xml | 23 -- .../dynamic-client-web/pom.xml | 186 --------- .../dynamic/client/web/DynamicClientUtil.java | 33 -- .../client/web/FaultMessageBodyWriter.java | 70 ---- .../dynamic/client/web/FaultResponse.java | 38 -- .../client/web/RegistrationResponse.java | 40 -- .../client/web/RegistrationService.java | 72 ---- .../web/impl/RegistrationServiceImpl.java | 106 ----- .../webapp/META-INF/webapp-classloading.xml | 35 -- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 44 -- .../src/main/webapp/WEB-INF/web.xml | 39 -- .../src/main/webapp/servicelist.css | 125 ------ .../src/test/resources/log4j.properties | 32 -- .../src/test/resources/testng.xml | 23 -- .../pom.xml | 117 ------ .../DynamicClientRegistrationException.java | 61 --- .../DynamicClientRegistrationService.java | 64 --- .../registration/OAuthApplicationInfo.java | 98 ----- .../DynamicClientRegistrationServiceImpl.java | 373 ----------------- .../DynamicClientRegistrationDataHolder.java | 51 --- ...micClientRegistrationServiceComponent.java | 84 ---- .../profile/RegistrationProfile.java | 207 ---------- .../registration/util/DCRConstants.java | 58 --- .../util/DynamicClientRegistrationUtil.java | 42 -- .../pom.xml | 146 ------- ...ynamicClientWebAppRegistrationManager.java | 179 -------- ...bAppRegistrationServerStartupObserver.java | 38 -- .../DynamicClientRegistrationSettings.java | 44 -- .../JaggeryOAuthConfigurationSettings.java | 110 ----- .../app/registration/dto/OAuthAppDetails.java | 70 ---- ...micClientWebAppRegistrationDataHolder.java | 97 ----- ...entWebAppRegistrationServiceComponent.java | 176 -------- ...ientWebAppDeploymentLifecycleListener.java | 46 --- ...amicClientWebAppRegistrationConstants.java | 69 ---- .../DynamicClientWebAppRegistrationUtil.java | 382 ------------------ .../registration/util/RemoteDCRClient.java | 196 --------- .../dynamic-client-registration/pom.xml | 43 -- components/identity-extensions/pom.xml | 3 +- .../pom.xml | 157 ------- .../src/main/resources/p2.inf | 2 - features/dynamic-client-registration/pom.xml | 42 -- features/jwt-client/pom.xml | 2 +- pom.xml | 1 - 53 files changed, 2 insertions(+), 4587 deletions(-) delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/OAuthEndpointProxy.java delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/RegistrationProxy.java delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/util/Constants.java delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/util/DCRProxyUtils.java delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/META-INF/webapp-classloading.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/WEB-INF/cxf-servlet.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/WEB-INF/web.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/servicelist.css delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/test/resources/log4j.properties delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/test/resources/testng.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultMessageBodyWriter.java delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultResponse.java delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationResponse.java delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationService.java delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/RegistrationServiceImpl.java delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/META-INF/webapp-classloading.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/cxf-servlet.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/web.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/servicelist.css delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/test/resources/log4j.properties delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/test/resources/testng.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationException.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationService.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/OAuthApplicationInfo.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationDataHolder.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationServiceComponent.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/profile/RegistrationProfile.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/util/DCRConstants.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/util/DynamicClientRegistrationUtil.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/WebAppRegistrationServerStartupObserver.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/DynamicClientRegistrationSettings.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/JaggeryOAuthConfigurationSettings.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/OAuthAppDetails.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/internal/DynamicClientWebAppRegistrationDataHolder.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/internal/DynamicClientWebAppRegistrationServiceComponent.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/listner/DynamicClientWebAppDeploymentLifecycleListener.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationConstants.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/RemoteDCRClient.java delete mode 100644 components/identity-extensions/dynamic-client-registration/pom.xml delete mode 100644 features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml delete mode 100644 features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/src/main/resources/p2.inf delete mode 100644 features/dynamic-client-registration/pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml deleted file mode 100644 index 2c5e2cbb406..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - dynamic-client-registration - org.wso2.carbon.devicemgt - 3.0.11-SNAPSHOT - ../pom.xml - - - 4.0.0 - dynamic-client-web-proxy - WSO2 Carbon - Proxy endpoint of Dynamic Client Registration Web Service - WSO2 Carbon - Dynamic Client Registration Web Proxy - war - - - - - maven-war-plugin - 2.2 - - ${project.artifactId} - - - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.registration - provided - - - org.wso2.carbon - org.wso2.carbon.utils - provided - - - - org.apache.ws.commons.axiom.wso2 - axiom - provided - - - org.apache.cxf - cxf-rt-frontend-jaxrs - provided - - - org.apache.cxf - cxf-rt-transports-http - provided - - - org.apache.cxf - cxf-rt-bindings-http - provided - - - org.codehaus.jackson - jackson-jaxrs - - - commons-logging - commons-logging - provided - - - org.apache.httpcomponents - httpclient - - - com.google.code.gson - gson - provided - - - org.wso2.carbon - org.wso2.carbon.core - provided - - - diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/OAuthEndpointProxy.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/OAuthEndpointProxy.java deleted file mode 100644 index 0594491121a..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/OAuthEndpointProxy.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.web.proxy; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpEntity; -import org.apache.http.HttpHost; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.util.EntityUtils; -import org.wso2.carbon.dynamic.client.web.proxy.util.Constants; -import org.wso2.carbon.dynamic.client.web.proxy.util.DCRProxyUtils; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; - -public class OAuthEndpointProxy { - - private static final Log log = LogFactory.getLog(OAuthEndpointProxy.class); - - @POST - @Consumes("application/x-www-form-urlencoded") - @Produces("application/json") - public Response issueAccessToken(MultivaluedMap paramMap) { - DefaultHttpClient httpClient = DCRProxyUtils.getHttpsClient(); - String host = DCRProxyUtils.getKeyManagerHost(); - Response response; - try { - URI uri = new URIBuilder().setScheme(Constants.RemoteServiceProperties. - DYNAMIC_CLIENT_SERVICE_PROTOCOL).setHost(host).setPath( - Constants.RemoteServiceProperties.OAUTH2_TOKEN_ENDPOINT).build(); - HttpHost httpHost = new HttpHost(uri.toString()); - CloseableHttpResponse serverResponse = httpClient.execute(httpHost, null); - HttpEntity responseData = serverResponse.getEntity(); - int status = serverResponse.getStatusLine().getStatusCode(); - String resp = EntityUtils.toString(responseData, Constants.CharSets.CHARSET_UTF_8); - response = Response.status(DCRProxyUtils.getResponseStatus(status)).entity(resp).build(); - } catch (URISyntaxException | IOException e) { - String msg = "Service invoke error occurred while registering client"; - log.error(msg, e); - response = Response.status(javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } finally { - httpClient.close(); - } - return response; - } -} diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/RegistrationProxy.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/RegistrationProxy.java deleted file mode 100644 index 885530df770..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/RegistrationProxy.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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.web.proxy; - -import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.util.EntityUtils; -import org.wso2.carbon.dynamic.client.registration.profile.RegistrationProfile; -import org.wso2.carbon.dynamic.client.web.proxy.util.Constants; -import org.wso2.carbon.dynamic.client.web.proxy.util.DCRProxyUtils; - -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; - -/** - * This class implements the proxy-endpoint for Dynamic-client-registration web service endpoints. - */ -public class RegistrationProxy { - - private static final Log log = LogFactory.getLog(RegistrationProxy.class); - - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response register(RegistrationProfile registrationProfile) { - DefaultHttpClient httpClient = DCRProxyUtils.getHttpsClient(); - String host = DCRProxyUtils.getKeyManagerHost(); - Response response; - try { - URI uri = new URIBuilder().setScheme(Constants.RemoteServiceProperties. - DYNAMIC_CLIENT_SERVICE_PROTOCOL).setHost(host).setPath( - Constants.RemoteServiceProperties.DYNAMIC_CLIENT_SERVICE_ENDPOINT).build(); - Gson gson = new Gson(); - StringEntity entity = new StringEntity(gson.toJson(registrationProfile), MediaType.APPLICATION_JSON, - Constants.CharSets.CHARSET_UTF_8); - HttpPost httpPost = new HttpPost(uri); - httpPost.setEntity(entity); - CloseableHttpResponse serverResponse = httpClient.execute(httpPost); - HttpEntity responseData = serverResponse.getEntity(); - int status = serverResponse.getStatusLine().getStatusCode(); - String resp = EntityUtils.toString(responseData, Constants.CharSets.CHARSET_UTF_8); - response = Response.status(DCRProxyUtils.getResponseStatus(status)).entity(resp).build(); - } catch (URISyntaxException e) { - String msg = "Server error occurred while registering client '" + registrationProfile.getClientName() + "'"; - log.error(msg, e); - response = Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); - } catch (UnsupportedEncodingException e) { - String msg = "Request data encoding error occurred while registering client '" + registrationProfile. - getClientName() + "'"; - log.error(msg, e); - response = Response.status(Response.Status.UNSUPPORTED_MEDIA_TYPE).entity(msg).build(); - } catch (IOException e) { - String msg = "Service invoke error occurred while registering client."; - log.error(msg, e); - response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } finally { - httpClient.close(); - } - return response; - } - - @DELETE - @Produces(MediaType.APPLICATION_JSON) - public Response unregister(@QueryParam("applicationName") String applicationName, - @QueryParam("userId") String userId, - @QueryParam("consumerKey") String consumerKey) { - Response response; - DefaultHttpClient httpClient = DCRProxyUtils.getHttpsClient(); - String host = DCRProxyUtils.getKeyManagerHost(); - try { - URI uri = new URIBuilder().setScheme(Constants.RemoteServiceProperties. - DYNAMIC_CLIENT_SERVICE_PROTOCOL).setHost(host).setPath( - Constants.RemoteServiceProperties.DYNAMIC_CLIENT_SERVICE_ENDPOINT) - .setParameter("applicationName", applicationName) - .setParameter("userId", userId) - .setParameter("consumerKey", consumerKey).build(); - HttpDelete httpDelete = new HttpDelete(uri); - CloseableHttpResponse serverResponse = httpClient.execute(httpDelete); - HttpEntity responseData = serverResponse.getEntity(); - int status = serverResponse.getStatusLine().getStatusCode(); - String resp = EntityUtils.toString(responseData, Constants.CharSets.CHARSET_UTF_8); - response = Response.status(DCRProxyUtils.getResponseStatus(status)).entity(resp).build(); - } catch (URISyntaxException e) { - String msg = "Server error occurred while deleting the client '" + applicationName + "'"; - log.error(msg, e); - response = Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); - } catch (UnsupportedEncodingException e) { - String msg = "Request data encoding error occurred while deleting the client '" + applicationName + "'"; - log.error(msg, e); - response = Response.status(Response.Status.UNSUPPORTED_MEDIA_TYPE).entity(msg).build(); - } catch (IOException e) { - String msg = "Service invoke error occurred while deleting the client '" + applicationName + "'"; - log.error(msg, e); - response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } finally { - httpClient.close(); - } - return response; - } -} \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/util/Constants.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/util/Constants.java deleted file mode 100644 index a63a530edb0..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/util/Constants.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.web.proxy.util; - -/** - * Holds the constants used by DCR proxy app. - */ -public class Constants { - - public static final class CharSets { - private CharSets() { - throw new AssertionError(); - } - - public static final String CHARSET_UTF_8 = "UTF-8"; - } - - public static class ConfigurationProperties { - private ConfigurationProperties() { - throw new AssertionError(); - } - - public static final String AUTHENTICATOR_NAME = "OAuthAuthenticator"; - public static final String AUTHENTICATOR_CONFIG_HOST_URL = "hostURL"; - } - - public static class RemoteServiceProperties { - private RemoteServiceProperties() { - throw new AssertionError(); - } - - public static final String DYNAMIC_CLIENT_SERVICE_ENDPOINT = "/dynamic-client-web/register"; - public static final String OAUTH2_TOKEN_ENDPOINT = "/oauth2/token"; - public static final String DYNAMIC_CLIENT_SERVICE_PROTOCOL = "https"; - } -} diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/util/DCRProxyUtils.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/util/DCRProxyUtils.java deleted file mode 100644 index d9d1e549b23..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/java/org/wso2/carbon/dynamic/client/web/proxy/util/DCRProxyUtils.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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.web.proxy.util; - -import org.apache.http.HttpHost; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.SSLSocketFactory; -import org.apache.http.conn.ssl.X509HostnameVerifier; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.conn.SingleClientConnManager; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.core.security.AuthenticatorsConfiguration; -import org.wso2.carbon.utils.CarbonUtils; -import org.wso2.carbon.utils.ConfigurationContextService; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.ws.rs.core.Response; - -/** - * Holds the utility methods used by DCR proxy app. - */ -public class DCRProxyUtils { - - public static ConfigurationContextService getConfigurationContextService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - return (ConfigurationContextService) ctx.getOSGiService(ConfigurationContextService.class, null); - } - - public static DefaultHttpClient getHttpsClient() { - DefaultHttpClient httpClient = new DefaultHttpClient(); - // Setup the HTTPS settings to accept any certificate. - HostnameVerifier hostnameVerifier = org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER; - - SchemeRegistry registry = new SchemeRegistry(); - SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory(); - socketFactory.setHostnameVerifier((X509HostnameVerifier) hostnameVerifier); - registry.register(new Scheme(Constants.RemoteServiceProperties. - DYNAMIC_CLIENT_SERVICE_PROTOCOL, socketFactory, DCRProxyUtils.getServerHTTPSPort())); - SingleClientConnManager mgr = new SingleClientConnManager(httpClient.getParams(), registry); - httpClient = new DefaultHttpClient(mgr, httpClient.getParams()); - - // Set verifier - HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier); - return httpClient; - } - - public static Response.Status getResponseStatus(int statusCode) { - switch (statusCode) { - case 200 : - return Response.Status.OK; - case 201 : - return Response.Status.CREATED; - case 400 : - return Response.Status.BAD_REQUEST; - case 415 : - return Response.Status.UNSUPPORTED_MEDIA_TYPE; - case 500 : - return Response.Status.INTERNAL_SERVER_ERROR; - } - return Response.Status.ACCEPTED; - } - - public static String getKeyManagerHost() - throws IllegalArgumentException { - AuthenticatorsConfiguration authenticatorsConfiguration = AuthenticatorsConfiguration.getInstance(); - AuthenticatorsConfiguration.AuthenticatorConfig authenticatorConfig = authenticatorsConfiguration. - getAuthenticatorConfig( - Constants.ConfigurationProperties.AUTHENTICATOR_NAME); - if (authenticatorConfig != null && authenticatorConfig.getParameters() != null) { - return getHostName(authenticatorConfig.getParameters().get(Constants.ConfigurationProperties. - AUTHENTICATOR_CONFIG_HOST_URL)); - - }else{ - throw new IllegalArgumentException("Configuration parameters need to be defined in Authenticators.xml."); - } - } - - private static String getHostName(String host) { - if (host != null && !host.isEmpty()) { - if (host.contains("https://")) { - return host.replace("https://",""); - } - } else { - throw new IllegalArgumentException("Remote Host parameter must defined in Authenticators.xml."); - } - return null; - } - - - public static int getServerHTTPSPort() { - // HTTPS port - String mgtConsoleTransport = CarbonUtils.getManagementTransport(); - ConfigurationContextService configContextService = DCRProxyUtils.getConfigurationContextService(); - int port = CarbonUtils.getTransportPort(configContextService, mgtConsoleTransport); - int httpsProxyPort = - CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(), - mgtConsoleTransport); - if (httpsProxyPort > 0) { - port = httpsProxyPort; - } - return port; - } -} diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/META-INF/webapp-classloading.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/META-INF/webapp-classloading.xml deleted file mode 100644 index 38ac5358422..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - false - - - CXF,Carbon - diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/WEB-INF/cxf-servlet.xml deleted file mode 100644 index e057aebcd24..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/WEB-INF/cxf-servlet.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/WEB-INF/web.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 091413931d0..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - Dynamic-client-proxy-Webapp - - Dynamic-client-registration-proxy Endpoint - JAX-WS/JAX-RS Servlet - CXFServlet - - org.apache.cxf.transport.servlet.CXFServlet - - 1 - - - CXFServlet - /* - - - 60 - - \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/servicelist.css b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/servicelist.css deleted file mode 100644 index e6eacadbb0e..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/main/webapp/servicelist.css +++ /dev/null @@ -1,125 +0,0 @@ -@CHARSET "ISO-8859-1"; - -/* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) -*/ - -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, embed, -figure, figcaption, footer, header, hgroup, -menu, nav, output, ruby, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} - -/* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} - -html { - background: #efefef; -} - -body { - line-height: 1; - width: 960px; - margin: auto; - background: white; - padding: 10px; - box-shadow: 0px 0px 5px #CCC; - font-family: "Lucida Grande", "Lucida Sans", "Microsoft Sans Serif", "Lucida Sans Unicode", "Verdana", "Sans-serif", "trebuchet ms" !important; - -} - -ol, ul { - list-style: none; -} - -blockquote, q { - quotes: none; -} - -blockquote:before, blockquote:after, -q:before, q:after { - content: ''; - content: none; -} - -table { - border-collapse: collapse; - border-spacing: 0; - width: 960px; - border: solid 1px #ccc; -} - -table a { - font-size: 12px; - color: #1e90ff; - padding: 7px; - float: left;; -} - -.heading { - font-size: 18px; - margin-top: 20px; - float: left; - color: #0067B1; - margin-bottom: 20px; - padding-top: 20px; -} - -.field { - font-weight: normal; - width: 120px; - font-size: 12px; - float: left; - padding: 7px; - clear: left; -} - -.value { - font-weight: bold; - font-size: 12px; - float: left; - padding: 7px; - clear: right; -} - -.porttypename { - font-weight: bold; - font-size: 14px; -} - -UL { - margin-top: 0; -} - -LI { - font-weight: normal; - font-size: 12px; - margin-top: 10px; -} - -TD { - border: 1px solid #ccc; - vertical-align: text-top; - padding: 5px; -} - - diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/test/resources/log4j.properties b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/test/resources/log4j.properties deleted file mode 100644 index dc3d465fc0c..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/test/resources/log4j.properties +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright 2009 WSO2, Inc. (http://wso2.com) -# -# 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. -# - -# -# This is the log4j configuration file used by WSO2 Carbon -# -# IMPORTANT : Please do not remove or change the names of any -# of the Appenders defined here. The layout pattern & log file -# can be changed using the WSO2 Carbon Management Console, and those -# settings will override the settings in this file. -# - -log4j.rootLogger=INFO, STD_OUT - -# Redirect log messages to console -log4j.appender.STD_OUT=org.apache.log4j.ConsoleAppender -log4j.appender.STD_OUT.Target=System.out -log4j.appender.STD_OUT.layout=org.apache.log4j.PatternLayout -log4j.appender.STD_OUT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/test/resources/testng.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/test/resources/testng.xml deleted file mode 100644 index c0c21a40c31..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/src/test/resources/testng.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml deleted file mode 100644 index 727b3700022..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - dynamic-client-registration - org.wso2.carbon.devicemgt - 3.0.11-SNAPSHOT - ../pom.xml - - - 4.0.0 - dynamic-client-web - WSO2 Carbon - Dynamic Client Registration Web Service - WSO2 Carbon - Dynamic Client Registration Web - war - - - - - maven-war-plugin - 2.2 - - ${project.artifactId} - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.18 - - - file:src/test/resources/log4j.properties - - - src/test/resources/testng.xml - - - - - - - - - - org.apache.ws.commons.axiom.wso2 - axiom - provided - - - org.apache.cxf - cxf-rt-frontend-jaxrs - provided - - - org.apache.cxf - cxf-rt-transports-http - provided - - - org.apache.cxf - cxf-rt-bindings-http - provided - - - org.apache.cxf - cxf-rt-rs-extension-providers - compile - - - org.apache.cxf - cxf-rt-ws-security - - - org.slf4j - slf4j-api - - - provided - - - org.testng - testng - provided - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.core - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.registration - provided - - - org.wso2.carbon - org.wso2.carbon.utils - provided - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.application.mgt - provided - - - org.apache.neethi.wso2 - neethi - - - org.apache.neethi - neethi - - - - - com.googlecode.json-simple.wso2 - json-simple - provided - - - - org.apache.neethi.wso2 - neethi - provided - - - org.apache.neethi - neethi - provided - - - - org.codehaus.jackson - jackson-jaxrs - - - com.google.code.gson - gson - provided - - - javax.ws.rs - jsr311-api - - - commons-logging - commons-logging - provided - - - - diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java deleted file mode 100644 index d72736f3623..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.web; - -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService; - -/** - * Holds the utility methods used by Dynamic-Client web bundle. - */ -public class DynamicClientUtil { - - public static DynamicClientRegistrationService getDynamicClientRegistrationService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - return (DynamicClientRegistrationService) ctx.getOSGiService(DynamicClientRegistrationService.class, null); - } -} diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultMessageBodyWriter.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultMessageBodyWriter.java deleted file mode 100644 index 39f3c6dfb02..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultMessageBodyWriter.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.web; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonObject; - -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyWriter; -import javax.ws.rs.ext.Provider; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; - -@Provider -@Produces(MediaType.APPLICATION_JSON) -public class FaultMessageBodyWriter implements MessageBodyWriter { - - private static final String UTF_8 = "UTF-8"; - - @Override - public boolean isWriteable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return (FaultResponse.class == type); - } - - @Override - public long getSize(FaultResponse faultResponse, Class aClass, Type type, Annotation[] annotations, - MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(FaultResponse faultResponse, Class aClass, Type type, Annotation[] annotations, - MediaType mediaType, MultivaluedMap stringObjectMultivaluedMap, - OutputStream outputStream) throws IOException, WebApplicationException { - try (OutputStreamWriter writer = new OutputStreamWriter(outputStream, UTF_8)) { - JsonObject response = new JsonObject(); - response.addProperty("error", faultResponse.getCode().getValue()); - response.addProperty("error_description", faultResponse.getDescription()); - getGson().toJson(response, type, writer); - } - } - - private Gson getGson() { - GsonBuilder gsonBuilder = new GsonBuilder(); - return gsonBuilder.create(); - } - -} diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultResponse.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultResponse.java deleted file mode 100644 index 395673e5650..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.web; - -public class FaultResponse { - - private RegistrationService.ErrorCode code; - private String description; - - public FaultResponse(RegistrationService.ErrorCode code, String description) { - this.code = code; - this.description = description; - } - - public RegistrationService.ErrorCode getCode() { - return code; - } - - public String getDescription() { - return description; - } - -} diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationResponse.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationResponse.java deleted file mode 100644 index 76ff5ef1103..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.web; - -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - -public abstract class RegistrationResponse extends Response { - - @Override - public Object getEntity() { - return null; - } - - @Override - public int getStatus() { - return 0; - } - - @Override - public MultivaluedMap getMetadata() { - return null; - } - -} diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationService.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationService.java deleted file mode 100644 index ee5fa0ce744..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationService.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.web; - -import org.wso2.carbon.dynamic.client.registration.profile.RegistrationProfile; - -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; - -public interface RegistrationService { - - enum ErrorCode { - INVALID_URI("invalid_redirect_uri"), INVALID_CLIENT_METADATA("invalid_client_metadata"); - - private String value; - private ErrorCode(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - } - - /** - * This method is used to register an Oauth application. - * - * @param profile contains the necessary attributes that are - * needed in order to register an app. - * @return Status 200 if success including consumerKey and consumerSecret. - */ - @POST - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - Response register(RegistrationProfile profile); - - /** - * This method is used to remove already registered Oauth application. - * - * @param applicationName name of the application. - * @param userId name of the application owner. - * @param consumerKey provided consumerKey for the registered application. - * @return Status 200 if success. - */ - @DELETE - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - Response unregister(@QueryParam("applicationName") String applicationName, - @QueryParam("userId") String userId, - @QueryParam("consumerKey") String consumerKey); - -} \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/RegistrationServiceImpl.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/RegistrationServiceImpl.java deleted file mode 100644 index 59539b7279f..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/RegistrationServiceImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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.web.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; -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.web.DynamicClientUtil; -import org.wso2.carbon.dynamic.client.web.FaultResponse; -import org.wso2.carbon.dynamic.client.web.RegistrationService; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.POST; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.QueryParam; - -public class RegistrationServiceImpl implements RegistrationService { - - private static final Log log = LogFactory.getLog(RegistrationServiceImpl.class); - - @POST - @Override - public Response register(RegistrationProfile profile) { - Response response; - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( - MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); - PrivilegedCarbonContext.getThreadLocalCarbonContext(). - setTenantId(MultitenantConstants.SUPER_TENANT_ID); - DynamicClientRegistrationService dynamicClientRegistrationService = DynamicClientUtil. - getDynamicClientRegistrationService(); - if (dynamicClientRegistrationService != null) { - OAuthApplicationInfo info = dynamicClientRegistrationService.registerOAuthApplication(profile); - return Response.status(Response.Status.CREATED).entity(info.toString()).build(); - } - response = Response.status(Response.Status.INTERNAL_SERVER_ERROR). - entity("Dynamic Client Registration Service not available.").build(); - } catch (DynamicClientRegistrationException e) { - String msg = "Error occurred while registering client '" + profile.getClientName() + "'"; - log.error(msg, e); - response = Response.status(Response.Status.BAD_REQUEST).entity( - new FaultResponse(ErrorCode.INVALID_CLIENT_METADATA, msg)).build(); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - return response; - } - - @DELETE - @Override - public Response unregister(@QueryParam("applicationName") String applicationName, - @QueryParam("userId") String userId, - @QueryParam("consumerKey") String consumerKey) { - Response response; - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( - MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID); - DynamicClientRegistrationService dynamicClientRegistrationService = DynamicClientUtil. - getDynamicClientRegistrationService(); - if (dynamicClientRegistrationService != null) { - boolean status = dynamicClientRegistrationService.unregisterOAuthApplication(userId, applicationName, - consumerKey); - if (status) { - return Response.status(Response.Status.OK).build(); - } - return Response.status(Response.Status.BAD_REQUEST).build(); - } - response = Response.status(Response.Status.INTERNAL_SERVER_ERROR). - entity("Dynamic Client Registration Service not available.").build(); - } catch (DynamicClientRegistrationException e) { - String msg = "Error occurred while un-registering client '" + applicationName + "'"; - log.error(msg, e); - response = Response.serverError().entity(new FaultResponse(ErrorCode.INVALID_CLIENT_METADATA, msg)).build(); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - return response; - } - -} diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/META-INF/webapp-classloading.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/META-INF/webapp-classloading.xml deleted file mode 100644 index 38ac5358422..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - false - - - CXF,Carbon - diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/cxf-servlet.xml deleted file mode 100644 index 3d7ec54290a..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/cxf-servlet.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/web.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 57eb77536b3..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - dynamic-client-registration-Webapp - - Dynamic-client-registration Agent Endpoint - JAX-WS/JAX-RS Servlet - CXFServlet - - org.apache.cxf.transport.servlet.CXFServlet - - 1 - - - CXFServlet - /* - - - 60 - - \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/servicelist.css b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/servicelist.css deleted file mode 100644 index e6eacadbb0e..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/servicelist.css +++ /dev/null @@ -1,125 +0,0 @@ -@CHARSET "ISO-8859-1"; - -/* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) -*/ - -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, embed, -figure, figcaption, footer, header, hgroup, -menu, nav, output, ruby, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} - -/* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} - -html { - background: #efefef; -} - -body { - line-height: 1; - width: 960px; - margin: auto; - background: white; - padding: 10px; - box-shadow: 0px 0px 5px #CCC; - font-family: "Lucida Grande", "Lucida Sans", "Microsoft Sans Serif", "Lucida Sans Unicode", "Verdana", "Sans-serif", "trebuchet ms" !important; - -} - -ol, ul { - list-style: none; -} - -blockquote, q { - quotes: none; -} - -blockquote:before, blockquote:after, -q:before, q:after { - content: ''; - content: none; -} - -table { - border-collapse: collapse; - border-spacing: 0; - width: 960px; - border: solid 1px #ccc; -} - -table a { - font-size: 12px; - color: #1e90ff; - padding: 7px; - float: left;; -} - -.heading { - font-size: 18px; - margin-top: 20px; - float: left; - color: #0067B1; - margin-bottom: 20px; - padding-top: 20px; -} - -.field { - font-weight: normal; - width: 120px; - font-size: 12px; - float: left; - padding: 7px; - clear: left; -} - -.value { - font-weight: bold; - font-size: 12px; - float: left; - padding: 7px; - clear: right; -} - -.porttypename { - font-weight: bold; - font-size: 14px; -} - -UL { - margin-top: 0; -} - -LI { - font-weight: normal; - font-size: 12px; - margin-top: 10px; -} - -TD { - border: 1px solid #ccc; - vertical-align: text-top; - padding: 5px; -} - - diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/test/resources/log4j.properties b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/test/resources/log4j.properties deleted file mode 100644 index dc3d465fc0c..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/test/resources/log4j.properties +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright 2009 WSO2, Inc. (http://wso2.com) -# -# 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. -# - -# -# This is the log4j configuration file used by WSO2 Carbon -# -# IMPORTANT : Please do not remove or change the names of any -# of the Appenders defined here. The layout pattern & log file -# can be changed using the WSO2 Carbon Management Console, and those -# settings will override the settings in this file. -# - -log4j.rootLogger=INFO, STD_OUT - -# Redirect log messages to console -log4j.appender.STD_OUT=org.apache.log4j.ConsoleAppender -log4j.appender.STD_OUT.Target=System.out -log4j.appender.STD_OUT.layout=org.apache.log4j.PatternLayout -log4j.appender.STD_OUT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/test/resources/testng.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/test/resources/testng.xml deleted file mode 100644 index c25631e70a1..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/test/resources/testng.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml deleted file mode 100644 index 778916723bf..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - dynamic-client-registration - org.wso2.carbon.devicemgt - 3.0.11-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.dynamic.client.registration - 3.0.11-SNAPSHOT - bundle - WSO2 Carbon - Dynamic client registration service - WSO2 Carbon - Dynamic Client Registration Service - http://wso2.org - - - - - org.apache.felix - maven-scr-plugin - - - org.apache.felix - maven-bundle-plugin - 1.4.0 - true - - - ${project.artifactId} - ${project.artifactId} - ${carbon.device.mgt.version} - Dynamic Client Registration Bundle - org.wso2.carbon.dynamic.client.registration.internal - - !org.wso2.carbon.dynamic.client.registration.internal, - org.wso2.carbon.dynamic.client.registration.* - - - org.apache.commons.logging, - org.json, - org.json.simple, - org.osgi.framework, - org.osgi.service.component, - org.wso2.carbon.context, - org.wso2.carbon.identity.application.*; version="${carbon.identity.imp.pkg.version}", - org.wso2.carbon.identity.base; version="${carbon.identity.imp.pkg.version}", - org.wso2.carbon.identity.oauth.*; version="${carbon.identity-inbound-auth-oauth.imp.pkg.version}", - org.wso2.carbon.identity.sso.saml.admin, - org.wso2.carbon.identity.sso.saml.dto, - org.wso2.carbon.registry.api, - org.wso2.carbon.registry.core, - org.wso2.carbon.utils.multitenancy - - - - - - - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - org.testng - testng - - - org.wso2.carbon - org.wso2.carbon.utils - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.application.mgt - - - org.wso2.carbon.identity.inbound.auth.oauth2 - org.wso2.carbon.identity.oauth - - - org.wso2.carbon.identity.inbound.auth.saml2 - org.wso2.carbon.identity.sso.saml - - - com.googlecode.json-simple.wso2 - json-simple - - - org.json.wso2 - json - - - diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationException.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationException.java deleted file mode 100644 index 9798200f6fc..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationException.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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; - -/** - * Custom exception to be thrown inside DynamicClientRegistration related functionality. - */ -public class DynamicClientRegistrationException extends Exception { - - private static final long serialVersionUID = -3151279311929070297L; - - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public DynamicClientRegistrationException(String msg, Exception nestedEx) { - super(msg, nestedEx); - setErrorMessage(msg); - } - - public DynamicClientRegistrationException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public DynamicClientRegistrationException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public DynamicClientRegistrationException() { - super(); - } - - public DynamicClientRegistrationException(Throwable cause) { - super(cause); - } - -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationService.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationService.java deleted file mode 100644 index 7abbb8eeee2..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationService.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.dynamic.client.registration.profile.RegistrationProfile; - -/** - * This class represents the interface to be implemented by DynamicClientRegistrationService which - * is used to support the Dynamic-client-authentication protocol. - */ -public interface DynamicClientRegistrationService { - - /** - * This method will register a new OAuth application using the data provided by - * RegistrationProfile. - * - * @param profile - RegistrationProfile of the OAuth application to be created. - * @return OAuthApplicationInfo object which holds the necessary data of created OAuth app. - * @throws DynamicClientRegistrationException - * - */ - OAuthApplicationInfo registerOAuthApplication( - RegistrationProfile profile) throws DynamicClientRegistrationException; - - /** - * This method will unregister a created OAuth application. - * - * @param userName - Username of the owner - * @param applicationName - OAuth application name - * @param consumerKey - ConsumerKey of the OAuth application - * @return The status of the operation - * @throws DynamicClientRegistrationException - * - */ - boolean unregisterOAuthApplication(String userName, String applicationName, - String consumerKey) throws DynamicClientRegistrationException; - - /** - * This method will check the existence of an OAuth application provided application-name. - * - * @param applicationName - OAuth application name - * @return The status of the operation - * @throws DynamicClientRegistrationException - * - */ - boolean isOAuthApplicationAvailable(String applicationName) throws DynamicClientRegistrationException; - -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/OAuthApplicationInfo.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/OAuthApplicationInfo.java deleted file mode 100644 index 5fdb049aaf6..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/OAuthApplicationInfo.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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.json.simple.JSONObject; -import org.wso2.carbon.dynamic.client.registration.util.DCRConstants; - -import java.util.HashMap; -import java.util.Map; - -/** - * This class represents an OAuth application populated with necessary data. - */ -public class OAuthApplicationInfo { - - private String clientId; - private String clientName; - private String callBackURL; - private String clientSecret; - private Map parameters = new HashMap(); - - 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; - } - - public void setClientName(String clientName) { - this.clientName = clientName; - } - - public void setCallBackURL(String callBackURL) { - this.callBackURL = callBackURL; - } - - public void addParameter(String name, Object value) { - parameters.put(name, value); - } - - public Object getParameter(String name) { - return parameters.get(name); - } - - public String getJsonString() { - return JSONObject.toJSONString(parameters); - } - - public String getClientName() { - return clientName; - } - - public String getCallBackURL() { - return callBackURL; - } - - public void putAll(Map parameters) { - this.parameters.putAll(parameters); - } - - public void removeParameter(String key) { - this.parameters.remove(key); - } - - public String toString() { - JSONObject obj = new JSONObject(); - obj.put(DCRConstants.ClientMetadata.OAUTH_CLIENT_ID, this.getClientId()); - obj.put(DCRConstants.ClientMetadata.OAUTH_CLIENT_NAME, this.getClientName()); - obj.put(DCRConstants.ClientMetadata.OAUTH_CALLBACK_URIS, this.getCallBackURL()); - obj.put(DCRConstants.ClientMetadata.OAUTH_CLIENT_SECRET, this.getClientSecret()); - return obj.toString(); - } - -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java deleted file mode 100644 index aae823533ad..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java +++ /dev/null @@ -1,373 +0,0 @@ -/* - * 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.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.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.context.RegistryType; -import org.wso2.carbon.dynamic.client.registration.*; -import org.wso2.carbon.dynamic.client.registration.internal.DynamicClientRegistrationDataHolder; -import org.wso2.carbon.dynamic.client.registration.profile.RegistrationProfile; -import org.wso2.carbon.dynamic.client.registration.util.DCRConstants; -import org.wso2.carbon.dynamic.client.registration.util.DynamicClientRegistrationUtil; -import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException; -import org.wso2.carbon.identity.application.common.model.*; -import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; -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.dto.OAuthConsumerAppDTO; -import org.wso2.carbon.identity.sso.saml.admin.SAMLSSOConfigAdmin; -import org.wso2.carbon.identity.sso.saml.dto.SAMLSSOServiceProviderDTO; -import org.wso2.carbon.registry.core.Registry; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Implementation of DynamicClientRegistrationService. - */ -public class DynamicClientRegistrationServiceImpl implements DynamicClientRegistrationService { - - private static final String TOKEN_SCOPE = "tokenScope"; - private static final String MDM = "mdm"; - private static final String SAML_SSO = "samlsso"; - private static final String BASIC_AUTHENTICATOR = "BasicAuthenticator"; - private static final String BASIC = "basic"; - private static final String LOCAL = "local"; - private static final Log log = LogFactory.getLog(DynamicClientRegistrationService.class); - private static final String AUTH_TYPE_OAUTH_2 = "oauth2"; - private static final String OAUTH_CONSUMER_SECRET = "oauthConsumerSecret"; - private static final int STEP_ORDER = 1; - private static final String OAUTH_VERSION = "OAuth-2.0"; - - private static final String APPLICATION_TYPE_WEBAPP = "webapp"; - private static final String APPLICATION_TYPE_DEVICE = "device"; - - @Override - public OAuthApplicationInfo registerOAuthApplication( - RegistrationProfile profile) throws DynamicClientRegistrationException { - OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo(); - String applicationName = profile.getClientName(); - - if (log.isDebugEnabled()) { - log.debug("Trying to register OAuth application: '" + applicationName + "'"); - } - - String tokenScope = profile.getTokenScope(); - String tokenScopes[] = new String[1]; - tokenScopes[0] = tokenScope; - - oAuthApplicationInfo.addParameter(TOKEN_SCOPE, Arrays.toString(tokenScopes)); - OAuthApplicationInfo info; - try { - synchronized (DynamicClientRegistrationServiceImpl.class) { - info = this.createOAuthApplication(profile); - } - } catch (DynamicClientRegistrationException | IdentityException e) { - throw new DynamicClientRegistrationException("Can not create OAuth application : " + applicationName, e); - } - - if (info == null || info.getJsonString() == null) { - throw new DynamicClientRegistrationException( - "OAuth app does not contain required data: '" + applicationName + "'"); - } - - oAuthApplicationInfo.setClientName(info.getClientName()); - oAuthApplicationInfo.setClientId(info.getClientId()); - oAuthApplicationInfo.setCallBackURL(info.getCallBackURL()); - oAuthApplicationInfo.setClientSecret(info.getClientSecret()); - - try { - JSONObject jsonObject = new JSONObject(info.getJsonString()); - if (jsonObject.has(DCRConstants.ClientMetadata.OAUTH_REDIRECT_URIS)) { - oAuthApplicationInfo.addParameter(DCRConstants.ClientMetadata.OAUTH_REDIRECT_URIS, - jsonObject - .get(DCRConstants.ClientMetadata.OAUTH_REDIRECT_URIS)); - } - - if (jsonObject.has(DCRConstants.ClientMetadata.OAUTH_CLIENT_GRANT)) { - oAuthApplicationInfo.addParameter(DCRConstants.ClientMetadata.OAUTH_CLIENT_GRANT, jsonObject - .get(DCRConstants.ClientMetadata.OAUTH_CLIENT_GRANT)); - } - } catch (JSONException e) { - throw new DynamicClientRegistrationException( - "Can not retrieve information of the created OAuth application", e); - } - return oAuthApplicationInfo; - } - - private OAuthApplicationInfo createOAuthApplication( - RegistrationProfile profile) throws DynamicClientRegistrationException, IdentityException { - - //Subscriber's name should be passed as a parameter, since it's under the subscriber - //the OAuth App is created. - String userId = profile.getOwner(); - String applicationName = profile.getClientName(); - String grantType = profile.getGrantType(); - String callbackUrl = profile.getCallbackUrl(); - boolean isSaaSApp = profile.isSaasApp(); - - if (userId == null || userId.isEmpty()) { - return null; - } - - String tenantDomain = MultitenantUtils.getTenantDomain(userId); - String baseUser = CarbonContext.getThreadLocalCarbonContext().getUsername(); - String userName = MultitenantUtils.getTenantAwareUsername(userId); - - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); - - // Acting as the provided user. When creating Service Provider/OAuth App, - // username is fetched from CarbonContext - PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(userName); - - try { - // Append the username before Application name to make application name unique across two users. - applicationName = replaceInvalidChars(userName) + "_" + applicationName; - - // Create the Service Provider - ServiceProvider serviceProvider = new ServiceProvider(); - serviceProvider.setApplicationName(applicationName); - User user = new User(); - user.setUserName(userName); - user.setTenantDomain(tenantDomain); - serviceProvider.setOwner(user); - - serviceProvider.setDescription("Service Provider for application " + applicationName); - ApplicationManagementService appMgtService = DynamicClientRegistrationDataHolder.getInstance(). - getApplicationManagementService(); - if (appMgtService == null) { - throw new IllegalStateException("Error occurred while retrieving Application Management" + "Service"); - } - - ServiceProvider existingServiceProvider = appMgtService.getServiceProvider(applicationName, tenantDomain); - if (existingServiceProvider == null) { - appMgtService.createApplication(serviceProvider, tenantDomain, userName); - } - - ServiceProvider createdServiceProvider = appMgtService.getServiceProvider(applicationName, tenantDomain); - if (createdServiceProvider == null) { - throw new DynamicClientRegistrationException("Couldn't create Service Provider Application " + - applicationName); - } - //Set SaaS app option - createdServiceProvider.setSaasApp(isSaaSApp); - // Then Create OAuthApp - OAuthAdminService oAuthAdminService = new OAuthAdminService(); - - OAuthConsumerAppDTO oAuthConsumerApp = new OAuthConsumerAppDTO(); - oAuthConsumerApp.setApplicationName(applicationName); - oAuthConsumerApp.setCallbackUrl(callbackUrl); - oAuthConsumerApp.setGrantTypes(grantType); - oAuthConsumerApp.setOAuthVersion(OAUTH_VERSION); - if (log.isDebugEnabled()) { - log.debug("Creating OAuth App " + applicationName); - } - - if ((existingServiceProvider == null) || (existingServiceProvider.getInboundAuthenticationConfig(). - getInboundAuthenticationRequestConfigs().length == 0)) { - oAuthAdminService.registerOAuthApplicationData(oAuthConsumerApp); - } - - if (log.isDebugEnabled()) { - log.debug("Created OAuth App " + applicationName); - } - - OAuthConsumerAppDTO createdApp = - oAuthAdminService.getOAuthApplicationDataByAppName(oAuthConsumerApp.getApplicationName()); - if (log.isDebugEnabled()) { - log.debug("Retrieved Details for OAuth App " + createdApp.getApplicationName()); - } - // Set the OAuthApp in InboundAuthenticationConfig - InboundAuthenticationConfig inboundAuthenticationConfig = - new InboundAuthenticationConfig(); - List inboundAuthenticationRequestConfigs = new ArrayList<>(); - - InboundAuthenticationRequestConfig inboundAuthenticationRequestConfig = new - InboundAuthenticationRequestConfig(); - inboundAuthenticationRequestConfig.setInboundAuthKey(createdApp.getOauthConsumerKey()); - inboundAuthenticationRequestConfig.setInboundAuthType(AUTH_TYPE_OAUTH_2); - String oauthConsumerSecret = createdApp.getOauthConsumerSecret(); - if (oauthConsumerSecret != null && !oauthConsumerSecret.isEmpty()) { - Property property = new Property(); - property.setName(OAUTH_CONSUMER_SECRET); - property.setValue(oauthConsumerSecret); - Property[] properties = {property}; - inboundAuthenticationRequestConfig.setProperties(properties); - } - - if (APPLICATION_TYPE_WEBAPP.equals(profile.getApplicationType())) { - SAMLSSOServiceProviderDTO samlssoServiceProviderDTO = new SAMLSSOServiceProviderDTO(); - samlssoServiceProviderDTO.setIssuer(applicationName); - - SAMLSSOConfigAdmin configAdmin = new SAMLSSOConfigAdmin(getConfigSystemRegistry()); - configAdmin.addRelyingPartyServiceProvider(samlssoServiceProviderDTO); - - InboundAuthenticationRequestConfig samlAuthenticationRequest = new InboundAuthenticationRequestConfig(); - samlAuthenticationRequest.setInboundAuthKey(applicationName); - samlAuthenticationRequest.setInboundAuthType(SAML_SSO); - inboundAuthenticationRequestConfigs.add(samlAuthenticationRequest); - } - - LocalAuthenticatorConfig localAuth = new LocalAuthenticatorConfig(); - localAuth.setName(BASIC_AUTHENTICATOR); - localAuth.setDisplayName(BASIC); - localAuth.setEnabled(true); - - AuthenticationStep authStep = new AuthenticationStep(); - authStep.setStepOrder(STEP_ORDER); - authStep.setSubjectStep(true); - authStep.setAttributeStep(true); - - authStep.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[]{localAuth}); - - LocalAndOutboundAuthenticationConfig localOutboundAuthConfig = new LocalAndOutboundAuthenticationConfig(); - localOutboundAuthConfig.setAuthenticationType(LOCAL); - localOutboundAuthConfig.setAuthenticationSteps(new AuthenticationStep[]{authStep}); - createdServiceProvider.setLocalAndOutBoundAuthenticationConfig(localOutboundAuthConfig); - - inboundAuthenticationRequestConfigs.add(inboundAuthenticationRequestConfig); - inboundAuthenticationConfig - .setInboundAuthenticationRequestConfigs(inboundAuthenticationRequestConfigs.toArray( - new InboundAuthenticationRequestConfig[inboundAuthenticationRequestConfigs.size()])); - createdServiceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig); - - // Update the Service Provider app to add OAuthApp as an Inbound Authentication Config - appMgtService.updateApplication(createdServiceProvider, tenantDomain, userName); - - OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo(); - oAuthApplicationInfo.setClientId(createdApp.getOauthConsumerKey()); - oAuthApplicationInfo.setCallBackURL(createdApp.getCallbackUrl()); - oAuthApplicationInfo.setClientSecret(oauthConsumerSecret); - oAuthApplicationInfo.setClientName(createdApp.getApplicationName()); - - oAuthApplicationInfo.addParameter( - DCRConstants.ClientMetadata.OAUTH_REDIRECT_URIS, createdApp.getCallbackUrl()); - oAuthApplicationInfo.addParameter( - DCRConstants.ClientMetadata.OAUTH_CLIENT_GRANT, createdApp.getGrantTypes()); - - return oAuthApplicationInfo; - } catch (IdentityApplicationManagementException e) { - throw new DynamicClientRegistrationException( - "Error occurred while creating ServiceProvider for app " + applicationName, e); - } catch (Exception e) { - throw new DynamicClientRegistrationException( - "Error occurred while creating OAuthApp " + applicationName, e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(baseUser); - } - } - - protected Registry getConfigSystemRegistry() { - return (Registry) PrivilegedCarbonContext.getThreadLocalCarbonContext().getRegistry(RegistryType. - SYSTEM_CONFIGURATION); - } - - @Override - public boolean unregisterOAuthApplication(String userId, String applicationName, String consumerKey) throws - DynamicClientRegistrationException { - DynamicClientRegistrationUtil.validateUsername(userId); - DynamicClientRegistrationUtil.validateApplicationName(applicationName); - DynamicClientRegistrationUtil.validateConsumerKey(consumerKey); - - boolean status = false; - String tenantDomain = MultitenantUtils.getTenantDomain(userId); - String userName = MultitenantUtils.getTenantAwareUsername(userId); - - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(userName); - - OAuthAdminService oAuthAdminService; - OAuthConsumerAppDTO oAuthConsumerApp; - try { - oAuthAdminService = new OAuthAdminService(); - oAuthConsumerApp = oAuthAdminService.getOAuthApplicationData(consumerKey); - } catch (Exception e) { - //We had to catch Exception here because getOAuthApplicationData can throw exceptions of java.lang.Exception - // class. - throw new DynamicClientRegistrationException("Error occurred while retrieving application data", e); - } - - if (oAuthConsumerApp == null) { - throw new DynamicClientRegistrationException( - "No OAuth Consumer Application is associated with the given consumer key: " + consumerKey); - } - - try { - oAuthAdminService.removeOAuthApplicationData(consumerKey); - ApplicationManagementService appMgtService = DynamicClientRegistrationDataHolder.getInstance(). - getApplicationManagementService(); - - if (appMgtService == null) { - throw new IllegalStateException( - "Error occurred while retrieving Application Management" + - "Service"); - } - ServiceProvider createdServiceProvider = appMgtService.getServiceProvider(applicationName, tenantDomain); - if (createdServiceProvider == null) { - throw new DynamicClientRegistrationException( - "Couldn't retrieve Service Provider Application " + applicationName); - } - appMgtService.deleteApplication(applicationName, tenantDomain, userName); - status = true; - } catch (IdentityApplicationManagementException e) { - throw new DynamicClientRegistrationException( - "Error occurred while removing ServiceProvider for application '" + applicationName + "'", e); - } catch (IdentityOAuthAdminException e) { - throw new DynamicClientRegistrationException("Error occurred while removing application '" + - applicationName + "'", e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - return status; - } - - @Override - public boolean isOAuthApplicationAvailable(String applicationName) throws DynamicClientRegistrationException { - ApplicationManagementService appMgtService = DynamicClientRegistrationDataHolder.getInstance(). - getApplicationManagementService(); - if (appMgtService == null) { - throw new IllegalStateException( - "Error occurred while retrieving Application Management" + - "Service"); - } - try { - return appMgtService.getServiceProvider(applicationName, - CarbonContext.getThreadLocalCarbonContext().getTenantDomain()) != - null; - } catch (IdentityApplicationManagementException e) { - throw new DynamicClientRegistrationException( - "Error occurred while retrieving information of OAuthApp " + applicationName, e); - } - } - - private String replaceInvalidChars(String username) { - return username.replaceAll("@", "_AT_"); - } - -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationDataHolder.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationDataHolder.java deleted file mode 100644 index 9d105608e03..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationDataHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.identity.application.mgt.ApplicationManagementService; - -/** - * DataHolder class of DynamicClientRegistration bundle. This hold a reference to - * ApplicationManagementService. - */ -public class DynamicClientRegistrationDataHolder { - - private ApplicationManagementService applicationManagementService; - - private static DynamicClientRegistrationDataHolder thisInstance = - new DynamicClientRegistrationDataHolder(); - - private DynamicClientRegistrationDataHolder() { - } - - public static DynamicClientRegistrationDataHolder getInstance() { - return thisInstance; - } - - public ApplicationManagementService getApplicationManagementService() { - if (applicationManagementService == null) { - throw new IllegalStateException("ApplicationManagementService is not initialized properly"); - } - return applicationManagementService; - } - - public void setApplicationManagementService(ApplicationManagementService applicationManagementService) { - this.applicationManagementService = applicationManagementService; - } -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationServiceComponent.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationServiceComponent.java deleted file mode 100644 index 4a1ee1a6413..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationServiceComponent.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService; -import org.wso2.carbon.dynamic.client.registration.impl.DynamicClientRegistrationServiceImpl; -import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; - -/** - * @scr.component name="org.wso2.carbon.dynamic.client.registration" immediate="true" - * @scr.reference name="identity.application.management.service" - * interface="org.wso2.carbon.identity.application.mgt.ApplicationManagementService" - * cardinality="1..1" - * policy="dynamic" - * bind="setApplicationManagementService" - * unbind="unsetApplicationManagementService" - */ -public class DynamicClientRegistrationServiceComponent { - - private static final Log log = LogFactory.getLog(DynamicClientRegistrationServiceComponent.class); - - @SuppressWarnings("unused") - protected void activate(ComponentContext componentContext) { - if(log.isDebugEnabled()){ - log.debug("Starting DynamicClientRegistrationServiceComponent"); - } - componentContext.getBundleContext().registerService( - DynamicClientRegistrationService.class.getName(), new DynamicClientRegistrationServiceImpl(), null); - } - - @SuppressWarnings("unused") - protected void deactivate(ComponentContext componentContext) { - if(log.isDebugEnabled()){ - log.debug("Stopping DynamicClientRegistrationServiceComponent"); - } - } - - /** - * Sets ApplicationManagement Service. - * - * @param applicationManagementService An instance of ApplicationManagementService - */ - protected void setApplicationManagementService(ApplicationManagementService - applicationManagementService) { - if (log.isDebugEnabled()) { - log.debug("Setting ApplicationManagement Service"); - } - DynamicClientRegistrationDataHolder.getInstance(). - setApplicationManagementService(applicationManagementService); - } - - /** - * Unsets ApplicationManagement Service. - * - * @param applicationManagementService An instance of ApplicationManagementService - */ - protected void unsetApplicationManagementService(ApplicationManagementService - applicationManagementService) { - if (log.isDebugEnabled()) { - log.debug("Unsetting ApplicationManagement Service"); - } - DynamicClientRegistrationDataHolder.getInstance().setApplicationManagementService(null); - } - -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/profile/RegistrationProfile.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/profile/RegistrationProfile.java deleted file mode 100644 index 6022bd84907..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/profile/RegistrationProfile.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * 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.profile; - -/** - * - * DTO class to be used when registering an OAuth application. - * -* */ -public class RegistrationProfile { - - private String applicationType; - private String[] redirectUris; - private String clientName; - private String logoUri; - private String subjectType; - private String sectorIdentifierUri; - private String tokenEndpointAuthMethod; - private String jwksUri; - private String userInfoEncryptedResponseAlg; - private String userInfoEncryptedResponseEnc; - private String[] contacts; - private String[] requestUris; - private String owner; - private String callbackUrl; - private String tokenScope; - private String grantType; - private boolean saasApp; - private String audience; - private String recepientValidationURL; - private String assertionConsumerURL; - - public String getRecepientValidationURL() { - return recepientValidationURL; - } - - public void setRecepientValidationURL(String recepientValidationURL) { - this.recepientValidationURL = recepientValidationURL; - } - - public String getAssertionConsumerURL() { - return assertionConsumerURL; - } - - public void setAssertionConsumerURL(String assertionConsumerURL) { - this.assertionConsumerURL = assertionConsumerURL; - } - - public String getAudience() { - return audience; - } - - public void setAudience(String audience) { - this.audience = audience; - } - - public boolean isSaasApp() { - return saasApp; - } - - public void setSaasApp(boolean saasApp) { - this.saasApp = saasApp; - } - - public String getApplicationType() { - return applicationType; - } - - public void setApplicationType(String applicationType) { - this.applicationType = applicationType; - } - - public String[] getRedirectUris() { - return redirectUris; - } - - public void setRedirectUris(String[] redirectUris) { - this.redirectUris = redirectUris; - } - - public String getClientName() { - return clientName; - } - - public void setClientName(String clientName) { - this.clientName = clientName; - } - - public String getLogoUri() { - return logoUri; - } - - public void setLogoUri(String logoUri) { - this.logoUri = logoUri; - } - - public String getSubjectType() { - return subjectType; - } - - public void setSubjectType(String subjectType) { - this.subjectType = subjectType; - } - - public String getSectorIdentifierUri() { - return sectorIdentifierUri; - } - - public void setSectorIdentifierUri(String sectorIdentifierUri) { - this.sectorIdentifierUri = sectorIdentifierUri; - } - - public String getTokenEndpointAuthMethod() { - return tokenEndpointAuthMethod; - } - - public void setTokenEndpointAuthMethod(String tokenEndpointAuthMethod) { - this.tokenEndpointAuthMethod = tokenEndpointAuthMethod; - } - - public String getJwksUri() { - return jwksUri; - } - - public void setJwksUri(String jwksUri) { - this.jwksUri = jwksUri; - } - - public String getUserInfoEncryptedResponseAlg() { - return userInfoEncryptedResponseAlg; - } - - public void setUserInfoEncryptedResponseAlg(String userInfoEncryptedResponseAlg) { - this.userInfoEncryptedResponseAlg = userInfoEncryptedResponseAlg; - } - - public String getUserInfoEncryptedResponseEnc() { - return userInfoEncryptedResponseEnc; - } - - public void setUserInfoEncryptedResponseEnc(String userInfoEncryptedResponseEnc) { - this.userInfoEncryptedResponseEnc = userInfoEncryptedResponseEnc; - } - - public String[] getContacts() { - return contacts; - } - - public void setContacts(String[] contacts) { - this.contacts = contacts; - } - - public String[] getRequestUris() { - return requestUris; - } - - public void setRequestUris(String[] requestUris) { - this.requestUris = requestUris; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - 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 getGrantType() { - return grantType; - } - - public void setGrantType(String grantType) { - this.grantType = grantType; - } -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/util/DCRConstants.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/util/DCRConstants.java deleted file mode 100644 index 12c59e2de18..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/util/DCRConstants.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.util; - -/** - * This class holds the constants used by DynamicClientRegistration component. - */ -public final class DCRConstants { - - public static class ClientMetadata { - private ClientMetadata() { - throw new AssertionError(); - } - - public static final String OAUTH_CLIENT_ID = "client_id"; //this means consumer key - public static final String OAUTH_CLIENT_SECRET = "client_secret"; - public static final String OAUTH_REDIRECT_URIS = "redirect_uris"; - public static final String OAUTH_CALLBACK_URIS = "callback_url"; - public static final String OAUTH_CLIENT_NAME = "client_name"; - public static final String OAUTH_CLIENT_TYPE = "client_type"; - public static final String APP_KEY_TYPE = "key_type"; - public static final String APP_CALLBACK_URL = "callback_url"; - public static final String APP_HOME_PAGE = "homepage"; - public static final String OAUTH_CLIENT_CONTACT = "contact"; - public static final String APP_LOGO_URI = "logo_uri"; - public static final String OAUTH_CLIENT_SCOPE = "scope"; - public static final String OAUTH_CLIENT_GRANT = "grant_types"; - public static final String OAUTH_CLIENT_RESPONSETYPE = "response_types"; - public static final String OAUTH_CLIENT_AUTHMETHOD = "token_endpoint_auth_method"; - public static final String OAUTH_CLIENT_REGISTRATION_CLIENT_URI = "registration_client_uri"; - public static final String OAUTH_CLIENT_REGISTRATION_ACCESSTOKEN = "registration_access_token"; - public static final String OAUTH_CLIENT_CONTACTS = "contacts"; - public static final String OAUTH_CLIENT_MANUAL = "MANUAL"; - public static final String OAUTH_CLIENT_PRODUCTION = "PRODUCTION"; - public static final String OAUTH_CLIENT_SANDBOX = "SANDBOX"; - public static final String OAUTH_CLIENT_NOACCESSTOKEN = "NO ACCESS TOKEN"; - public static final String OAUTH_CLIENT_JSONPARAMSTRING = "jsonParams"; - public static final String OAUTH_CLIENT_USERNAME = "username"; - public static final String OAUTH_CLIENT_APPLICATION = "application"; - public static final String VALIDITY_PERIOD = "validityPeriod"; - } - -} \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/util/DynamicClientRegistrationUtil.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/util/DynamicClientRegistrationUtil.java deleted file mode 100644 index b4e53c797b3..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/util/DynamicClientRegistrationUtil.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.util; - -/** - * This class holds the util methods used by DCR component. - */ -public class DynamicClientRegistrationUtil { - - 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"); - } - } -} \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml deleted file mode 100644 index 0ac14c69e09..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - dynamic-client-registration - org.wso2.carbon.devicemgt - 3.0.11-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.dynamic.client.web.app.registration - 3.0.11-SNAPSHOT - bundle - WSO2 Carbon - Dynamic client web app registration - WSO2 Carbon - Dynamic Client Web-app Registration Service - http://wso2.org - - - - - org.apache.felix - maven-scr-plugin - - - org.apache.felix - maven-bundle-plugin - 1.4.0 - true - - - ${project.artifactId} - ${project.artifactId} - ${carbon.device.mgt.version} - Dynamic Client Web App Registration Bundle - org.wso2.carbon.dynamic.client.web.app.registration.internal - - !org.wso2.carbon.dynamic.client.web.app.registration.internal, - org.wso2.carbon.dynamic.client.web.app.registration.* - - - javax.xml.bind.*, - com.google.*, - javax.net.ssl, - javax.servlet, - org.apache.axis2.context, - org.apache.catalina, - org.apache.catalina.core, - org.apache.commons.*, - org.apache.http, - org.apache.http.*, - org.osgi.framework, - org.osgi.service.component, - org.wso2.carbon.context, - org.wso2.carbon.core, - org.wso2.carbon.core.security, - org.wso2.carbon.dynamic.client.*, - org.wso2.carbon.registry.*, - org.wso2.carbon.user.*, - org.wso2.carbon.utils - - - - - - - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - org.testng - testng - - - org.wso2.carbon - org.wso2.carbon.utils - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.application.mgt - - - org.wso2.carbon.identity.inbound.auth.oauth2 - org.wso2.carbon.identity.oauth - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.core - - - org.wso2.tomcat - tomcat - - - org.wso2.tomcat - tomcat-servlet-api - - - org.wso2.carbon - org.wso2.carbon.logging - - - org.wso2.carbon - org.wso2.carbon.user.core - - - org.wso2.carbon - org.wso2.carbon.registry.core - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.registration - - - org.apache.httpcomponents - httpclient - - - com.google.code.gson - gson - - - diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java deleted file mode 100644 index 0a2c101dfa8..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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.web.app.registration; - -import org.apache.catalina.core.StandardContext; -import org.apache.commons.collections.iterators.IteratorEnumeration; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationException; -import org.wso2.carbon.dynamic.client.registration.OAuthApplicationInfo; -import org.wso2.carbon.dynamic.client.registration.profile.RegistrationProfile; -import org.wso2.carbon.dynamic.client.web.app.registration.dto.JaggeryOAuthConfigurationSettings; -import org.wso2.carbon.dynamic.client.web.app.registration.dto.OAuthAppDetails; -import org.wso2.carbon.dynamic.client.web.app.registration.util.DynamicClientWebAppRegistrationConstants; -import org.wso2.carbon.dynamic.client.web.app.registration.util.DynamicClientWebAppRegistrationUtil; - -import javax.servlet.ServletContext; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; - -/** - * This class contains the logic to handle the OAuth application creation process. - */ -public class DynamicClientWebAppRegistrationManager { - - private static DynamicClientWebAppRegistrationManager dynamicClientWebAppRegistrationManager; - private static Map webAppContexts = new HashMap<>(); - - private static final Log log = LogFactory.getLog(DynamicClientWebAppRegistrationManager.class); - - private DynamicClientWebAppRegistrationManager() { - } - - public static DynamicClientWebAppRegistrationManager getInstance() { - if (dynamicClientWebAppRegistrationManager == null) { - synchronized (DynamicClientWebAppRegistrationManager.class) { - if (dynamicClientWebAppRegistrationManager == null) { - dynamicClientWebAppRegistrationManager = new DynamicClientWebAppRegistrationManager(); - } - } - } - return dynamicClientWebAppRegistrationManager; - } - - public OAuthAppDetails registerOAuthApplication(RegistrationProfile registrationProfile) { - if (log.isDebugEnabled()) { - log.debug("Registering OAuth application for web app : " + registrationProfile.getClientName()); - } - if (DynamicClientWebAppRegistrationUtil.validateRegistrationProfile(registrationProfile)) { - try { - OAuthApplicationInfo oAuthApplicationInfo = - DynamicClientWebAppRegistrationUtil.registerOAuthApplication(registrationProfile); - OAuthAppDetails oAuthAppDetails = new OAuthAppDetails(); - oAuthAppDetails.setWebAppName(registrationProfile.getClientName()); - oAuthAppDetails.setClientName(oAuthApplicationInfo.getClientName()); - oAuthAppDetails.setClientKey(oAuthApplicationInfo.getClientId()); - oAuthAppDetails.setClientSecret(oAuthApplicationInfo.getClientSecret()); - //store it in registry - if (DynamicClientWebAppRegistrationUtil.putOAuthApplicationData(oAuthAppDetails)) { - return oAuthAppDetails; - } else { - DynamicClientWebAppRegistrationUtil.unregisterOAuthApplication(registrationProfile.getOwner(), - oAuthApplicationInfo.getClientName(), - oAuthApplicationInfo.getClientId()); - log.warn("Error occurred while persisting the OAuth application data in registry."); - } - } catch (DynamicClientRegistrationException e) { - log.error("Error occurred while registering the OAuth application : " + - registrationProfile.getClientName(), e); - } - } - return null; - } - - public OAuthAppDetails getOAuthApplicationData(String clientName) { - try { - return DynamicClientWebAppRegistrationUtil.getOAuthApplicationData(clientName); - } catch (DynamicClientRegistrationException e) { - log.error("Error occurred while fetching the OAuth application data for web app : " + - clientName, e); - } - return null; - } - - public boolean isRegisteredOAuthApplication(String clientName) { - OAuthAppDetails oAuthAppDetails = this.getOAuthApplicationData(clientName); - if (oAuthAppDetails != null && (oAuthAppDetails.getClientKey() != null && oAuthAppDetails.getClientSecret() != - null)) { - return true; - } - return false; - } - - public void saveServletContextToCache(StandardContext context) { - DynamicClientWebAppRegistrationManager.webAppContexts.put(context.getBaseName(), - context.getServletContext()); - } - - public void initiateDynamicClientRegistration() { - String requiredDynamicClientRegistration, webAppName, serviceProviderName; - ServletContext servletContext; - RegistrationProfile registrationProfile; - OAuthAppDetails oAuthAppDetails; - DynamicClientWebAppRegistrationManager dynamicClientWebAppRegistrationManager = - DynamicClientWebAppRegistrationManager.getInstance(); - Enumeration enumeration = new IteratorEnumeration(DynamicClientWebAppRegistrationManager. - webAppContexts.keySet().iterator()); - if (log.isDebugEnabled()) { - log.debug("Initiating the DynamicClientRegistration service for web-apps"); - } - while (enumeration.hasMoreElements()) { - oAuthAppDetails = new OAuthAppDetails(); - webAppName = (String) enumeration.nextElement(); - serviceProviderName = DynamicClientWebAppRegistrationUtil.replaceInvalidChars(DynamicClientWebAppRegistrationUtil.getUserName()) - + "_" + webAppName; - servletContext = DynamicClientWebAppRegistrationManager.webAppContexts.get(webAppName); - requiredDynamicClientRegistration = servletContext.getInitParameter( - DynamicClientWebAppRegistrationConstants.DYNAMIC_CLIENT_REQUIRED_FLAG); - //Java web-app section - if ((requiredDynamicClientRegistration != null) && (Boolean.parseBoolean( - requiredDynamicClientRegistration))) { - //Check whether this is an already registered application - if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(serviceProviderName)) { - //Construct the RegistrationProfile - registrationProfile = DynamicClientWebAppRegistrationUtil. - constructRegistrationProfile(servletContext, webAppName); - //Register the OAuth application - oAuthAppDetails = - dynamicClientWebAppRegistrationManager.registerOAuthApplication(registrationProfile); - - } else { - oAuthAppDetails = dynamicClientWebAppRegistrationManager.getOAuthApplicationData(webAppName); - } - } else if (requiredDynamicClientRegistration == null) { - //Jaggery apps - JaggeryOAuthConfigurationSettings jaggeryOAuthConfigurationSettings = - DynamicClientWebAppRegistrationUtil.getJaggeryAppOAuthSettings(servletContext); - if (jaggeryOAuthConfigurationSettings.isRequireDynamicClientRegistration()) { - if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(serviceProviderName)) { - registrationProfile = DynamicClientWebAppRegistrationUtil. - constructRegistrationProfile(jaggeryOAuthConfigurationSettings, - webAppName); - oAuthAppDetails = dynamicClientWebAppRegistrationManager. - registerOAuthApplication(registrationProfile); - } else { - oAuthAppDetails = dynamicClientWebAppRegistrationManager.getOAuthApplicationData(webAppName); - } - } - } - //Add client credentials to the web-context - if ((oAuthAppDetails != null && oAuthAppDetails.getClientKey() != null) && - !oAuthAppDetails.getClientKey().isEmpty()) { - DynamicClientWebAppRegistrationUtil.addClientCredentialsToWebContext(oAuthAppDetails, - servletContext); - if (log.isDebugEnabled()) { - log.debug("Added OAuth application credentials to webapp context of webapp : " + - webAppName); - } - } - } - } -} \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/WebAppRegistrationServerStartupObserver.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/WebAppRegistrationServerStartupObserver.java deleted file mode 100644 index 6ed87bc28d0..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/WebAppRegistrationServerStartupObserver.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.web.app.registration; - -import org.wso2.carbon.core.ServerStartupObserver; - -/** - * ServerStartupObserver implementation to initiate the DynamicClientRegistration process for web - * apps after the Carbon server is up and ready. - */ -public class WebAppRegistrationServerStartupObserver implements ServerStartupObserver { - - @Override - public void completingServerStartup() { - - } - - @Override - public void completedServerStartup() { - DynamicClientWebAppRegistrationManager.getInstance().initiateDynamicClientRegistration(); - } -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/DynamicClientRegistrationSettings.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/DynamicClientRegistrationSettings.java deleted file mode 100644 index 6bbe47eb5a2..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/DynamicClientRegistrationSettings.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.web.app.registration.dto; - -/** - * Represents Configuration setting related to OAuth in authenticators.xml. - */ -public class DynamicClientRegistrationSettings { - - private boolean isRemote; - private String host; - - public boolean isRemote() { - return isRemote; - } - - public void setIsRemote(boolean isRemote) { - this.isRemote = isRemote; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/JaggeryOAuthConfigurationSettings.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/JaggeryOAuthConfigurationSettings.java deleted file mode 100644 index c46e82e0136..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/JaggeryOAuthConfigurationSettings.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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.web.app.registration.dto; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * Represents OAuthConfiguration data required to create OAuth service provider for Jaggery apps. - */ -@XmlRootElement(name = "OAuthSettings") -public class JaggeryOAuthConfigurationSettings { - - private String grantType; - private boolean saasApp; - private String callbackURL; - private String tokenScope; - private boolean requireDynamicClientRegistration; - private String audience; - private String assertionConsumerURL; - private String recepientValidationURL; - - @XmlElement(name = "assertionConsumerURL", required = true) - public String getAssertionConsumerURL() { - return assertionConsumerURL; - } - - public void setAssertionConsumerURL(String assertionConsumerURL) { - this.assertionConsumerURL = assertionConsumerURL; - } - - @XmlElement(name = "recepientValidationURL", required = true) - public String getRecepientValidationURL() { - return recepientValidationURL; - } - - public void setRecepientValidationURL(String recepientValidationURL) { - this.recepientValidationURL = recepientValidationURL; - } - - @XmlElement(name = "audience", required = true) - public String getAudience() { - return audience; - } - - public void setAudience(String audience) { - this.audience = audience; - } - - @XmlElement(name = "saasApp", required = true) - public boolean isSaasApp() { - return saasApp; - } - - public void setSaasApp(boolean saasApp) { - this.saasApp = saasApp; - } - - @XmlElement(name = "callbackURL", required = false) - public String getCallbackURL() { - return callbackURL; - } - - public void setCallbackURL(String callbackURL) { - this.callbackURL = callbackURL; - } - - @XmlElement(name = "tokenScope", required = false) - public String getTokenScope() { - return tokenScope; - } - - public void setTokenScope(String tokenScope) { - this.tokenScope = tokenScope; - } - - @XmlElement(name = "grantType", required = true) - public String getGrantType() { - return grantType; - } - - public void setGrantType(String grantType) { - this.grantType = grantType; - } - - @XmlElement(name = "requireDynamicClientRegistration", required = true) - public boolean isRequireDynamicClientRegistration() { - return requireDynamicClientRegistration; - } - - public void setRequireDynamicClientRegistration(boolean requireDynamicClientRegistration) { - this.requireDynamicClientRegistration = requireDynamicClientRegistration; - } -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/OAuthAppDetails.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/OAuthAppDetails.java deleted file mode 100644 index 9ae885c67b1..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/dto/OAuthAppDetails.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.web.app.registration.dto; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * Represents an OAuth application with basic necessary data. - */ -@XmlRootElement(name = "OAuthAppDetails") -public class OAuthAppDetails { - - private String clientName; - private String clientKey; - private String clientSecret; - private String webAppName; - - @XmlElement(name = "clientName", required = true) - public String getClientName() { - return clientName; - } - - public void setClientName(String clientName) { - this.clientName = clientName; - } - - @XmlElement(name = "clientKey", required = false) - public String getClientKey() { - return clientKey; - } - - public void setClientKey(String clientKey) { - this.clientKey = clientKey; - } - - @XmlElement(name = "clientSecret", required = false) - public String getClientSecret() { - return clientSecret; - } - - public void setClientSecret(String clientSecret) { - this.clientSecret = clientSecret; - } - - @XmlElement(name = "webAppName", required = true) - public String getWebAppName() { - return webAppName; - } - - public void setWebAppName(String webAppName) { - this.webAppName = webAppName; - } -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/internal/DynamicClientWebAppRegistrationDataHolder.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/internal/DynamicClientWebAppRegistrationDataHolder.java deleted file mode 100644 index b40e9a55046..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/internal/DynamicClientWebAppRegistrationDataHolder.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.web.app.registration.internal; - -import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService; -import org.wso2.carbon.registry.core.service.RegistryService; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.ConfigurationContextService; - -/** - * Dataholder class of DynamicClient Webapp Registration component. - */ -public class DynamicClientWebAppRegistrationDataHolder { - - private RealmService realmService; - private RegistryService registryService; - private DynamicClientRegistrationService dynamicClientRegistrationService; - private ConfigurationContextService configurationContextService; - - private static DynamicClientWebAppRegistrationDataHolder thisInstance = - new DynamicClientWebAppRegistrationDataHolder(); - - private DynamicClientWebAppRegistrationDataHolder() { - } - - public static DynamicClientWebAppRegistrationDataHolder getInstance() { - return thisInstance; - } - - public ConfigurationContextService getConfigurationContextService() { - if (configurationContextService != null) { - return configurationContextService; - } else { - throw new IllegalStateException( - "ConfigurationContext service has not initialized properly"); - } - } - - public void setConfigurationContextService( - ConfigurationContextService configurationContextService) { - this.configurationContextService = configurationContextService; - } - - public DynamicClientRegistrationService getDynamicClientRegistrationService() { - if (dynamicClientRegistrationService != null) { - return dynamicClientRegistrationService; - } else { - throw new IllegalStateException( - "DynamicClientRegistration service has not initialized properly"); - } - } - - public void setDynamicClientRegistrationService( - DynamicClientRegistrationService dynamicClientRegistrationService) { - this.dynamicClientRegistrationService = dynamicClientRegistrationService; - } - - public RealmService getRealmService() { - if (realmService != null) { - return realmService; - } else { - throw new IllegalStateException("RealmService has not initialized properly"); - } - } - - public void setRealmService(RealmService realmService) { - this.realmService = realmService; - } - - public RegistryService getRegistryService() { - if (registryService != null) { - return registryService; - } else { - throw new IllegalStateException("Registry Service has not initialized properly"); - } - } - - public void setRegistryService(RegistryService registryService) { - this.registryService = registryService; - } -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/internal/DynamicClientWebAppRegistrationServiceComponent.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/internal/DynamicClientWebAppRegistrationServiceComponent.java deleted file mode 100644 index 3707e9ef5c1..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/internal/DynamicClientWebAppRegistrationServiceComponent.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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.web.app.registration.internal; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.service.component.ComponentContext; -import org.osgi.util.tracker.ServiceTracker; -import org.wso2.carbon.core.ServerStartupObserver; -import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService; -import org.wso2.carbon.dynamic.client.web.app.registration.WebAppRegistrationServerStartupObserver; -import org.wso2.carbon.registry.core.service.RegistryService; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.ConfigurationContextService; - -/** - * @scr.component name="org.wso2.carbon.device.manager" 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" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="dynamic.client.service" - * interface="org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDynamicClientService" - * unbind="unsetDynamicClientService" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="0..1" - * policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - */ -public class DynamicClientWebAppRegistrationServiceComponent { - - private static Log log = - LogFactory.getLog(DynamicClientWebAppRegistrationServiceComponent.class); - - @SuppressWarnings("unused") - protected void activate(ComponentContext componentContext) { - componentContext.getBundleContext().registerService(ServerStartupObserver.class.getName(), - new WebAppRegistrationServerStartupObserver(), null); - } - - @SuppressWarnings("unused") - protected void deactivate(ComponentContext componentContext) { - - } - - /** - * Sets Realm Service. - * - * @param realmService An instance of RealmService - */ - protected void setRealmService(RealmService realmService) { - if (log.isDebugEnabled()) { - log.debug("Setting Realm Service"); - } - DynamicClientWebAppRegistrationDataHolder.getInstance().setRealmService(realmService); - } - - /** - * Unsets Realm Service. - * - * @param realmService An instance of RealmService - */ - protected void unsetRealmService(RealmService realmService) { - if (log.isDebugEnabled()) { - log.debug("Unsetting Realm Service"); - } - DynamicClientWebAppRegistrationDataHolder.getInstance().setRealmService(null); - } - - /** - * Sets Registry Service. - * - * @param registryService An instance of RegistryService - */ - protected void setRegistryService(RegistryService registryService) { - if (log.isDebugEnabled()) { - log.debug("Setting Registry Service"); - } - DynamicClientWebAppRegistrationDataHolder.getInstance().setRegistryService(registryService); - } - - /** - * Unsets Registry Service. - * - * @param registryService An instance of RegistryService - */ - protected void unsetRegistryService(RegistryService registryService) { - if (log.isDebugEnabled()) { - log.debug("Un setting Registry Service"); - } - DynamicClientWebAppRegistrationDataHolder.getInstance().setRegistryService(null); - } - - /** - * Sets Dynamic Client Registration Service. - * - * @param dynamicClientRegistrationService An instance of DynamicClientRegistrationService - */ - protected void setDynamicClientService( - DynamicClientRegistrationService dynamicClientRegistrationService) { - if (log.isDebugEnabled()) { - log.debug("Setting Dynamic Client Registration Service"); - } - DynamicClientWebAppRegistrationDataHolder.getInstance().setDynamicClientRegistrationService( - dynamicClientRegistrationService); - } - - /** - * Unsets Dynamic Client Registration Service. - * - * @param dynamicClientRegistrationService An instance of DynamicClientRegistrationService - */ - protected void unsetDynamicClientService( - DynamicClientRegistrationService dynamicClientRegistrationService) { - if (log.isDebugEnabled()) { - log.debug("Un setting Dynamic Client Registration Service"); - } - DynamicClientWebAppRegistrationDataHolder.getInstance().setDynamicClientRegistrationService(null); - } - - /** - * Sets ConfigurationContext Service. - * - * @param configurationContextService An instance of ConfigurationContextService - */ - protected void setConfigurationContextService( - ConfigurationContextService configurationContextService) { - if (log.isDebugEnabled()) { - log.debug("Setting ConfigurationContextService"); - } - DynamicClientWebAppRegistrationDataHolder.getInstance().setConfigurationContextService( - configurationContextService); - } - - /** - * Unsets ConfigurationContext Service. - * - * @param configurationContextService An instance of ConfigurationContextService - */ - protected void unsetConfigurationContextService( - ConfigurationContextService configurationContextService) { - if (log.isDebugEnabled()) { - log.debug("Un-setting ConfigurationContextService"); - } - DynamicClientWebAppRegistrationDataHolder.getInstance().setConfigurationContextService(null); - } -} \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/listner/DynamicClientWebAppDeploymentLifecycleListener.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/listner/DynamicClientWebAppDeploymentLifecycleListener.java deleted file mode 100644 index 29d1f1ae0b1..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/listner/DynamicClientWebAppDeploymentLifecycleListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.web.app.registration.listner; - -import org.apache.catalina.Lifecycle; -import org.apache.catalina.LifecycleEvent; -import org.apache.catalina.LifecycleListener; -import org.apache.catalina.core.StandardContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.dynamic.client.web.app.registration.DynamicClientWebAppRegistrationManager; - -/** - * This class initiates the dynamic client registration flow for Web applications upon on deployment - * of the web application. - */ -@SuppressWarnings("unused") -public class DynamicClientWebAppDeploymentLifecycleListener implements LifecycleListener { - - private static final Log log = - LogFactory.getLog(DynamicClientWebAppDeploymentLifecycleListener.class); - - @Override - public void lifecycleEvent(LifecycleEvent lifecycleEvent) { - if (Lifecycle.AFTER_START_EVENT.equals(lifecycleEvent.getType())) { - StandardContext context = (StandardContext) lifecycleEvent.getLifecycle(); - DynamicClientWebAppRegistrationManager.getInstance().saveServletContextToCache(context); - } - } -} diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationConstants.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationConstants.java deleted file mode 100644 index ca5e9a0eb60..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationConstants.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.web.app.registration.util; - -/** - * Holds the constants to be used in Dynamic client web app registration component. - */ -public class DynamicClientWebAppRegistrationConstants { - - public final static String OAUTH_APP_DATA_REGISTRY_PATH = "/OAuth"; - public final static String OAUTH_APP_NAME = "appName"; - public final static String OAUTH_CLIENT_KEY = "clientKey"; - public final static String OAUTH_CLIENT_SECRET = "clientSecret"; - public final static String DYNAMIC_CLIENT_REQUIRED_FLAG = - "requireDynamicClientRegistration"; - - public static final class ContentTypes { - private ContentTypes() { - throw new AssertionError(); - } - - public static final String CONTENT_TYPE_ANY = "*/*"; - public static final String CONTENT_TYPE_XML = "application/xml"; - public static final String CONTENT_TYPE_APPLICATION_JSON = "application/json"; - } - - public static final class CharSets { - private CharSets() { - throw new AssertionError(); - } - - public static final String CHARSET_UTF8 = "UTF8"; - } - - public static class ConfigurationProperties { - private ConfigurationProperties() { - throw new AssertionError(); - } - - public static final String AUTHENTICATOR_NAME = "OAuthAuthenticator"; - public static final String AUTHENTICATOR_CONFIG_IS_REMOTE = "isRemote"; - public static final String AUTHENTICATOR_CONFIG_HOST_URL = "hostURL"; - } - - public static class RemoteServiceProperties { - private RemoteServiceProperties() { - throw new AssertionError(); - } - - public static final String DYNAMIC_CLIENT_SERVICE_ENDPOINT = "/dynamic-client-web/register"; - public static final String DYNAMIC_CLIENT_SERVICE_PROTOCOL = "https"; - } -} \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java deleted file mode 100644 index ce6eaa50ee0..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java +++ /dev/null @@ -1,382 +0,0 @@ -/* - * 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.web.app.registration.util; - -import com.google.gson.stream.JsonReader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.core.security.AuthenticatorsConfiguration; -import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationException; -import org.wso2.carbon.dynamic.client.registration.OAuthApplicationInfo; -import org.wso2.carbon.dynamic.client.registration.profile.RegistrationProfile; -import org.wso2.carbon.dynamic.client.web.app.registration.dto.DynamicClientRegistrationSettings; -import org.wso2.carbon.dynamic.client.web.app.registration.dto.OAuthAppDetails; -import org.wso2.carbon.dynamic.client.web.app.registration.dto.JaggeryOAuthConfigurationSettings; -import org.wso2.carbon.dynamic.client.web.app.registration.internal.DynamicClientWebAppRegistrationDataHolder; -import org.wso2.carbon.registry.api.RegistryException; -import org.wso2.carbon.registry.api.Resource; -import org.wso2.carbon.registry.core.Registry; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.CarbonUtils; -import org.wso2.carbon.utils.ConfigurationContextService; -import org.wso2.carbon.utils.NetworkUtils; - -import javax.servlet.ServletContext; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import java.io.*; -import java.nio.charset.Charset; - -/** - * Holds the utility methods to be used in Dynamic client web app registration component. - */ -public class DynamicClientWebAppRegistrationUtil { - - private final static String OAUTH_PARAM_GRANT_TYPE = "grantType"; - private final static String OAUTH_PARAM_TOKEN_SCOPE = "tokenScope"; - private final static String OAUTH_PARAM_SAAS_APP = "saasApp"; - private final static String OAUTH_PARAM_CALLBACK_URL = "callbackURL"; - private final static String AUDIENCE = "audience"; - private final static String ASSERTION_CONSUMER_URL = "assertionConsumerURL"; - private final static String RECEPIENT_VALIDATION_URL = "recepientValidationURL"; - private static final String JAGGERY_APP_OAUTH_CONFIG_PATH = - "config" + File.separator + "service-provider.json"; - - private static final Log log = - LogFactory.getLog(DynamicClientWebAppRegistrationUtil.class); - private static final String CHARSET_UTF_8 = "UTF-8"; - - public static Registry getGovernanceRegistry() throws DynamicClientRegistrationException { - try { - int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - return DynamicClientWebAppRegistrationDataHolder.getInstance().getRegistryService(). - getGovernanceSystemRegistry(tenantId); - } catch (RegistryException e) { - throw new DynamicClientRegistrationException( - "Error in retrieving governance registry instance: " + - e.getMessage(), e); - } - } - - public static OAuthAppDetails getOAuthApplicationData(String appName) - throws DynamicClientRegistrationException { - Resource resource; - String resourcePath = DynamicClientWebAppRegistrationConstants.OAUTH_APP_DATA_REGISTRY_PATH + "/" + appName; - try { - if (log.isDebugEnabled()) { - log.debug("Retrieving OAuth application " + appName + " data from Registry"); - } - resource = DynamicClientWebAppRegistrationUtil.getRegistryResource(resourcePath); - if (resource != null) { - JAXBContext context = JAXBContext.newInstance(OAuthAppDetails.class); - Unmarshaller unmarshaller = context.createUnmarshaller(); - return (OAuthAppDetails) unmarshaller.unmarshal( - new StringReader(new String((byte[]) resource.getContent(), Charset.forName( - DynamicClientWebAppRegistrationConstants.CharSets.CHARSET_UTF8)))); - } - return new OAuthAppDetails(); - } catch (JAXBException e) { - throw new DynamicClientRegistrationException( - "Error occurred while parsing the OAuth application data : " + appName, e); - } catch (RegistryException e) { - throw new DynamicClientRegistrationException( - "Error occurred while retrieving the Registry resource of OAuth application : " + appName, e); - } - } - - public static boolean putOAuthApplicationData(OAuthAppDetails oAuthAppDetails) throws - DynamicClientRegistrationException { - boolean status; - try { - if (log.isDebugEnabled()) { - log.debug("Persisting OAuth application data in Registry"); - } - StringWriter writer = new StringWriter(); - JAXBContext context = JAXBContext.newInstance(OAuthAppDetails.class); - Marshaller marshaller = context.createMarshaller(); - marshaller.marshal(oAuthAppDetails, writer); - - Resource resource = DynamicClientWebAppRegistrationUtil.getGovernanceRegistry().newResource(); - resource.setContent(writer.toString()); - resource.setMediaType(DynamicClientWebAppRegistrationConstants.ContentTypes.CONTENT_TYPE_XML); - String resourcePath = DynamicClientWebAppRegistrationConstants.OAUTH_APP_DATA_REGISTRY_PATH + "/" + - oAuthAppDetails.getClientName(); - status = DynamicClientWebAppRegistrationUtil.putRegistryResource(resourcePath, resource); - } catch (RegistryException e) { - throw new DynamicClientRegistrationException( - "Error occurred while persisting OAuth application data : " + - oAuthAppDetails.getClientName(), e); - } catch (JAXBException e) { - throw new DynamicClientRegistrationException( - "Error occurred while parsing the OAuth application data : " + - oAuthAppDetails.getWebAppName(), e); - } - return status; - } - - public static boolean putRegistryResource(String path, Resource resource) throws DynamicClientRegistrationException { - try { - Registry governanceRegistry = DynamicClientWebAppRegistrationUtil.getGovernanceRegistry(); - governanceRegistry.beginTransaction(); - governanceRegistry.put(path, resource); - governanceRegistry.commitTransaction(); - return true; - } catch (RegistryException e) { - throw new DynamicClientRegistrationException("Error occurred while persisting registry resource : " + - e.getMessage(), e); - } - } - - public static Resource getRegistryResource(String path) throws DynamicClientRegistrationException { - try { - Registry governanceRegistry = DynamicClientWebAppRegistrationUtil.getGovernanceRegistry(); - if (governanceRegistry.resourceExists(path)) { - return governanceRegistry.get(path); - } - return null; - } catch (RegistryException e) { - throw new DynamicClientRegistrationException("Error in retrieving registry resource : " + - e.getMessage(), e); - } - } - - public static String getUserName() { - String username = ""; - RealmService realmService = DynamicClientWebAppRegistrationDataHolder.getInstance().getRealmService(); - if (realmService != null) { - username = realmService.getBootstrapRealmConfiguration().getAdminUserName(); - } - return username; - } - - public static RegistrationProfile constructRegistrationProfile(ServletContext servletContext, String webAppName) { - RegistrationProfile registrationProfile; - registrationProfile = new RegistrationProfile(); - registrationProfile.setGrantType(servletContext.getInitParameter( - DynamicClientWebAppRegistrationUtil.OAUTH_PARAM_GRANT_TYPE)); - registrationProfile.setTokenScope(servletContext.getInitParameter( - DynamicClientWebAppRegistrationUtil.OAUTH_PARAM_TOKEN_SCOPE)); - registrationProfile.setOwner(DynamicClientWebAppRegistrationUtil.getUserName()); - String callbackURL = servletContext.getInitParameter( - DynamicClientWebAppRegistrationUtil.OAUTH_PARAM_CALLBACK_URL); - if ((callbackURL != null) && !callbackURL.isEmpty()) { - registrationProfile.setCallbackUrl(callbackURL); - } else { - registrationProfile.setCallbackUrl(DynamicClientWebAppRegistrationUtil.getCallbackUrl(webAppName)); - } - registrationProfile.setClientName(webAppName); - registrationProfile.setSaasApp(Boolean.parseBoolean(servletContext.getInitParameter( - DynamicClientWebAppRegistrationUtil.OAUTH_PARAM_SAAS_APP))); - return registrationProfile; - } - - public static RegistrationProfile constructRegistrationProfile(JaggeryOAuthConfigurationSettings - jaggeryOAuthConfigurationSettings, String webAppName) { - RegistrationProfile registrationProfile = new RegistrationProfile(); - if (jaggeryOAuthConfigurationSettings != null) { - registrationProfile.setGrantType(jaggeryOAuthConfigurationSettings.getGrantType()); - registrationProfile.setTokenScope(jaggeryOAuthConfigurationSettings.getTokenScope()); - registrationProfile.setClientName(webAppName); - registrationProfile.setSaasApp(jaggeryOAuthConfigurationSettings.isSaasApp()); - registrationProfile.setOwner(DynamicClientWebAppRegistrationUtil.getUserName()); - registrationProfile.setAudience(jaggeryOAuthConfigurationSettings.getAudience()); - registrationProfile.setAssertionConsumerURL(jaggeryOAuthConfigurationSettings.getAssertionConsumerURL()); - registrationProfile.setRecepientValidationURL(jaggeryOAuthConfigurationSettings.getRecepientValidationURL()); - if (jaggeryOAuthConfigurationSettings.getCallbackURL() != null) { - registrationProfile.setCallbackUrl(jaggeryOAuthConfigurationSettings.getCallbackURL()); - } else { - registrationProfile.setCallbackUrl(DynamicClientWebAppRegistrationUtil.getCallbackUrl(webAppName)); - } - } else { - log.warn("Please configure OAuth settings properly for jaggery app : " + webAppName); - } - return registrationProfile; - } - - public static boolean validateRegistrationProfile(RegistrationProfile registrationProfile) { - boolean status = true; - //todo fix this - if (registrationProfile.getGrantType() == null) { - status = false; - log.warn("Required parameter 'grantType' is missing for initiating Dynamic-Client " + - "registration for webapp : " + registrationProfile.getClientName()); - } - if (registrationProfile.getTokenScope() == null) { - status = false; - log.warn("Required parameter 'tokenScope' is missing for initiating Dynamic-Client " + - "registration for webapp : " + registrationProfile.getClientName()); - } - return status; - } - - public static JaggeryOAuthConfigurationSettings getJaggeryAppOAuthSettings(ServletContext servletContext) { - JaggeryOAuthConfigurationSettings jaggeryOAuthConfigurationSettings = new JaggeryOAuthConfigurationSettings(); - try { - InputStream inputStream = servletContext.getResourceAsStream(JAGGERY_APP_OAUTH_CONFIG_PATH); - if (inputStream != null) { - JsonReader reader = new JsonReader(new InputStreamReader(inputStream, CHARSET_UTF_8)); - reader.beginObject(); - while (reader.hasNext()) { - String key = reader.nextName(); - switch (key) { - case DynamicClientWebAppRegistrationConstants.DYNAMIC_CLIENT_REQUIRED_FLAG: - jaggeryOAuthConfigurationSettings.setRequireDynamicClientRegistration(reader.nextBoolean()); - break; - case DynamicClientWebAppRegistrationUtil.OAUTH_PARAM_GRANT_TYPE: - jaggeryOAuthConfigurationSettings.setGrantType(reader.nextString()); - break; - case DynamicClientWebAppRegistrationUtil.OAUTH_PARAM_TOKEN_SCOPE: - jaggeryOAuthConfigurationSettings.setTokenScope(reader.nextString()); - break; - case DynamicClientWebAppRegistrationUtil.OAUTH_PARAM_SAAS_APP: - jaggeryOAuthConfigurationSettings.setSaasApp(reader.nextBoolean()); - break; - case DynamicClientWebAppRegistrationUtil.OAUTH_PARAM_CALLBACK_URL: - jaggeryOAuthConfigurationSettings.setCallbackURL(reader.nextString()); - break; - case DynamicClientWebAppRegistrationUtil.AUDIENCE: - jaggeryOAuthConfigurationSettings.setAudience(reader.nextString()); - break; - case DynamicClientWebAppRegistrationUtil.ASSERTION_CONSUMER_URL: - jaggeryOAuthConfigurationSettings.setAssertionConsumerURL(reader.nextString()); - break; - case DynamicClientWebAppRegistrationUtil.RECEPIENT_VALIDATION_URL: - jaggeryOAuthConfigurationSettings.setRecepientValidationURL(reader.nextString()); - break; - } - } - return jaggeryOAuthConfigurationSettings; - } - } catch (UnsupportedEncodingException e) { - log.error("Error occurred while initializing OAuth settings for the Jaggery app.", e); - } catch (IOException e) { - log.error("Error occurred while initializing OAuth settings for the Jaggery app.", e); - } - return jaggeryOAuthConfigurationSettings; - } - - public static String getServerBaseUrl() { - // Hostname - String hostName = "localhost"; - try { - hostName = NetworkUtils.getMgtHostName(); - } catch (Exception ignored) { - } - // HTTPS port - String mgtConsoleTransport = CarbonUtils.getManagementTransport(); - ConfigurationContextService configContextService = - DynamicClientWebAppRegistrationDataHolder.getInstance().getConfigurationContextService(); - int port = CarbonUtils.getTransportPort(configContextService, mgtConsoleTransport); - int httpsProxyPort = - CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(), - mgtConsoleTransport); - if (httpsProxyPort > 0) { - port = httpsProxyPort; - } - return "https://" + hostName + ":" + port; - } - - public static String getCallbackUrl(String context) { - return getServerBaseUrl() + "/" + context; - } - - public static void addClientCredentialsToWebContext(OAuthAppDetails oAuthAppDetails, - ServletContext servletContext) { - if (oAuthAppDetails != null) { - //Check for client credentials - if ((oAuthAppDetails.getClientKey() != null && !oAuthAppDetails.getClientKey().isEmpty()) && - (oAuthAppDetails.getClientSecret() != null && !oAuthAppDetails.getClientSecret().isEmpty())) { - servletContext.setAttribute(DynamicClientWebAppRegistrationConstants.OAUTH_CLIENT_KEY, - oAuthAppDetails.getClientKey()); - servletContext.setAttribute(DynamicClientWebAppRegistrationConstants.OAUTH_CLIENT_SECRET, - oAuthAppDetails.getClientSecret()); - } else { - log.warn("Client credentials not found for web app : " + oAuthAppDetails.getWebAppName()); - } - } - } - - public static String replaceInvalidChars(String username) { - return username.replaceAll("@","_AT_"); - } - - private static DynamicClientRegistrationSettings getDynamicClientRegistrationSettings() - throws IllegalArgumentException { - AuthenticatorsConfiguration authenticatorsConfiguration = AuthenticatorsConfiguration.getInstance(); - AuthenticatorsConfiguration.AuthenticatorConfig authenticatorConfig = authenticatorsConfiguration. - getAuthenticatorConfig(DynamicClientWebAppRegistrationConstants. - ConfigurationProperties.AUTHENTICATOR_NAME); - DynamicClientRegistrationSettings dynamicClientRegistrationSettings = new DynamicClientRegistrationSettings(); - if (authenticatorConfig != null && authenticatorConfig.getParameters() != null) { - dynamicClientRegistrationSettings.setIsRemote(Boolean.parseBoolean( - authenticatorConfig.getParameters().get( - DynamicClientWebAppRegistrationConstants.ConfigurationProperties. - AUTHENTICATOR_CONFIG_IS_REMOTE))); - dynamicClientRegistrationSettings.setHost(authenticatorConfig.getParameters(). - get(DynamicClientWebAppRegistrationConstants.ConfigurationProperties.AUTHENTICATOR_CONFIG_HOST_URL)); - - }else{ - throw new IllegalArgumentException("Configuration parameters need to be defined in Authenticators.xml."); - } - return dynamicClientRegistrationSettings; - } - - //This method will choose the best DynamicClientRegistrationService based on server configurations and - //registers OAuth client. - public static OAuthApplicationInfo registerOAuthApplication(RegistrationProfile registrationProfile) - throws DynamicClientRegistrationException { - DynamicClientRegistrationSettings dynamicClientRegistrationSettings = getDynamicClientRegistrationSettings(); - if (dynamicClientRegistrationSettings.isRemote()) { - return RemoteDCRClient.createOAuthApplication(registrationProfile, - getHostName(dynamicClientRegistrationSettings.getHost())); - } else { - return DynamicClientWebAppRegistrationDataHolder.getInstance(). - getDynamicClientRegistrationService().registerOAuthApplication(registrationProfile); - } - } - - //This method will choose the best DynamicClientRegistrationService based on server configurations and - //unregisters OAuth client. - public static boolean unregisterOAuthApplication(String owner, String clientName, String clientId) - throws DynamicClientRegistrationException { - DynamicClientRegistrationSettings dynamicClientRegistrationSettings = getDynamicClientRegistrationSettings(); - if (dynamicClientRegistrationSettings.isRemote()) { - return RemoteDCRClient.deleteOAuthApplication(owner, clientName, clientId, - getHostName(dynamicClientRegistrationSettings.getHost())); - } else { - return DynamicClientWebAppRegistrationDataHolder.getInstance(). - getDynamicClientRegistrationService().unregisterOAuthApplication(owner, clientName, clientId); - } - } - - private static String getHostName(String host) { - if (host != null && !host.isEmpty()) { - if (host.contains("https://")) { - return host.replace("https://",""); - } - } else { - throw new IllegalArgumentException("Remote Host parameter must defined in Authenticators.xml."); - } - return null; - } - -} \ No newline at end of file diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/RemoteDCRClient.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/RemoteDCRClient.java deleted file mode 100644 index f17dd376a5b..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/RemoteDCRClient.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * 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.web.app.registration.util; - -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.SSLSocketFactory; -import org.apache.http.conn.ssl.X509HostnameVerifier; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.conn.SingleClientConnManager; -import org.apache.http.util.EntityUtils; -import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationException; -import org.wso2.carbon.dynamic.client.registration.OAuthApplicationInfo; -import org.wso2.carbon.dynamic.client.registration.profile.RegistrationProfile; -import org.wso2.carbon.dynamic.client.web.app.registration.internal.DynamicClientWebAppRegistrationDataHolder; -import org.wso2.carbon.utils.CarbonUtils; -import org.wso2.carbon.utils.ConfigurationContextService; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; - -/** - * This class holds the necessary logic to create and delete service-providers by invoking the - * dynamic-client-registration endpoint. - */ -public class RemoteDCRClient { - - private static final Log log = LogFactory.getLog(RemoteDCRClient.class); - - public static OAuthApplicationInfo createOAuthApplication(RegistrationProfile registrationProfile, String host) - throws DynamicClientRegistrationException { - if (log.isDebugEnabled()) { - log.debug("Invoking DCR service to create OAuth application for web app : " + registrationProfile. - getClientName()); - } - DefaultHttpClient httpClient = getHTTPSClient(); - String clientName = registrationProfile.getClientName(); - try { - URI uri = new URIBuilder().setScheme(DynamicClientWebAppRegistrationConstants.RemoteServiceProperties. - DYNAMIC_CLIENT_SERVICE_PROTOCOL).setHost(host).setPath( - DynamicClientWebAppRegistrationConstants.RemoteServiceProperties.DYNAMIC_CLIENT_SERVICE_ENDPOINT) - .build(); - Gson gson = new Gson(); - StringEntity entity = new StringEntity(gson.toJson(registrationProfile), - DynamicClientWebAppRegistrationConstants.ContentTypes.CONTENT_TYPE_APPLICATION_JSON, - DynamicClientWebAppRegistrationConstants.CharSets.CHARSET_UTF8); - HttpPost httpPost = new HttpPost(uri); - httpPost.setEntity(entity); - HttpResponse response = httpClient.execute(httpPost); - int status = response.getStatusLine().getStatusCode(); - HttpEntity responseData = response.getEntity(); - String responseString = EntityUtils.toString(responseData, DynamicClientWebAppRegistrationConstants. - CharSets.CHARSET_UTF8); - if (status != 201) { - String msg = "Backend server error occurred while invoking DCR endpoint for " + - "registering service-provider upon web-app : '" + clientName + "'; Server returned response '" + - responseString + "' with HTTP status code '" + status + "'"; - throw new DynamicClientRegistrationException(msg); - } - return getOAuthApplicationInfo(gson.fromJson(responseString, JsonElement.class)); - } catch (URISyntaxException e) { - throw new DynamicClientRegistrationException("Exception occurred while constructing the URI for invoking " + - "DCR endpoint for registering service-provider for web-app : " - + clientName, e); - } catch (UnsupportedEncodingException e) { - throw new DynamicClientRegistrationException( - "Exception occurred while constructing the payload for invoking " + - "DCR endpoint for registering service-provider for web-app : " - + clientName, e); - } catch (IOException e) { - throw new DynamicClientRegistrationException("Connection error occurred while invoking DCR endpoint for" + - " registering service-provider for web-app : " + clientName, - e); - } finally { - if (httpClient != null) { - httpClient.close(); - } - } - } - - public static boolean deleteOAuthApplication(String user, String appName, String clientid, String host) - throws DynamicClientRegistrationException { - if (log.isDebugEnabled()) { - log.debug("Invoking DCR service to remove OAuth application created for web app : " + appName); - } - DefaultHttpClient httpClient = getHTTPSClient(); - try { - URI uri = new URIBuilder().setScheme(DynamicClientWebAppRegistrationConstants.RemoteServiceProperties. - DYNAMIC_CLIENT_SERVICE_PROTOCOL).setHost(host).setPath( - DynamicClientWebAppRegistrationConstants.RemoteServiceProperties.DYNAMIC_CLIENT_SERVICE_ENDPOINT) - .setParameter("applicationName", appName) - .setParameter("userId", user) - .setParameter("consumerKey", clientid).build(); - HttpDelete httpDelete = new HttpDelete(uri); - HttpResponse response = httpClient.execute(httpDelete); - int status = response.getStatusLine().getStatusCode(); - if (status == 200) { - return true; - } - } catch (IOException e) { - throw new DynamicClientRegistrationException( - "Connection error occurred while constructing the payload for " + - "invoking DCR endpoint for unregistering the web-app : " + appName, e); - } catch (URISyntaxException e) { - throw new DynamicClientRegistrationException("Exception occurred while constructing the URI for invoking " + - "DCR endpoint for unregistering the web-app : " + appName, e); - } finally { - if (httpClient != null) { - httpClient.close(); - } - } - return false; - } - - private static int getServerHTTPSPort() { - // HTTPS port - String mgtConsoleTransport = CarbonUtils.getManagementTransport(); - ConfigurationContextService configContextService = - DynamicClientWebAppRegistrationDataHolder.getInstance().getConfigurationContextService(); - int port = CarbonUtils.getTransportPort(configContextService, mgtConsoleTransport); - int httpsProxyPort = - CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(), - mgtConsoleTransport); - if (httpsProxyPort > 0) { - port = httpsProxyPort; - } - return port; - } - - private static OAuthApplicationInfo getOAuthApplicationInfo(JsonElement jsonData) { - JsonObject jsonObject = jsonData.getAsJsonObject(); - OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo(); - JsonElement property = jsonObject.get("client_id"); - if (property != null) { - oAuthApplicationInfo.setClientId(property.getAsString()); - } - property = jsonObject.get("client_name"); - if (property != null) { - oAuthApplicationInfo.setClientName(property.getAsString()); - } - property = jsonObject.get("client_secret"); - if (property != null) { - oAuthApplicationInfo.setClientSecret(property.getAsString()); - } - return oAuthApplicationInfo; - } - - private static DefaultHttpClient getHTTPSClient() { - DefaultHttpClient httpClient = new DefaultHttpClient(); - // Setup the HTTPS settings to accept any certificate. - HostnameVerifier hostnameVerifier = org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER; - - SchemeRegistry registry = new SchemeRegistry(); - SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory(); - socketFactory.setHostnameVerifier((X509HostnameVerifier) hostnameVerifier); - registry.register(new Scheme(DynamicClientWebAppRegistrationConstants.RemoteServiceProperties. - DYNAMIC_CLIENT_SERVICE_PROTOCOL, socketFactory, getServerHTTPSPort())); - SingleClientConnManager mgr = new SingleClientConnManager(httpClient.getParams(), registry); - httpClient = new DefaultHttpClient(mgr, httpClient.getParams()); - - // Set verifier - HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier); - return httpClient; - } -} diff --git a/components/identity-extensions/dynamic-client-registration/pom.xml b/components/identity-extensions/dynamic-client-registration/pom.xml deleted file mode 100644 index c8a7d989ed2..00000000000 --- a/components/identity-extensions/dynamic-client-registration/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - org.wso2.carbon.devicemgt - identity-extensions - 3.0.11-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.devicemgt - dynamic-client-registration - 3.0.11-SNAPSHOT - pom - WSO2 Carbon - Dynamic client registration - http://wso2.org - - - dynamic-client-web - dynamic-client-web-proxy - org.wso2.carbon.dynamic.client.registration - org.wso2.carbon.dynamic.client.web.app.registration - - diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 03eb7f7f283..5116917a089 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -30,14 +30,13 @@ org.wso2.carbon.devicemgt identity-extensions pom - WSO2 Carbon - Dynamic Client Registration Component + WSO2 Carbon - Identity Extensions Component http://wso2.org org.wso2.carbon.identity.authenticator.backend.oauth org.wso2.carbon.device.mgt.oauth.extensions org.wso2.carbon.identity.jwt.client.extension - dynamic-client-registration diff --git a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml deleted file mode 100644 index 87c5caff041..00000000000 --- a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - org.wso2.carbon.devicemgt - dynamic-client-registration-feature - 3.0.11-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.dynamic.client.registration.server.feature - pom - 3.0.11-SNAPSHOT - WSO2 Carbon - Dynamic Client Registration Server Feature - http://wso2.org - This feature contains dynamic client registration features - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.registration - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.web.app.registration - - - com.googlecode.json-simple.wso2 - json-simple - - - org.json.wso2 - json - - - - - - - maven-resources-plugin - 2.6 - - - copy-resources - generate-resources - - copy-resources - - - src/main/resources - - - resources - - build.properties - p2.inf - - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.4 - - - copy - package - - copy - - - - - org.wso2.carbon.devicemgt - dynamic-client-web - ${carbon.device.mgt.version} - war - true - ${basedir}/src/main/resources/ - dynamic-client-web.war - - - - - - - - - org.wso2.maven - carbon-p2-plugin - ${carbon.p2.plugin.version} - - - p2-feature-generation - package - - p2-feature-gen - - - org.wso2.carbon.dynamic.client.registration.server - ../../../features/etc/feature.properties - - - org.wso2.carbon.p2.category.type:server - org.eclipse.equinox.p2.type.group:true - - - - - org.wso2.carbon.devicemgt:org.wso2.carbon.dynamic.client.registration:${carbon.device.mgt.version} - - - org.wso2.carbon.devicemgt:org.wso2.carbon.dynamic.client.web.app.registration:${carbon.device.mgt.version} - - - com.googlecode.json-simple.wso2:json-simple:${json-simple.version} - - - org.json.wso2:json:${commons-json.version} - - - - org.wso2.carbon.core.server:${carbon.kernel.version} - - - - - - - - - diff --git a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/src/main/resources/p2.inf b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/src/main/resources/p2.inf deleted file mode 100644 index 0f2ca3fd111..00000000000 --- a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/src/main/resources/p2.inf +++ /dev/null @@ -1,2 +0,0 @@ -instructions.configure = \ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.dynamic.client.registration.server_${feature.version}/dynamic-client-web.war,target:${installFolder}/../../deployment/server/webapps/dynamic-client-web.war,overwrite:true);\ \ No newline at end of file diff --git a/features/dynamic-client-registration/pom.xml b/features/dynamic-client-registration/pom.xml deleted file mode 100644 index b029cf45a2c..00000000000 --- a/features/dynamic-client-registration/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - org.wso2.carbon.devicemgt - carbon-devicemgt - 3.0.11-SNAPSHOT - ../../pom.xml - - - 4.0.0 - org.wso2.carbon.devicemgt - dynamic-client-registration-feature - 3.0.11-SNAPSHOT - pom - WSO2 Carbon - Dynamic Client Registration Feature - http://wso2.org - - - org.wso2.carbon.dynamic.client.registration.server.feature - - - diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 2f1e9f72242..c8aa4c76ed2 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -31,7 +31,7 @@ jwt-client-feature 3.0.11-SNAPSHOT pom - WSO2 Carbon - Dynamic Client Registration Feature + WSO2 Carbon - JWT Client Extension Feature http://wso2.org diff --git a/pom.xml b/pom.xml index bc4b28d2a4c..af62c8ca4b8 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,6 @@ features/policy-mgt features/webapp-authenticator-framework features/certificate-mgt - features/dynamic-client-registration features/oauth-extensions features/email-sender features/jwt-client From a60566a417668ce95cb31a84891d2ab32b1bb9d2 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Wed, 28 Jun 2017 12:19:09 +0530 Subject: [PATCH 2/3] Removed DCR dependancies --- .../dynamic-client-web-proxy/pom.xml | 110 ----------- .../dynamic-client-web/pom.xml | 186 ------------------ .../pom.xml | 117 ----------- .../pom.xml | 146 -------------- .../dynamic-client-registration/pom.xml | 43 ---- .../pom.xml | 157 --------------- features/dynamic-client-registration/pom.xml | 42 ---- pom.xml | 37 ---- 8 files changed, 838 deletions(-) delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml delete mode 100644 components/identity-extensions/dynamic-client-registration/pom.xml delete mode 100644 features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml delete mode 100644 features/dynamic-client-registration/pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml deleted file mode 100644 index 53eae6ff8b4..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - dynamic-client-registration - org.wso2.carbon.devicemgt - 3.0.12-SNAPSHOT - ../pom.xml - - - 4.0.0 - dynamic-client-web-proxy - WSO2 Carbon - Proxy endpoint of Dynamic Client Registration Web Service - WSO2 Carbon - Dynamic Client Registration Web Proxy - war - - - - - maven-war-plugin - 2.2 - - ${project.artifactId} - - - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.registration - provided - - - org.wso2.carbon - org.wso2.carbon.utils - provided - - - - org.apache.ws.commons.axiom.wso2 - axiom - provided - - - org.apache.cxf - cxf-rt-frontend-jaxrs - provided - - - org.apache.cxf - cxf-rt-transports-http - provided - - - org.apache.cxf - cxf-rt-bindings-http - provided - - - org.codehaus.jackson - jackson-jaxrs - - - commons-logging - commons-logging - provided - - - org.apache.httpcomponents - httpclient - - - com.google.code.gson - gson - provided - - - org.wso2.carbon - org.wso2.carbon.core - provided - - - diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml deleted file mode 100644 index 3d7b7c720a8..00000000000 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - dynamic-client-registration - org.wso2.carbon.devicemgt - 3.0.12-SNAPSHOT - ../pom.xml - - - 4.0.0 - dynamic-client-web - WSO2 Carbon - Dynamic Client Registration Web Service - WSO2 Carbon - Dynamic Client Registration Web - war - - - - - maven-war-plugin - 2.2 - - ${project.artifactId} - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.18 - - - file:src/test/resources/log4j.properties - - - src/test/resources/testng.xml - - - - - - - - - - org.apache.ws.commons.axiom.wso2 - axiom - provided - - - org.apache.cxf - cxf-rt-frontend-jaxrs - provided - - - org.apache.cxf - cxf-rt-transports-http - provided - - - org.apache.cxf - cxf-rt-bindings-http - provided - - - org.apache.cxf - cxf-rt-rs-extension-providers - compile - - - org.apache.cxf - cxf-rt-ws-security - - - org.slf4j - slf4j-api - - - provided - - - org.testng - testng - provided - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.core - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.registration - provided - - - org.wso2.carbon - org.wso2.carbon.utils - provided - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.application.mgt - provided - - - org.apache.neethi.wso2 - neethi - - - org.apache.neethi - neethi - - - - - com.googlecode.json-simple.wso2 - json-simple - provided - - - - org.apache.neethi.wso2 - neethi - provided - - - org.apache.neethi - neethi - provided - - - - org.codehaus.jackson - jackson-jaxrs - - - com.google.code.gson - gson - provided - - - javax.ws.rs - jsr311-api - - - commons-logging - commons-logging - provided - - - - diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml deleted file mode 100644 index 6fb9229be92..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - dynamic-client-registration - org.wso2.carbon.devicemgt - 3.0.12-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.dynamic.client.registration - 3.0.12-SNAPSHOT - bundle - WSO2 Carbon - Dynamic client registration service - WSO2 Carbon - Dynamic Client Registration Service - http://wso2.org - - - - - org.apache.felix - maven-scr-plugin - - - org.apache.felix - maven-bundle-plugin - 1.4.0 - true - - - ${project.artifactId} - ${project.artifactId} - ${carbon.device.mgt.version} - Dynamic Client Registration Bundle - org.wso2.carbon.dynamic.client.registration.internal - - !org.wso2.carbon.dynamic.client.registration.internal, - org.wso2.carbon.dynamic.client.registration.* - - - org.apache.commons.logging, - org.json, - org.json.simple, - org.osgi.framework, - org.osgi.service.component, - org.wso2.carbon.context, - org.wso2.carbon.identity.application.*; version="${carbon.identity.imp.pkg.version}", - org.wso2.carbon.identity.base; version="${carbon.identity.imp.pkg.version}", - org.wso2.carbon.identity.oauth.*; version="${carbon.identity-inbound-auth-oauth.imp.pkg.version}", - org.wso2.carbon.identity.sso.saml.admin, - org.wso2.carbon.identity.sso.saml.dto, - org.wso2.carbon.registry.api, - org.wso2.carbon.registry.core, - org.wso2.carbon.utils.multitenancy - - - - - - - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - org.testng - testng - - - org.wso2.carbon - org.wso2.carbon.utils - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.application.mgt - - - org.wso2.carbon.identity.inbound.auth.oauth2 - org.wso2.carbon.identity.oauth - - - org.wso2.carbon.identity.inbound.auth.saml2 - org.wso2.carbon.identity.sso.saml - - - com.googlecode.json-simple.wso2 - json-simple - - - org.json.wso2 - json - - - diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml deleted file mode 100644 index 766aa947748..00000000000 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - dynamic-client-registration - org.wso2.carbon.devicemgt - 3.0.12-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.dynamic.client.web.app.registration - 3.0.12-SNAPSHOT - bundle - WSO2 Carbon - Dynamic client web app registration - WSO2 Carbon - Dynamic Client Web-app Registration Service - http://wso2.org - - - - - org.apache.felix - maven-scr-plugin - - - org.apache.felix - maven-bundle-plugin - 1.4.0 - true - - - ${project.artifactId} - ${project.artifactId} - ${carbon.device.mgt.version} - Dynamic Client Web App Registration Bundle - org.wso2.carbon.dynamic.client.web.app.registration.internal - - !org.wso2.carbon.dynamic.client.web.app.registration.internal, - org.wso2.carbon.dynamic.client.web.app.registration.* - - - javax.xml.bind.*, - com.google.*, - javax.net.ssl, - javax.servlet, - org.apache.axis2.context, - org.apache.catalina, - org.apache.catalina.core, - org.apache.commons.*, - org.apache.http, - org.apache.http.*, - org.osgi.framework, - org.osgi.service.component, - org.wso2.carbon.context, - org.wso2.carbon.core, - org.wso2.carbon.core.security, - org.wso2.carbon.dynamic.client.*, - org.wso2.carbon.registry.*, - org.wso2.carbon.user.*, - org.wso2.carbon.utils - - - - - - - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - org.testng - testng - - - org.wso2.carbon - org.wso2.carbon.utils - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.application.mgt - - - org.wso2.carbon.identity.inbound.auth.oauth2 - org.wso2.carbon.identity.oauth - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.core - - - org.wso2.tomcat - tomcat - - - org.wso2.tomcat - tomcat-servlet-api - - - org.wso2.carbon - org.wso2.carbon.logging - - - org.wso2.carbon - org.wso2.carbon.user.core - - - org.wso2.carbon - org.wso2.carbon.registry.core - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.registration - - - org.apache.httpcomponents - httpclient - - - com.google.code.gson - gson - - - diff --git a/components/identity-extensions/dynamic-client-registration/pom.xml b/components/identity-extensions/dynamic-client-registration/pom.xml deleted file mode 100644 index 6721339b4f4..00000000000 --- a/components/identity-extensions/dynamic-client-registration/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - org.wso2.carbon.devicemgt - identity-extensions - 3.0.12-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.devicemgt - dynamic-client-registration - 3.0.12-SNAPSHOT - pom - WSO2 Carbon - Dynamic client registration - http://wso2.org - - - dynamic-client-web - dynamic-client-web-proxy - org.wso2.carbon.dynamic.client.registration - org.wso2.carbon.dynamic.client.web.app.registration - - diff --git a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml deleted file mode 100644 index d9f07e6a0ed..00000000000 --- a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - org.wso2.carbon.devicemgt - dynamic-client-registration-feature - 3.0.12-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.dynamic.client.registration.server.feature - pom - 3.0.12-SNAPSHOT - WSO2 Carbon - Dynamic Client Registration Server Feature - http://wso2.org - This feature contains dynamic client registration features - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.registration - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.web.app.registration - - - com.googlecode.json-simple.wso2 - json-simple - - - org.json.wso2 - json - - - - - - - maven-resources-plugin - 2.6 - - - copy-resources - generate-resources - - copy-resources - - - src/main/resources - - - resources - - build.properties - p2.inf - - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.4 - - - copy - package - - copy - - - - - org.wso2.carbon.devicemgt - dynamic-client-web - ${carbon.device.mgt.version} - war - true - ${basedir}/src/main/resources/ - dynamic-client-web.war - - - - - - - - - org.wso2.maven - carbon-p2-plugin - ${carbon.p2.plugin.version} - - - p2-feature-generation - package - - p2-feature-gen - - - org.wso2.carbon.dynamic.client.registration.server - ../../../features/etc/feature.properties - - - org.wso2.carbon.p2.category.type:server - org.eclipse.equinox.p2.type.group:true - - - - - org.wso2.carbon.devicemgt:org.wso2.carbon.dynamic.client.registration:${carbon.device.mgt.version} - - - org.wso2.carbon.devicemgt:org.wso2.carbon.dynamic.client.web.app.registration:${carbon.device.mgt.version} - - - com.googlecode.json-simple.wso2:json-simple:${json-simple.version} - - - org.json.wso2:json:${commons-json.version} - - - - org.wso2.carbon.core.server:${carbon.kernel.version} - - - - - - - - - diff --git a/features/dynamic-client-registration/pom.xml b/features/dynamic-client-registration/pom.xml deleted file mode 100644 index 780be985624..00000000000 --- a/features/dynamic-client-registration/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - org.wso2.carbon.devicemgt - carbon-devicemgt - 3.0.12-SNAPSHOT - ../../pom.xml - - - 4.0.0 - org.wso2.carbon.devicemgt - dynamic-client-registration-feature - 3.0.12-SNAPSHOT - pom - WSO2 Carbon - Dynamic Client Registration Feature - http://wso2.org - - - org.wso2.carbon.dynamic.client.registration.server.feature - - - diff --git a/pom.xml b/pom.xml index de447314625..06c2f9f9923 100644 --- a/pom.xml +++ b/pom.xml @@ -214,43 +214,6 @@ org.wso2.carbon.apimgt.annotations ${carbon.device.mgt.version} - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.registration - ${carbon.device.mgt.version} - - - org.wso2.carbon.identity - org.wso2.carbon.identity.oauth - - - org.wso2.carbon.identity - org.wso2.carbon.identity.sso.saml - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - org.json.wso2 - json - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.dynamic.client.web.app.registration - ${carbon.device.mgt.version} - - - org.wso2.carbon.devicemgt - dynamic-client-web - ${carbon.device.mgt.version} - org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.oauth.extensions From c605ffbd5817f0dd236cf86d15462578bca22ea0 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Wed, 28 Jun 2017 17:56:50 +0530 Subject: [PATCH 3/3] Fixed issue wso2/product-iots#475 --- .../devicemgt/app/pages/cdmf.page.users/public/js/listing.js | 1 + .../units/cdmf.unit.ui.theme/public/css/custom-desktop.css | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js index 3dc809e73e5..c943c53f2d4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js @@ -82,6 +82,7 @@ $("a#invite-user-link").click(function () { usernameList, function () { modalDialog.header("User invitation email for enrollment was successfully sent."); + modalDialog.content(""); modalDialog.footer(''); $("a#invite-user-success-link").click(function () { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css index caf905a3dc3..016acfbfd95 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css @@ -6964,3 +6964,7 @@ header.header-default { padding: 8px 15px !important; line-height: 0px !important; } + +.header .fw-user{ + color: #333 !important; +}