Adding the initial implementation of dynamic client registration

revert-70aa11f8
prabathabey 9 years ago
parent 3c5a3adc2f
commit 6cdd122c97

@ -118,8 +118,41 @@
<artifactId>org.wso2.carbon.device.mgt.core</artifactId> <artifactId>org.wso2.carbon.device.mgt.core</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity</groupId>
<artifactId>org.wso2.carbon.identity.application.mgt</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.keymgt.client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity</groupId>
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple.wso2</groupId>
<artifactId>json-simple</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -0,0 +1,50 @@
/*
* 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.identity.oauth.extension;
public class ApplicationConstants {
public static final String OAUTH_CLIENT_ID = "client_id"; //this means consumer key
public static final String OAUTH_CLIENT_SECRET = "client_secret";
public static final String OAUTH_REDIRECT_URIS = "redirect_uris";
public static final String OAUTH_CALLBACK_URIS = "callback_url";
public static final String OAUTH_CLIENT_NAME = "client_name";
public static final String OAUTH_CLIENT_TYPE = "client_type";
public static final String APP_KEY_TYPE = "key_type";
public static final String APP_CALLBACK_URL = "callback_url";
public static final String APP_HOME_PAGE = "homepage";
public static final String OAUTH_CLIENT_CONTACT = "contact";
public static final String APP_LOGOURI = "logouri";
public static final String OAUTH_CLIENT_SCOPE = "scope";
public static final String OAUTH_CLIENT_GRANT = "grant_types";
public static final String OAUTH_CLIENT_RESPONSETYPE = "response_types";
public static final String OAUTH_CLIENT_AUTHMETHOD = "token_endpoint_auth_method";
public static final String OAUTH_CLIENT_REGISTRATION_CLIENT_URI = "registration_client_uri";
public static final String OAUTH_CLIENT_REGISTRATION_ACCESSTOKEN = "registration_access_token";
public static final String OAUTH_CLIENT_CONTACTS = "contacts";
public static final String OAUTH_CLIENT_MANUAL = "MANUAL";
public static final String OAUTH_CLIENT_PRODUCTION = "PRODUCTION";
public static final String OAUTH_CLIENT_SANDBOX = "SANDBOX";
public static final String OAUTH_CLIENT_NOACCESSTOKEN = "NO ACCESS TOKEN";
public static final String OAUTH_CLIENT_JSONPARAMSTRING = "jsonParams";
public static final String OAUTH_CLIENT_USERNAME = "username";
public static final String OAUTH_CLIENT_APPLICATION = "application";
public static final String VALIDITY_PERIOD = "validityPeriod";
}

@ -0,0 +1,104 @@
/*
* 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.identity.oauth.extension;
import org.json.simple.JSONObject;
import java.util.HashMap;
import java.util.Map;
public class OAuthApplicationInfo {
private String clientId;
private String clientName;
private String callBackURL;
private String clientSecret;
private Map<String,Object> parameters = new HashMap<String, Object>();
/**
* get client Id (consumer id)
* @return clientId
*/
public String getClientId() {
return clientId;
}
/**
* set client Id
* @param clientId
*/
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getClientSecret() {
return clientSecret;
}
public void setClientSecret(String clientSecret) {
this.clientSecret = clientSecret;
}
/**
* Set client Name of OAuthApplication.
* @param clientName
*/
public void setClientName(String clientName){
this.clientName = clientName;
}
/**
* Set callback URL of OAuthapplication.
* @param callBackURL
*/
public void setCallBackURL(String callBackURL){
this.callBackURL = callBackURL;
}
public void addParameter(String name,Object value){
parameters.put(name,value);
}
public Object getParameter(String name){
return parameters.get(name);
}
public String getJsonString(){
return JSONObject.toJSONString(parameters);
}
public String getClientName(){
return clientName;
}
public String getCallBackURL(){
return callBackURL;
}
public void putAll(Map<String,Object> parameters){
this.parameters.putAll(parameters);
}
public void removeParameter(String key){
this.parameters.remove(key);
}
}

@ -0,0 +1,134 @@
/*
* 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.identity.oauth.extension;
import javax.ws.rs.core.Request;
public class RegistrationProfile {
private String applicationType;
private String[] redirectUris;
private String clientName;
private String logoUri;
private String subjectType;
private String sectorIdentifierUri;
private String tokenEndpointAuthMethod;
private String jwksUri;
private String userInfoEncryptedResponseAlg;
private String userInfoEncryptedResponseEnc;
private String[] contacts;
private String[] requestUris;
public String getApplicationType() {
return applicationType;
}
public void setApplicationType(String applicationType) {
this.applicationType = applicationType;
}
public String[] getRedirectUris() {
return redirectUris;
}
public void setRedirectUris(String[] redirectUris) {
this.redirectUris = redirectUris;
}
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public String getLogoUri() {
return logoUri;
}
public void setLogoUri(String logoUri) {
this.logoUri = logoUri;
}
public String getSubjectType() {
return subjectType;
}
public void setSubjectType(String subjectType) {
this.subjectType = subjectType;
}
public String getSectorIdentifierUri() {
return sectorIdentifierUri;
}
public void setSectorIdentifierUri(String sectorIdentifierUri) {
this.sectorIdentifierUri = sectorIdentifierUri;
}
public String getTokenEndpointAuthMethod() {
return tokenEndpointAuthMethod;
}
public void setTokenEndpointAuthMethod(String tokenEndpointAuthMethod) {
this.tokenEndpointAuthMethod = tokenEndpointAuthMethod;
}
public String getJwksUri() {
return jwksUri;
}
public void setJwksUri(String jwksUri) {
this.jwksUri = jwksUri;
}
public String getUserInfoEncryptedResponseAlg() {
return userInfoEncryptedResponseAlg;
}
public void setUserInfoEncryptedResponseAlg(String userInfoEncryptedResponseAlg) {
this.userInfoEncryptedResponseAlg = userInfoEncryptedResponseAlg;
}
public String getUserInfoEncryptedResponseEnc() {
return userInfoEncryptedResponseEnc;
}
public void setUserInfoEncryptedResponseEnc(String userInfoEncryptedResponseEnc) {
this.userInfoEncryptedResponseEnc = userInfoEncryptedResponseEnc;
}
public String[] getContacts() {
return contacts;
}
public void setContacts(String[] contacts) {
this.contacts = contacts;
}
public String[] getRequestUris() {
return requestUris;
}
public void setRequestUris(String[] requestUris) {
this.requestUris = requestUris;
}
}

@ -0,0 +1,41 @@
/*
* 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.identity.oauth.extension;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
public class RegistrationResponse extends Response {
@Override
public Object getEntity() {
return null;
}
@Override
public int getStatus() {
return 0;
}
@Override
public MultivaluedMap<String, Object> getMetadata() {
return null;
}
}

@ -23,16 +23,14 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Path("/connect")
public interface RegistrationService { public interface RegistrationService {
@POST @POST
@Path("/register") @Path("/register")
Response register(Request request); Response register(RegistrationProfile profile);
} }

@ -0,0 +1,235 @@
/*
* 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.identity.oauth.extension.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.simple.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
import org.wso2.carbon.apimgt.keymgt.client.SubscriberKeyMgtClient;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException;
import org.wso2.carbon.identity.application.common.model.InboundAuthenticationConfig;
import org.wso2.carbon.identity.application.common.model.InboundAuthenticationRequestConfig;
import org.wso2.carbon.identity.application.common.model.Property;
import org.wso2.carbon.identity.application.common.model.ServiceProvider;
import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
import org.wso2.carbon.identity.base.IdentityException;
import org.wso2.carbon.identity.oauth.OAuthAdminService;
import org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO;
import org.wso2.carbon.identity.oauth.extension.*;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
import javax.ws.rs.core.Response;
public class ClientRegistrationServiceImpl implements RegistrationService {
private static final Log log = LogFactory.getLog(ClientRegistrationServiceImpl.class);
@Override
public Response register(RegistrationProfile profile) {
try {
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(
MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID);
OAuthApplicationInfo info = this.registerApplication(profile);
return Response.status(Response.Status.ACCEPTED).entity(info.getJsonString()).build();
} catch (APIManagementException e) {
String msg = "Error occurred while registering client '" + profile.getClientName() + "'";
log.error(msg, e);
return Response.serverError().entity(msg).build();
} finally {
PrivilegedCarbonContext.endTenantFlow();
}
}
private OAuthApplicationInfo registerApplication(RegistrationProfile profile) throws APIManagementException {
//OAuthApplications are created by calling to APIKeyMgtSubscriber Service
SubscriberKeyMgtClient keyMgtClient = APIUtil.getKeyManagementClient();
OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo();
//Subscriber's name should be passed as a parameter, since it's under the subscriber the OAuth App is created.
String userId = (String) oAuthApplicationInfo.getParameter(ApplicationConstants.OAUTH_CLIENT_USERNAME);
String applicationName = profile.getClientName();
if (log.isDebugEnabled()) {
log.debug("Trying to create OAuth application :" + applicationName);
}
String callBackURL = "";
if (oAuthApplicationInfo.getParameter("callback_url") != null) {
JSONArray jsonArray = (JSONArray) oAuthApplicationInfo.getParameter("callback_url");
for (Object callbackUrlObject : jsonArray) {
callBackURL = (String) callbackUrlObject;
}
}
String tokenScope = (String) oAuthApplicationInfo.getParameter("tokenScope");
String tokenScopes[] = new String[1];
tokenScopes[0] = tokenScope;
oAuthApplicationInfo.addParameter("tokenScope", tokenScopes);
OAuthApplicationInfo info;
try {
info = this.createOAuthApplication(userId, applicationName, callBackURL);
} catch (Exception e) {
throw new APIManagementException("Can not create OAuth application : " + applicationName, e);
}
if (info == null || info.getJsonString() == null) {
throw new APIManagementException("OAuth app does not contain required data: '" + applicationName + "'");
}
oAuthApplicationInfo.setClientName(info.getClientName());
oAuthApplicationInfo.setClientId(info.getClientId());
oAuthApplicationInfo.setCallBackURL(info.getCallBackURL());
oAuthApplicationInfo.setClientSecret(info.getClientSecret());
try {
JSONObject jsonObject = new JSONObject(info.getJsonString());
if (jsonObject.has(ApplicationConstants.OAUTH_REDIRECT_URIS)) {
oAuthApplicationInfo.addParameter(ApplicationConstants.OAUTH_REDIRECT_URIS, jsonObject.get(ApplicationConstants.OAUTH_REDIRECT_URIS));
}
if (jsonObject.has(ApplicationConstants.OAUTH_CLIENT_NAME)) {
oAuthApplicationInfo.addParameter(ApplicationConstants.
OAUTH_CLIENT_NAME, jsonObject.get(ApplicationConstants.OAUTH_CLIENT_NAME));
}
if (jsonObject.has(ApplicationConstants.OAUTH_CLIENT_GRANT)) {
oAuthApplicationInfo.addParameter(ApplicationConstants.
OAUTH_CLIENT_GRANT, jsonObject.get(ApplicationConstants.OAUTH_CLIENT_GRANT));
}
} catch (JSONException e) {
throw new APIManagementException("Can not retrieve information of the created OAuth application", e);
}
return oAuthApplicationInfo;
}
public OAuthApplicationInfo createOAuthApplication(
String userId, String applicationName, String callbackUrl) throws APIManagementException, IdentityException {
if (userId == null || userId.isEmpty()) {
return null;
}
String tenantDomain = MultitenantUtils.getTenantDomain(userId);
String baseUser = CarbonContext.getThreadLocalCarbonContext().getUsername();
String userName = MultitenantUtils.getTenantAwareUsername(userId);
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true);
// Acting as the provided user. When creating Service Provider/OAuth App,
// username is fetched from CarbonContext
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(userName);
try {
// Append the username before Application name to make application name unique across two users.
applicationName = userName + "_" + applicationName;
// Create the Service Provider
ServiceProvider serviceProvider = new ServiceProvider();
serviceProvider.setApplicationName(applicationName);
serviceProvider.setDescription("Service Provider for application " + applicationName);
ApplicationManagementService appMgtService = ApplicationManagementService.getInstance();
appMgtService.createApplication(serviceProvider);
ServiceProvider createdServiceProvider = appMgtService.getApplication(applicationName);
if (createdServiceProvider == null) {
throw new APIManagementException("Couldn't create Service Provider Application " + applicationName);
}
// Then Create OAuthApp
OAuthAdminService oAuthAdminService = new OAuthAdminService();
OAuthConsumerAppDTO oAuthConsumerAppDTO = new OAuthConsumerAppDTO();
oAuthConsumerAppDTO.setApplicationName(applicationName);
oAuthConsumerAppDTO.setCallbackUrl(callbackUrl);
log.debug("Creating OAuth App " + applicationName);
oAuthAdminService.registerOAuthApplicationData(oAuthConsumerAppDTO);
log.debug("Created OAuth App " + applicationName);
OAuthConsumerAppDTO createdApp = oAuthAdminService.getOAuthApplicationDataByAppName(oAuthConsumerAppDTO
.getApplicationName());
log.debug("Retrieved Details for OAuth App " + createdApp.getApplicationName());
// Set the OAuthApp in InboundAuthenticationConfig
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
InboundAuthenticationRequestConfig[] inboundAuthenticationRequestConfigs = new
InboundAuthenticationRequestConfig[1];
InboundAuthenticationRequestConfig inboundAuthenticationRequestConfig = new
InboundAuthenticationRequestConfig();
inboundAuthenticationRequestConfig.setInboundAuthKey(createdApp.getOauthConsumerKey());
inboundAuthenticationRequestConfig.setInboundAuthType("oauth2");
if (createdApp.getOauthConsumerSecret() != null && !createdApp.
getOauthConsumerSecret().isEmpty()) {
Property property = new Property();
property.setName("oauthConsumerSecret");
property.setValue(createdApp.getOauthConsumerSecret());
Property[] properties = {property};
inboundAuthenticationRequestConfig.setProperties(properties);
}
inboundAuthenticationRequestConfigs[0] = inboundAuthenticationRequestConfig;
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(inboundAuthenticationRequestConfigs);
createdServiceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
// Update the Service Provider app to add OAuthApp as an Inbound Authentication Config
appMgtService.updateApplication(createdServiceProvider);
OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo();
oAuthApplicationInfo.setClientId(createdApp.getOauthConsumerKey());
oAuthApplicationInfo.setCallBackURL(createdApp.getCallbackUrl());
oAuthApplicationInfo.setClientSecret(createdApp.getOauthConsumerSecret());
oAuthApplicationInfo.addParameter(ApplicationConstants.
OAUTH_REDIRECT_URIS, createdApp.getCallbackUrl());
oAuthApplicationInfo.addParameter(ApplicationConstants.
OAUTH_CLIENT_NAME, createdApp.getApplicationName());
oAuthApplicationInfo.addParameter(ApplicationConstants.
OAUTH_CLIENT_GRANT, createdApp.getGrantTypes());
return oAuthApplicationInfo;
} catch (IdentityApplicationManagementException e) {
APIUtil.handleException("Error occurred while creating ServiceProvider for app " + applicationName, e);
} catch (Exception e) {
APIUtil.handleException("Error occurred while creating OAuthApp " + applicationName, e);
} finally {
PrivilegedCarbonContext.endTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(baseUser);
}
return null;
}
}

@ -31,5 +31,5 @@
Tomcat environment is the default and every webapps gets it even if they didn't specify it. Tomcat environment is the default and every webapps gets it even if they didn't specify it.
e.g. If a webapps requires CXF, they will get both Tomcat and CXF. e.g. If a webapps requires CXF, they will get both Tomcat and CXF.
--> -->
<Environments>Carbon</Environments> <Environments>CXF,Carbon</Environments>
</Classloading> </Classloading>

@ -19,130 +19,20 @@
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/> <import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<!--Discovery Service GET Endpoint--> <!-- Registration Service Endpoint -->
<jaxrs:server id="DiscoveryService_rest" address="/discovery/get"> <jaxrs:server id="RegistrationService" address="/register">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="DiscoveryService_rest_bean"/> <ref bean="RegistrationServiceBean"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
</jaxrs:server> </jaxrs:server>
<!--Discovery Service POST Endpoint--> <bean id="RegistrationServiceBean" class="org.wso2.carbon.identity.oauth.extension.impl.ClientRegistrationServiceImpl"/>
<jaxws:endpoint
id="DiscoveryService"
implementor="org.wso2.carbon.mdm.mobileservices.windows.services.discovery.impl.DiscoveryServiceImpl"
address="/discovery/post"/>
<!--XCEP endpoint for Federated Auth-Policy-->
<jaxws:endpoint
id="EnrollmentPolicyService"
implementor="org.wso2.carbon.mdm.mobileservices.windows.services.xcep.impl.CertificateEnrollmentPolicyServiceImpl"
address="/certificatepolicy/xcep">
<jaxws:properties>
<entry key="ws-security.bst.validator" value-ref="customvalidator"/>
</jaxws:properties>
<jaxws:handlers>
<bean id="securityheader"
class="org.wso2.carbon.mdm.mobileservices.windows.common.util.SOAPSecurityHandler"/>
</jaxws:handlers>
</jaxws:endpoint>
<!--XCEP endpoint for OnPremise Auth-Policy-->
<jaxws:endpoint
id="EnrollmentPolicyServiceOnPremise"
implementor="org.wso2.carbon.mdm.mobileservices.windows.services.xcep.impl.CertificateEnrollmentPolicyServiceImpl"
address="/certificatepolicy/xcep/onpremise">
<jaxws:properties>
<entry key="ws-security.ut.validator" value-ref="customvalidatoronpremise"/>
</jaxws:properties>
<jaxws:inInterceptors>
<ref bean="wss4jInInterceptor"/>
</jaxws:inInterceptors>
</jaxws:endpoint>
<!--WSTEP Endpoint for Federated Auth-Policy-->
<jaxws:endpoint
id="CertificateEnrollmentService"
implementor="org.wso2.carbon.mdm.mobileservices.windows.services.wstep.impl.CertificateEnrollmentServiceImpl"
address="/deviceenrolment/wstep">
<jaxws:properties>
<entry key="ws-security.bst.validator" value-ref="customvalidator"/>
</jaxws:properties>
<jaxws:handlers>
<ref bean="serviceOptionsHandler"/>
</jaxws:handlers>
</jaxws:endpoint>
<!--WSTEP Endpoint for OnPremise Auth-Policy-->
<jaxws:endpoint
id="CertificateEnrollmentServiceOnPremise"
implementor="org.wso2.carbon.mdm.mobileservices.windows.services.wstep.impl.CertificateEnrollmentServiceImpl"
address="/deviceenrolment/wstep/onpremise">
<jaxws:properties>
<entry key="ws-security.ut.validator" value-ref="customvalidatoronpremise"/>
</jaxws:properties>
<jaxws:inInterceptors>
<ref bean="wss4jInInterceptor"/>
</jaxws:inInterceptors>
<jaxws:handlers>
<ref bean="serviceOptionsHandler"/>
</jaxws:handlers>
</jaxws:endpoint>
<!--Syncml Endpoint-->
<jaxrs:server id="Syncmlinitial" address="/syncml">
<jaxrs:serviceBeans>
<ref bean="Syncml_initial_bean"/>
</jaxrs:serviceBeans>
</jaxrs:server>
<!--BST provider Endpoint for returning binary security token after authentication-->
<jaxrs:server id="bstprovider" address="/federated">
<jaxrs:serviceBeans>
<ref bean="bstprovider_bean"/>
</jaxrs:serviceBeans>
</jaxrs:server>
<!--Endpoint for UI admin operations-->
<jaxrs:server id="adminoperations" address="/operations">
<jaxrs:serviceBeans>
<ref bean="adminoperations_bean"/>
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="bstprovider_bean" class="org.wso2.carbon.mdm.mobileservices.windows.services.authbst.impl.BSTProviderImpl"/>
<bean id="adminoperations_bean" class="org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.impl.operationsImpl"/>
<bean id="DiscoveryService_rest_bean"
class="org.wso2.carbon.mdm.mobileservices.windows.services.discovery.impl.DiscoveryServiceImpl"/>
<bean id="wss4jInInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<property name="properties">
<map>
<entry key="action" value="UsernameToken"/>
<entry key="passwordType" value="PasswordText"/>
<entry key="isBSPCompliant" value="false"/>
<entry key="allowNamespaceQualifiedPasswordTypes" value="true"/>
</map>
</property>
</bean>
<bean id="Syncml_initial_bean"
class="org.wso2.carbon.mdm.mobileservices.windows.services.syncml.impl.SyncmlServiceImpl"/>
<bean id="customvalidator"
class="org.wso2.carbon.mdm.mobileservices.windows.common.util.BSTValidator"/>
<bean id="customvalidatoronpremise"
class="org.wso2.carbon.mdm.mobileservices.windows.common.util.UsernameTokenValidator"/>
<bean id="serviceOptionsHandler"
class="org.wso2.carbon.mdm.mobileservices.windows.services.wstep.util.MessageHandler"/>
</beans> </beans>

@ -18,34 +18,20 @@
~ * under the License. ~ * under the License.
~ */ ~ */
--> -->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
xmlns="http://java.sun.com/xml/ns/javaee" <display-name>Admin-Webapp</display-name>
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>CDM-Windows-API</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/cxf-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.wso2.carbon.mdm.mobileservices.windows.common.util.ConfigInitializerContextListener
</listener-class>
</listener>
<servlet> <servlet>
<description>JAX-WS/JAX-RS-windows Endpoint</description> <description>JAX-WS/JAX-RS Device Registration Agent Endpoint</description>
<display-name>JAX-WS/JAX-RS-windows Servlet</display-name> <display-name>JAX-WS/JAX-RS Servlet</display-name>
<servlet-name>JAXServlet-windows</servlet-name> <servlet-name>CXFServlet</servlet-name>
<servlet-class> <servlet-class>
org.apache.cxf.transport.servlet.CXFServlet org.apache.cxf.transport.servlet.CXFServlet
</servlet-class> </servlet-class>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>JAXServlet-windows</servlet-name> <servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern> <url-pattern>/*</url-pattern>
</servlet-mapping> </servlet-mapping>
<session-config> <session-config>
<session-timeout>60</session-timeout> <session-timeout>60</session-timeout>

@ -592,6 +592,11 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.keymgt.client</artifactId>
<version>${carbon.api.mgt.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.apimgt</groupId> <groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId> <artifactId>org.wso2.carbon.apimgt.impl</artifactId>
@ -877,6 +882,7 @@
<version>${cxf.version}</version> <version>${cxf.version}</version>
</dependency> </dependency>
<!-- End of CXF dependencies --> <!-- End of CXF dependencies -->
<!-- Transaction Mgt features --> <!-- Transaction Mgt features -->
<dependency> <dependency>
<groupId>org.wso2.carbon.commons</groupId> <groupId>org.wso2.carbon.commons</groupId>
@ -890,6 +896,22 @@
<version>${carbon.commons.version}</version> <version>${carbon.commons.version}</version>
</dependency> </dependency>
<!-- End of transaction Mgt features --> <!-- End of transaction Mgt features -->
<dependency>
<groupId>org.wso2.carbon.identity</groupId>
<artifactId>org.wso2.carbon.identity.application.mgt</artifactId>
<version>${carbon.identity.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity</groupId>
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
<version>${carbon.identity.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple.wso2</groupId>
<artifactId>json-simple</artifactId>
<version>${json-simple.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -1150,6 +1172,7 @@
<!--CXF properties--> <!--CXF properties-->
<cxf.version>2.6.1</cxf.version> <cxf.version>2.6.1</cxf.version>
<cxf.bindings.version>2.5.11</cxf.bindings.version> <cxf.bindings.version>2.5.11</cxf.bindings.version>
<json-simple.version>1.1.wso2v1</json-simple.version>
</properties> </properties>

Loading…
Cancel
Save