From 234cd47931c62d5f8b4158404561bf4d29501073 Mon Sep 17 00:00:00 2001 From: harshanl Date: Fri, 2 Oct 2015 18:00:05 +0530 Subject: [PATCH] Added identity-extensions --- .../core/config/permission/Permission.java | 10 +++ .../repository/conf/axis2/axis2.xml | 10 +-- .../repository/conf/tomcat/web.xml | 4 +- .../dynamic-client-web/pom.xml | 0 .../client/web/ConfigurationService.java | 0 .../dynamic/client/web/DynamicClientUtil.java | 0 .../client/web/FaultMessageBodyWriter.java | 0 .../dynamic/client/web/FaultResponse.java | 0 .../client/web/RegistrationResponse.java | 0 .../client/web/RegistrationService.java | 0 .../web/impl/ConfigurationServiceImpl.java | 0 .../web/impl/RegistrationServiceImpl.java | 0 .../webapp/META-INF/webapp-classloading.xml | 0 .../src/main/webapp/WEB-INF/cxf-servlet.xml | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../src/main/webapp/servicelist.css | 0 .../src/test/resources/log4j.properties | 0 .../src/test/resources/testng.xml | 0 .../pom.xml | 0 .../registration/ApplicationConstants.java | 0 .../DynamicClientRegistrationException.java | 0 .../DynamicClientRegistrationService.java | 0 .../registration/OAuthApplicationInfo.java | 0 .../impl/DynamicClientRegistrationImpl.java | 0 ...amicClientRegistrationBundleActivator.java | 4 + .../profile/RegistrationProfile.java | 0 .../pom.xml | 0 .../DynamicRegistrationManager.java | 0 .../client/web/app/registration/OAuthApp.java | 0 .../web/app/registration/OAuthSettings.java | 0 .../DynamicClientRegistrationDataHolder.java | 0 ...entWebAppRegistrationServiceComponent.java | 0 ...ientWebAppDeploymentLifecycleListener.java | 0 .../DynamicClientRegistrationConstants.java | 0 .../DynamicClientWebAppRegistrationUtil.java | 0 .../dynamic-client-registration/pom.xml | 28 +----- .../pom.xml | 79 +++++++++++++++++ .../extensions/OAuthExtensionsUtils.java | 63 ++++++++++++++ .../DeviceMgtOAuthCallbackHandler.java | 62 +++++++++++++ .../OAuthExtensionServiceComponent.java | 77 ++++++++++++++++ .../internal/OAuthExtensionsDataHolder.java | 45 ++++++++++ .../validators/OAuth2TokenValidator.java | 36 ++++++++ .../extensions/validators/ScopeValidator.java | 36 ++++++++ components/identity-extensions/pom.xml | 42 +++++++++ .../repository/conf/axis2/axis2.xml | 10 +-- .../repository/conf/tomcat/web.xml | 4 +- .../pom.xml | 87 +++++++++++++++++++ features/oauth-extensions/pom.xml | 41 +++++++++ pom.xml | 28 ++++-- 49 files changed, 621 insertions(+), 45 deletions(-) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/pom.xml (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/ConfigurationService.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultMessageBodyWriter.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultResponse.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationResponse.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationService.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/ConfigurationServiceImpl.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/RegistrationServiceImpl.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/webapp/META-INF/webapp-classloading.xml (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/cxf-servlet.xml (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/web.xml (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/main/webapp/servicelist.css (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/test/resources/log4j.properties (100%) rename components/{ => identity-extensions}/dynamic-client-registration/dynamic-client-web/src/test/resources/testng.xml (100%) rename components/{ => identity-extensions}/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml (100%) rename components/{ => identity-extensions}/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/ApplicationConstants.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationException.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationService.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/OAuthApplicationInfo.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationImpl.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationBundleActivator.java (89%) rename components/{ => identity-extensions}/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/profile/RegistrationProfile.java (100%) rename components/{ => identity-extensions}/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml (100%) rename 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/DynamicRegistrationManager.java (100%) rename 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/OAuthApp.java (100%) rename 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/OAuthSettings.java (100%) rename 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/DynamicClientRegistrationDataHolder.java (100%) rename 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 (100%) rename 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 (100%) rename 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/DynamicClientRegistrationConstants.java (100%) rename 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 (100%) rename components/{ => identity-extensions}/dynamic-client-registration/pom.xml (64%) create mode 100644 components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml create mode 100644 components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/OAuthExtensionsUtils.java create mode 100644 components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/DeviceMgtOAuthCallbackHandler.java create mode 100644 components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java create mode 100644 components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionsDataHolder.java create mode 100644 components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/OAuth2TokenValidator.java create mode 100644 components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/ScopeValidator.java create mode 100644 components/identity-extensions/pom.xml create mode 100644 features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml create mode 100644 features/oauth-extensions/pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/Permission.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/Permission.java index 76810771b8..ca5f79caf1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/Permission.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/Permission.java @@ -26,6 +26,16 @@ public class Permission{ private String name; private String path; + private String scope; + + public String getScope() { + return scope; + } + + @XmlElement(name = "scope", required = true) + public void setScope(String scope) { + this.scope = scope; + } public String getName() { return name; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml index a6c5a03057..0f0822fa02 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml @@ -114,19 +114,19 @@ ${jaxwsparam} - + - + - + - + - + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/tomcat/web.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/tomcat/web.xml index 33e1518b67..d4241ef741 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/tomcat/web.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/tomcat/web.xml @@ -481,7 +481,7 @@ - + @@ -1003,7 +1003,7 @@ diff --git a/components/dynamic-client-registration/dynamic-client-web/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/pom.xml rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml diff --git a/components/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/ConfigurationService.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/ConfigurationService.java similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/ConfigurationService.java rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/ConfigurationService.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultMessageBodyWriter.java rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultMessageBodyWriter.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultResponse.java rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/FaultResponse.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationResponse.java rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationResponse.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationService.java rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/RegistrationService.java diff --git a/components/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/ConfigurationServiceImpl.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/ConfigurationServiceImpl.java similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/ConfigurationServiceImpl.java rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/ConfigurationServiceImpl.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/RegistrationServiceImpl.java rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/impl/RegistrationServiceImpl.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/webapp/META-INF/webapp-classloading.xml rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/META-INF/webapp-classloading.xml diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/cxf-servlet.xml rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/cxf-servlet.xml diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/web.xml rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/WEB-INF/web.xml diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/main/webapp/servicelist.css rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/webapp/servicelist.css diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/test/resources/log4j.properties rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/test/resources/log4j.properties diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/dynamic-client-web/src/test/resources/testng.xml rename to components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/test/resources/testng.xml diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml rename to components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml diff --git a/components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/ApplicationConstants.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/ApplicationConstants.java similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/ApplicationConstants.java rename to components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/ApplicationConstants.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationException.java rename to components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationException.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationService.java rename to components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/DynamicClientRegistrationService.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/OAuthApplicationInfo.java rename to components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/OAuthApplicationInfo.java diff --git a/components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationImpl.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationImpl.java similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationImpl.java rename to components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationImpl.java diff --git a/components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationBundleActivator.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationBundleActivator.java similarity index 89% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationBundleActivator.java rename to components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationBundleActivator.java index e3ae13e4df..a5ba8ecb2b 100644 --- a/components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationBundleActivator.java +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationBundleActivator.java @@ -18,6 +18,8 @@ package org.wso2.carbon.dynamic.client.registration.internal; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService; @@ -28,6 +30,8 @@ import org.wso2.carbon.dynamic.client.registration.impl.DynamicClientRegistratio */ public class DynamicClientRegistrationBundleActivator implements BundleActivator{ + private static final Log log = LogFactory.getLog(DynamicClientRegistrationBundleActivator.class); + @Override public void start(BundleContext bundleContext) throws Exception { DynamicClientRegistrationService dynamicClientRegistrationService = diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/profile/RegistrationProfile.java rename to components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/profile/RegistrationProfile.java diff --git a/components/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 similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml rename to components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml diff --git a/components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicRegistrationManager.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/DynamicRegistrationManager.java similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicRegistrationManager.java rename to 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/DynamicRegistrationManager.java diff --git a/components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/OAuthApp.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/OAuthApp.java similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/OAuthApp.java rename to 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/OAuthApp.java diff --git a/components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/OAuthSettings.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/OAuthSettings.java similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/OAuthSettings.java rename to 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/OAuthSettings.java diff --git a/components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/internal/DynamicClientRegistrationDataHolder.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/DynamicClientRegistrationDataHolder.java similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/internal/DynamicClientRegistrationDataHolder.java rename to 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/DynamicClientRegistrationDataHolder.java diff --git a/components/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 similarity index 100% rename from components/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 rename to 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 diff --git a/components/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 similarity index 100% rename from components/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 rename to 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 diff --git a/components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientRegistrationConstants.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/DynamicClientRegistrationConstants.java similarity index 100% rename from components/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientRegistrationConstants.java rename to 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/DynamicClientRegistrationConstants.java diff --git a/components/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 similarity index 100% rename from components/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 rename to 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 diff --git a/components/dynamic-client-registration/pom.xml b/components/identity-extensions/dynamic-client-registration/pom.xml similarity index 64% rename from components/dynamic-client-registration/pom.xml rename to components/identity-extensions/dynamic-client-registration/pom.xml index 95cd219a42..e568ea5e88 100644 --- a/components/dynamic-client-registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/pom.xml @@ -21,9 +21,9 @@ org.wso2.carbon.devicemgt - carbon-devicemgt + identity-extensions 0.9.2-SNAPSHOT - ../../pom.xml + ../pom.xml 4.0.0 @@ -31,32 +31,12 @@ dynamic-client-registration 0.9.2-SNAPSHOT pom - WSO2 Carbon - Dynamic Client Registration Component + WSO2 Carbon - Dynamic client registration http://wso2.org + dynamic-client-web org.wso2.carbon.dynamic.client.registration org.wso2.carbon.dynamic.client.web.app.registration - dynamic-client-web - - - - - - org.apache.felix - maven-scr-plugin - 1.7.2 - - - generate-scr-scrdescriptor - - scr - - - - - - - diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml new file mode 100644 index 0000000000..0e663bf144 --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -0,0 +1,79 @@ + + + + + + + org.wso2.carbon.devicemgt + identity-extensions + 0.9.2-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.oauth.extensions + 0.9.2-SNAPSHOT + bundle + WSO2 Carbon - OAuth Extensions + http://wso2.org + + + + org.wso2.carbon.identity + org.wso2.carbon.identity.oauth + + + org.wso2.carbon + org.wso2.carbon.user.core + + + org.wso2.carbon + org.wso2.carbon.user.api + + + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${carbon.device.mgt.version} + OAuth Extensions Bundle + org.wso2.carbon.device.mgt.oauth.extensions.internal + + !org.wso2.carbon.device.mgt.oauth.extensions.internal, + org.wso2.carbon.device.mgt.oauth.extensions.* + + * + + + + + + diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/OAuthExtensionsUtils.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/OAuthExtensionsUtils.java new file mode 100644 index 0000000000..2356a6affa --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/OAuthExtensionsUtils.java @@ -0,0 +1,63 @@ +/* + * 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.device.mgt.oauth.extensions; + +import org.wso2.carbon.device.mgt.oauth.extensions.internal.OAuthExtensionsDataHolder; +import org.wso2.carbon.user.api.AuthorizationManager; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.api.UserStoreManager; +import org.wso2.carbon.user.core.service.RealmService; + +/** + * Created by harshan on 10/2/15. + */ +public class OAuthExtensionsUtils { + + public static void getRolePermissions(String role){ + RealmService realmService = OAuthExtensionsDataHolder.getInstance().getRealmService(); + try { + int tenantId = realmService.getTenantManager().getTenantId("tenant-domain"); + AuthorizationManager + authorizationManager = realmService.getTenantUserRealm(tenantId).getAuthorizationManager(); + // authorizationManager.is + } catch (UserStoreException e) { + e.printStackTrace(); + } + } + + public static void getUserPermissions(String userName){ + + } + + public static String[] getUserRoles(String userName){ + RealmService realmService = OAuthExtensionsDataHolder.getInstance().getRealmService(); + try { + int tenantId = realmService.getTenantManager().getTenantId("tenant-domain"); + UserStoreManager userStoreManager = realmService.getTenantUserRealm(tenantId).getUserStoreManager(); + return userStoreManager.getRoleListOfUser(userName); + } catch (UserStoreException e) { + e.printStackTrace(); + } + return new String[0]; + } + + public static void getScopePermissions(String scopeKey){ + + } +} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/DeviceMgtOAuthCallbackHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/DeviceMgtOAuthCallbackHandler.java new file mode 100644 index 0000000000..b8dcd71927 --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/DeviceMgtOAuthCallbackHandler.java @@ -0,0 +1,62 @@ +/* + * 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.device.mgt.oauth.extensions.handlers; + +import org.wso2.carbon.identity.oauth.callback.AbstractOAuthCallbackHandler; +import org.wso2.carbon.identity.oauth.callback.OAuthCallback; +import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.UnsupportedCallbackException; +import java.io.IOException; + +/** + * Created by harshan on 10/1/15. + */ +public class DeviceMgtOAuthCallbackHandler extends AbstractOAuthCallbackHandler { + + @Override + public boolean canHandle(Callback[] callbacks) throws IdentityOAuth2Exception { + return true; + } + + @Override + public void handle(Callback[] callbacks) + throws IOException, UnsupportedCallbackException { + if (callbacks != null && callbacks.length > 0){ + OAuthCallback oauthCallback = (OAuthCallback) callbacks[0]; + if (OAuthCallback.OAuthCallbackType.ACCESS_DELEGATION_AUTHZ.equals( + oauthCallback.getCallbackType())){ + oauthCallback.setAuthorized(true); + } else if (OAuthCallback.OAuthCallbackType.ACCESS_DELEGATION_TOKEN.equals( + oauthCallback.getCallbackType())){ + oauthCallback.setAuthorized(true); + } else if (OAuthCallback.OAuthCallbackType.SCOPE_VALIDATION_AUTHZ.equals( + oauthCallback.getCallbackType())){ + oauthCallback.setValidScope(true); + } else if (OAuthCallback.OAuthCallbackType.SCOPE_VALIDATION_TOKEN.equals( + oauthCallback.getCallbackType())){ + String[] scopes = oauthCallback.getRequestedScope(); + oauthCallback.setApprovedScope(scopes); + oauthCallback.setValidScope(true); + } + } + + } +} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java new file mode 100644 index 0000000000..9f13ec4ef3 --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java @@ -0,0 +1,77 @@ +/* + * 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.device.mgt.oauth.extensions.internal; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.service.component.ComponentContext; +import org.wso2.carbon.user.core.service.RealmService; + +/** + * @scr.component name="org.wso2.carbon.device.mgt.oauth.extensions" immediate="true" + * @scr.reference name="user.realmservice.default" + * interface="org.wso2.carbon.user.core.service.RealmService" + * cardinality="1..1" + * policy="dynamic" + * bind="setRealmService" + * unbind="unsetRealmService" + */ +public class OAuthExtensionServiceComponent { + + private static final Log log = LogFactory.getLog(OAuthExtensionServiceComponent.class); + + @SuppressWarnings("unused") + protected void activate(ComponentContext componentContext) { + if(log.isDebugEnabled()){ + log.debug("Starting OAuthExtensionBundle"); + } + } + + @SuppressWarnings("unused") + protected void deactivate(ComponentContext componentContext) { + if(log.isDebugEnabled()){ + log.debug("Stopping OAuthExtensionBundle"); + } + } + + /** + * Sets Realm Service. + * + * @param realmService An instance of RealmService + */ + protected void setRealmService(RealmService realmService) { + if (log.isDebugEnabled()) { + log.debug("Setting Realm Service"); + } + OAuthExtensionsDataHolder.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"); + } + OAuthExtensionsDataHolder.getInstance().setRealmService(null); + } + +} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionsDataHolder.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionsDataHolder.java new file mode 100644 index 0000000000..b0eed80a3f --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/internal/OAuthExtensionsDataHolder.java @@ -0,0 +1,45 @@ +/* + * 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.device.mgt.oauth.extensions.internal; + +import org.wso2.carbon.user.core.service.RealmService; + +/** + * Created by harshan on 10/2/15. + */ +public class OAuthExtensionsDataHolder { + + private RealmService realmService; + + private static OAuthExtensionsDataHolder thisInstance = new OAuthExtensionsDataHolder(); + + private OAuthExtensionsDataHolder() {} + + public static OAuthExtensionsDataHolder getInstance() { + return thisInstance; + } + + public RealmService getRealmService() { + return realmService; + } + + public void setRealmService(RealmService realmService) { + this.realmService = realmService; + } +} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/OAuth2TokenValidator.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/OAuth2TokenValidator.java new file mode 100644 index 0000000000..d5393a59d0 --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/OAuth2TokenValidator.java @@ -0,0 +1,36 @@ +/* + * 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.device.mgt.oauth.extensions.validators; + +import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; +import org.wso2.carbon.identity.oauth2.validators.DefaultOAuth2TokenValidator; +import org.wso2.carbon.identity.oauth2.validators.OAuth2TokenValidationMessageContext; + +/** + * OAuth2 Token validator implementation which supports custom token validation logic specific + * to MDM. + */ +public class OAuth2TokenValidator extends DefaultOAuth2TokenValidator { + + @Override + public boolean validateAccessToken( + OAuth2TokenValidationMessageContext validationReqDTO) throws IdentityOAuth2Exception { + return true; + } +} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/ScopeValidator.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/ScopeValidator.java new file mode 100644 index 0000000000..5fc0da4af1 --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/ScopeValidator.java @@ -0,0 +1,36 @@ +/* + * 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.device.mgt.oauth.extensions.validators; + +import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; +import org.wso2.carbon.identity.oauth2.model.AccessTokenDO; +import org.wso2.carbon.identity.oauth2.validators.OAuth2ScopeValidator; + +/** + * Created by harshan on 10/1/15. + */ +public class ScopeValidator extends OAuth2ScopeValidator { + + @Override + public boolean validateScope(AccessTokenDO accessTokenDO, String resource) + throws IdentityOAuth2Exception { + //Call Milan's permission logic + return true; + } +} diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml new file mode 100644 index 0000000000..78a24d9adb --- /dev/null +++ b/components/identity-extensions/pom.xml @@ -0,0 +1,42 @@ + + + + + + + org.wso2.carbon.devicemgt + carbon-devicemgt + 0.9.2-SNAPSHOT + ../../pom.xml + + + 4.0.0 + org.wso2.carbon.devicemgt + identity-extensions + 0.9.2-SNAPSHOT + pom + WSO2 Carbon - Dynamic Client Registration Component + http://wso2.org + + + org.wso2.carbon.device.mgt.oauth.extensions + dynamic-client-registration + + + diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml index a6c5a03057..0f0822fa02 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml @@ -114,19 +114,19 @@ ${jaxwsparam} - + - + - + - + - + diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/tomcat/web.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/tomcat/web.xml index 33e1518b67..d4241ef741 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/tomcat/web.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/tomcat/web.xml @@ -481,7 +481,7 @@ - + @@ -1003,7 +1003,7 @@ diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml new file mode 100644 index 0000000000..b75edcb2d3 --- /dev/null +++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml @@ -0,0 +1,87 @@ + + + + + + + + org.wso2.carbon.devicemgt + oauth-extensions-feature + 0.9.2-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.oauth.extensions.feature + pom + 0.9.2-SNAPSHOT + WSO2 Carbon - Device Mgt OAuth Extensions Feature + http://wso2.org + This feature contains devicemgt related OAuth extensions + + + + org.wso2.carbon.identity + org.wso2.carbon.identity.oauth + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.oauth.extensions + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.device.mgt.oauth.extensions + ../../../features/etc/feature.properties + + + org.wso2.carbon.p2.category.type:server + org.eclipse.equinox.p2.type.group:false + + + + + org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.oauth.extensions:${carbon.device.mgt.version} + + + + org.wso2.carbon.core.server:${carbon.kernel.version} + + + + + + + + + diff --git a/features/oauth-extensions/pom.xml b/features/oauth-extensions/pom.xml new file mode 100644 index 0000000000..cca949ed19 --- /dev/null +++ b/features/oauth-extensions/pom.xml @@ -0,0 +1,41 @@ + + + + + + + org.wso2.carbon.devicemgt + carbon-devicemgt + 0.9.2-SNAPSHOT + ../../pom.xml + + + 4.0.0 + org.wso2.carbon.devicemgt + oauth-extensions-feature + 0.9.2-SNAPSHOT + pom + WSO2 Carbon Device Management - OAuth Extensions Feature + http://wso2.org + + + org.wso2.carbon.device.mgt.oauth.extensions.feature + + + diff --git a/pom.xml b/pom.xml index ce2f4a193f..835faf5c47 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,8 @@ ~ under the License. --> - 4.0.0 @@ -37,17 +38,18 @@ components/device-mgt - components/apimgt-extensions + components/apimgt-extensions components/policy-mgt components/certificate-mgt components/webapp-authenticator-framework - components/dynamic-client-registration + components/identity-extensions features/device-mgt features/apimgt-extensions - features/policy-mgt + features/policy-mgt features/webapp-authenticator-framework features/certificate-mgt features/dynamic-client-registration + features/oauth-extensions @@ -185,6 +187,17 @@ dynamic-client-web ${carbon.device.mgt.version} + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.oauth.extensions + ${carbon.device.mgt.version} + + + org.wso2.carbon.identity + org.wso2.carbon.identity.oauth + + + @@ -370,8 +383,8 @@ bcprov-jdk15on - - + + org.wso2.carbon @@ -1006,7 +1019,8 @@ https://github.com/wso2/carbon-device-mgt.git - scm:git:https://github.com/wso2/carbon-device-mgt.git + scm:git:https://github.com/wso2/carbon-device-mgt.git + scm:git:https://github.com/wso2/carbon-device-mgt.git HEAD