mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Added identity-extensions
This commit is contained in:
parent
335f53f01c
commit
234cd47931
@ -26,6 +26,16 @@ public class Permission{
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String path;
|
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() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
|||||||
@ -114,19 +114,19 @@
|
|||||||
<parameter name="useGeneratedWSDLinJAXWS">${jaxwsparam}</parameter>
|
<parameter name="useGeneratedWSDLinJAXWS">${jaxwsparam}</parameter>
|
||||||
|
|
||||||
<!-- Deployer for the dataservice. -->
|
<!-- Deployer for the dataservice. -->
|
||||||
<!--<deployer extension="dbs" directory="dataservices" class="org.wso2.dataservices.DBDeployer"/>-->
|
<!--<deployer extensions="dbs" directory="dataservices" class="org.wso2.dataservices.DBDeployer"/>-->
|
||||||
|
|
||||||
<!-- Axis1 deployer for Axis2-->
|
<!-- Axis1 deployer for Axis2-->
|
||||||
<!--<deployer extension="wsdd" class="org.wso2.carbon.axis1services.Axis1Deployer" directory="axis1services"/>-->
|
<!--<deployer extensions="wsdd" class="org.wso2.carbon.axis1services.Axis1Deployer" directory="axis1services"/>-->
|
||||||
|
|
||||||
<!-- POJO service deployer for Jar -->
|
<!-- POJO service deployer for Jar -->
|
||||||
<!--<deployer extension="jar" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->
|
<!--<deployer extensions="jar" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->
|
||||||
|
|
||||||
<!-- POJO service deployer for Class -->
|
<!-- POJO service deployer for Class -->
|
||||||
<!--<deployer extension="class" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->
|
<!--<deployer extensions="class" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->
|
||||||
|
|
||||||
<!-- JAXWS service deployer -->
|
<!-- JAXWS service deployer -->
|
||||||
<!--<deployer extension=".jar" class="org.apache.axis2.jaxws.framework.JAXWSDeployer" directory="servicejars"/>-->
|
<!--<deployer extensions=".jar" class="org.apache.axis2.jaxws.framework.JAXWSDeployer" directory="servicejars"/>-->
|
||||||
<!-- ================================================= -->
|
<!-- ================================================= -->
|
||||||
<!-- Message Receivers -->
|
<!-- Message Receivers -->
|
||||||
<!-- ================================================= -->
|
<!-- ================================================= -->
|
||||||
|
|||||||
@ -481,7 +481,7 @@
|
|||||||
|
|
||||||
<!-- ===================== Default MIME Type Mappings =================== -->
|
<!-- ===================== Default MIME Type Mappings =================== -->
|
||||||
<!-- When serving static resources, Tomcat will automatically generate -->
|
<!-- When serving static resources, Tomcat will automatically generate -->
|
||||||
<!-- a "Content-Type" header based on the resource's filename extension, -->
|
<!-- a "Content-Type" header based on the resource's filename extensions, -->
|
||||||
<!-- based on these mappings. Additional mappings can be added here (to -->
|
<!-- based on these mappings. Additional mappings can be added here (to -->
|
||||||
<!-- apply to all web applications), or in your own application's web.xml -->
|
<!-- apply to all web applications), or in your own application's web.xml -->
|
||||||
<!-- deployment descriptor. -->
|
<!-- deployment descriptor. -->
|
||||||
@ -1003,7 +1003,7 @@
|
|||||||
</mime-mapping>
|
</mime-mapping>
|
||||||
<!--
|
<!--
|
||||||
<mime-mapping>
|
<mime-mapping>
|
||||||
<extension>shtml</extension>
|
<extensions>shtml</extensions>
|
||||||
<mime-type>text/x-server-parsed-html</mime-type>
|
<mime-type>text/x-server-parsed-html</mime-type>
|
||||||
</mime-mapping>
|
</mime-mapping>
|
||||||
-->
|
-->
|
||||||
|
|||||||
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.dynamic.client.registration.internal;
|
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.BundleActivator;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService;
|
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{
|
public class DynamicClientRegistrationBundleActivator implements BundleActivator{
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(DynamicClientRegistrationBundleActivator.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(BundleContext bundleContext) throws Exception {
|
public void start(BundleContext bundleContext) throws Exception {
|
||||||
DynamicClientRegistrationService dynamicClientRegistrationService =
|
DynamicClientRegistrationService dynamicClientRegistrationService =
|
||||||
@ -21,9 +21,9 @@
|
|||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>carbon-devicemgt</artifactId>
|
<artifactId>identity-extensions</artifactId>
|
||||||
<version>0.9.2-SNAPSHOT</version>
|
<version>0.9.2-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@ -31,32 +31,12 @@
|
|||||||
<artifactId>dynamic-client-registration</artifactId>
|
<artifactId>dynamic-client-registration</artifactId>
|
||||||
<version>0.9.2-SNAPSHOT</version>
|
<version>0.9.2-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>WSO2 Carbon - Dynamic Client Registration Component</name>
|
<name>WSO2 Carbon - Dynamic client registration</name>
|
||||||
<url>http://wso2.org</url>
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
<module>dynamic-client-web</module>
|
||||||
<module>org.wso2.carbon.dynamic.client.registration</module>
|
<module>org.wso2.carbon.dynamic.client.registration</module>
|
||||||
<module>org.wso2.carbon.dynamic.client.web.app.registration</module>
|
<module>org.wso2.carbon.dynamic.client.web.app.registration</module>
|
||||||
<module>dynamic-client-web</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<build>
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.felix</groupId>
|
|
||||||
<artifactId>maven-scr-plugin</artifactId>
|
|
||||||
<version>1.7.2</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>generate-scr-scrdescriptor</id>
|
|
||||||
<goals>
|
|
||||||
<goal>scr</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
</build>
|
|
||||||
</project>
|
</project>
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>identity-extensions</artifactId>
|
||||||
|
<version>0.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
|
||||||
|
<version>0.9.2-SNAPSHOT</version>
|
||||||
|
<packaging>bundle</packaging>
|
||||||
|
<name>WSO2 Carbon - OAuth Extensions</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.identity</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.user.core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.user.api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-scr-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-bundle-plugin</artifactId>
|
||||||
|
<version>1.4.0</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<instructions>
|
||||||
|
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||||
|
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||||
|
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||||
|
<Bundle-Description>OAuth Extensions Bundle</Bundle-Description>
|
||||||
|
<Private-Package>org.wso2.carbon.device.mgt.oauth.extensions.internal</Private-Package>
|
||||||
|
<Export-Package>
|
||||||
|
!org.wso2.carbon.device.mgt.oauth.extensions.internal,
|
||||||
|
org.wso2.carbon.device.mgt.oauth.extensions.*
|
||||||
|
</Export-Package>
|
||||||
|
<DynamicImport-Package>*</DynamicImport-Package>
|
||||||
|
</instructions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@ -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){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
42
components/identity-extensions/pom.xml
Normal file
42
components/identity-extensions/pom.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
|
<version>0.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>identity-extensions</artifactId>
|
||||||
|
<version>0.9.2-SNAPSHOT</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>WSO2 Carbon - Dynamic Client Registration Component</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>org.wso2.carbon.device.mgt.oauth.extensions</module>
|
||||||
|
<module>dynamic-client-registration</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -114,19 +114,19 @@
|
|||||||
<parameter name="useGeneratedWSDLinJAXWS">${jaxwsparam}</parameter>
|
<parameter name="useGeneratedWSDLinJAXWS">${jaxwsparam}</parameter>
|
||||||
|
|
||||||
<!-- Deployer for the dataservice. -->
|
<!-- Deployer for the dataservice. -->
|
||||||
<!--<deployer extension="dbs" directory="dataservices" class="org.wso2.dataservices.DBDeployer"/>-->
|
<!--<deployer extensions="dbs" directory="dataservices" class="org.wso2.dataservices.DBDeployer"/>-->
|
||||||
|
|
||||||
<!-- Axis1 deployer for Axis2-->
|
<!-- Axis1 deployer for Axis2-->
|
||||||
<!--<deployer extension="wsdd" class="org.wso2.carbon.axis1services.Axis1Deployer" directory="axis1services"/>-->
|
<!--<deployer extensions="wsdd" class="org.wso2.carbon.axis1services.Axis1Deployer" directory="axis1services"/>-->
|
||||||
|
|
||||||
<!-- POJO service deployer for Jar -->
|
<!-- POJO service deployer for Jar -->
|
||||||
<!--<deployer extension="jar" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->
|
<!--<deployer extensions="jar" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->
|
||||||
|
|
||||||
<!-- POJO service deployer for Class -->
|
<!-- POJO service deployer for Class -->
|
||||||
<!--<deployer extension="class" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->
|
<!--<deployer extensions="class" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->
|
||||||
|
|
||||||
<!-- JAXWS service deployer -->
|
<!-- JAXWS service deployer -->
|
||||||
<!--<deployer extension=".jar" class="org.apache.axis2.jaxws.framework.JAXWSDeployer" directory="servicejars"/>-->
|
<!--<deployer extensions=".jar" class="org.apache.axis2.jaxws.framework.JAXWSDeployer" directory="servicejars"/>-->
|
||||||
<!-- ================================================= -->
|
<!-- ================================================= -->
|
||||||
<!-- Message Receivers -->
|
<!-- Message Receivers -->
|
||||||
<!-- ================================================= -->
|
<!-- ================================================= -->
|
||||||
|
|||||||
@ -481,7 +481,7 @@
|
|||||||
|
|
||||||
<!-- ===================== Default MIME Type Mappings =================== -->
|
<!-- ===================== Default MIME Type Mappings =================== -->
|
||||||
<!-- When serving static resources, Tomcat will automatically generate -->
|
<!-- When serving static resources, Tomcat will automatically generate -->
|
||||||
<!-- a "Content-Type" header based on the resource's filename extension, -->
|
<!-- a "Content-Type" header based on the resource's filename extensions, -->
|
||||||
<!-- based on these mappings. Additional mappings can be added here (to -->
|
<!-- based on these mappings. Additional mappings can be added here (to -->
|
||||||
<!-- apply to all web applications), or in your own application's web.xml -->
|
<!-- apply to all web applications), or in your own application's web.xml -->
|
||||||
<!-- deployment descriptor. -->
|
<!-- deployment descriptor. -->
|
||||||
@ -1003,7 +1003,7 @@
|
|||||||
</mime-mapping>
|
</mime-mapping>
|
||||||
<!--
|
<!--
|
||||||
<mime-mapping>
|
<mime-mapping>
|
||||||
<extension>shtml</extension>
|
<extensions>shtml</extensions>
|
||||||
<mime-type>text/x-server-parsed-html</mime-type>
|
<mime-type>text/x-server-parsed-html</mime-type>
|
||||||
</mime-mapping>
|
</mime-mapping>
|
||||||
-->
|
-->
|
||||||
|
|||||||
@ -0,0 +1,87 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>oauth-extensions-feature</artifactId>
|
||||||
|
<version>0.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions.feature</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<version>0.9.2-SNAPSHOT</version>
|
||||||
|
<name>WSO2 Carbon - Device Mgt OAuth Extensions Feature</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
<description>This feature contains devicemgt related OAuth extensions</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.identity</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.wso2.maven</groupId>
|
||||||
|
<artifactId>carbon-p2-plugin</artifactId>
|
||||||
|
<version>${carbon.p2.plugin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>p2-feature-generation</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>p2-feature-gen</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<id>org.wso2.carbon.device.mgt.oauth.extensions</id>
|
||||||
|
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
|
||||||
|
<adviceFile>
|
||||||
|
<properties>
|
||||||
|
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
|
||||||
|
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
|
||||||
|
</properties>
|
||||||
|
</adviceFile>
|
||||||
|
<bundles>
|
||||||
|
<bundleDef>
|
||||||
|
org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.oauth.extensions:${carbon.device.mgt.version}
|
||||||
|
</bundleDef>
|
||||||
|
</bundles>
|
||||||
|
<importFeatures>
|
||||||
|
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
|
||||||
|
</importFeatureDef>
|
||||||
|
</importFeatures>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
41
features/oauth-extensions/pom.xml
Normal file
41
features/oauth-extensions/pom.xml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
|
<version>0.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>oauth-extensions-feature</artifactId>
|
||||||
|
<version>0.9.2-SNAPSHOT</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>WSO2 Carbon Device Management - OAuth Extensions Feature</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>org.wso2.carbon.device.mgt.oauth.extensions.feature</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
||||||
20
pom.xml
20
pom.xml
@ -17,7 +17,8 @@
|
|||||||
~ under the License.
|
~ under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@ -41,13 +42,14 @@
|
|||||||
<module>components/policy-mgt</module>
|
<module>components/policy-mgt</module>
|
||||||
<module>components/certificate-mgt</module>
|
<module>components/certificate-mgt</module>
|
||||||
<module>components/webapp-authenticator-framework</module>
|
<module>components/webapp-authenticator-framework</module>
|
||||||
<module>components/dynamic-client-registration</module>
|
<module>components/identity-extensions</module>
|
||||||
<module>features/device-mgt</module>
|
<module>features/device-mgt</module>
|
||||||
<module>features/apimgt-extensions</module>
|
<module>features/apimgt-extensions</module>
|
||||||
<module>features/policy-mgt</module>
|
<module>features/policy-mgt</module>
|
||||||
<module>features/webapp-authenticator-framework</module>
|
<module>features/webapp-authenticator-framework</module>
|
||||||
<module>features/certificate-mgt</module>
|
<module>features/certificate-mgt</module>
|
||||||
<module>features/dynamic-client-registration</module>
|
<module>features/dynamic-client-registration</module>
|
||||||
|
<module>features/oauth-extensions</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
@ -185,6 +187,17 @@
|
|||||||
<artifactId>dynamic-client-web</artifactId>
|
<artifactId>dynamic-client-web</artifactId>
|
||||||
<version>${carbon.device.mgt.version}</version>
|
<version>${carbon.device.mgt.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
|
||||||
|
<version>${carbon.device.mgt.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.wso2.carbon.identity</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
<!-- Device Management dependencies -->
|
<!-- Device Management dependencies -->
|
||||||
|
|
||||||
<!-- Governance dependencies -->
|
<!-- Governance dependencies -->
|
||||||
@ -1006,7 +1019,8 @@
|
|||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<url>https://github.com/wso2/carbon-device-mgt.git</url>
|
<url>https://github.com/wso2/carbon-device-mgt.git</url>
|
||||||
<developerConnection>scm:git:https://github.com/wso2/carbon-device-mgt.git</developerConnection>
|
<developerConnection>scm:git:https://github.com/wso2/carbon-device-mgt.git
|
||||||
|
</developerConnection>
|
||||||
<connection>scm:git:https://github.com/wso2/carbon-device-mgt.git</connection>
|
<connection>scm:git:https://github.com/wso2/carbon-device-mgt.git</connection>
|
||||||
<tag>HEAD</tag>
|
<tag>HEAD</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user