mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
refactored csr request authentication
This commit is contained in:
parent
3baaed0ea5
commit
1b51ad0228
@ -73,6 +73,7 @@
|
|||||||
org.apache.tomcat.util.buf,
|
org.apache.tomcat.util.buf,
|
||||||
org.apache.tomcat.util.http,
|
org.apache.tomcat.util.http,
|
||||||
org.osgi.service.component,
|
org.osgi.service.component,
|
||||||
|
org.osgi.framework,
|
||||||
org.w3c.dom,
|
org.w3c.dom,
|
||||||
org.wso2.carbon.apimgt.api,
|
org.wso2.carbon.apimgt.api,
|
||||||
org.wso2.carbon.apimgt.core.authenticate,
|
org.wso2.carbon.apimgt.core.authenticate,
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.webapp.authenticator.framework;
|
package org.wso2.carbon.webapp.authenticator.framework;
|
||||||
|
|
||||||
public final class Constants {
|
public final class Constants {
|
||||||
|
|||||||
@ -23,7 +23,6 @@ import org.apache.axiom.om.impl.builder.StAXBuilder;
|
|||||||
import org.apache.axiom.om.util.StAXUtils;
|
import org.apache.axiom.om.util.StAXUtils;
|
||||||
import org.apache.axiom.soap.SOAPEnvelope;
|
import org.apache.axiom.soap.SOAPEnvelope;
|
||||||
import org.apache.axiom.soap.SOAPHeader;
|
import org.apache.axiom.soap.SOAPHeader;
|
||||||
import org.apache.axiom.soap.SOAPHeaderBlock;
|
|
||||||
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
|
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
|
||||||
import org.apache.catalina.connector.Request;
|
import org.apache.catalina.connector.Request;
|
||||||
import org.apache.catalina.connector.Response;
|
import org.apache.catalina.connector.Response;
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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.webapp.authenticator.framework.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This defines the contract for AuthenticatorConfigService to expose authenticator configs in webapp-authenticators.xml.
|
||||||
|
*/
|
||||||
|
public interface AuthenticatorConfigService {
|
||||||
|
|
||||||
|
AuthenticatorConfig getAuthenticatorConfig(String authenticatorName) throws InvalidConfigurationStateException;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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.webapp.authenticator.framework.config.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfig;
|
||||||
|
import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfigService;
|
||||||
|
import org.wso2.carbon.webapp.authenticator.framework.config.InvalidConfigurationStateException;
|
||||||
|
import org.wso2.carbon.webapp.authenticator.framework.config.WebappAuthenticatorConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This holds implementation of AuthenticatorConfigService.
|
||||||
|
*/
|
||||||
|
public class AuthenticatorConfigServiceImpl implements AuthenticatorConfigService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AuthenticatorConfig getAuthenticatorConfig(String authenticatorName) throws
|
||||||
|
InvalidConfigurationStateException {
|
||||||
|
List<AuthenticatorConfig> configs = WebappAuthenticatorConfig.getInstance().getAuthenticators();
|
||||||
|
int index = 0;
|
||||||
|
if (authenticatorName == null || authenticatorName.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < configs.size(); i++) {
|
||||||
|
AuthenticatorConfig authenticatorConfig = configs.get(i);
|
||||||
|
if (authenticatorName.equals(authenticatorConfig.getName())) {
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return configs.get(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -20,6 +20,7 @@ package org.wso2.carbon.webapp.authenticator.framework.internal;
|
|||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.service.component.ComponentContext;
|
import org.osgi.service.component.ComponentContext;
|
||||||
import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService;
|
import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService;
|
||||||
import org.wso2.carbon.device.mgt.core.scep.SCEPManager;
|
import org.wso2.carbon.device.mgt.core.scep.SCEPManager;
|
||||||
@ -29,10 +30,12 @@ import org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer;
|
|||||||
import org.wso2.carbon.user.core.service.RealmService;
|
import org.wso2.carbon.user.core.service.RealmService;
|
||||||
import org.wso2.carbon.webapp.authenticator.framework.AuthenticatorFrameworkDataHolder;
|
import org.wso2.carbon.webapp.authenticator.framework.AuthenticatorFrameworkDataHolder;
|
||||||
import org.wso2.carbon.webapp.authenticator.framework.WebappAuthenticationValve;
|
import org.wso2.carbon.webapp.authenticator.framework.WebappAuthenticationValve;
|
||||||
import org.wso2.carbon.webapp.authenticator.framework.authenticator.WebappAuthenticator;
|
|
||||||
import org.wso2.carbon.webapp.authenticator.framework.WebappAuthenticatorRepository;
|
import org.wso2.carbon.webapp.authenticator.framework.WebappAuthenticatorRepository;
|
||||||
|
import org.wso2.carbon.webapp.authenticator.framework.authenticator.WebappAuthenticator;
|
||||||
import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfig;
|
import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfig;
|
||||||
|
import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfigService;
|
||||||
import org.wso2.carbon.webapp.authenticator.framework.config.WebappAuthenticatorConfig;
|
import org.wso2.carbon.webapp.authenticator.framework.config.WebappAuthenticatorConfig;
|
||||||
|
import org.wso2.carbon.webapp.authenticator.framework.config.impl.AuthenticatorConfigServiceImpl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -91,6 +94,12 @@ public class WebappAuthenticatorFrameworkServiceComponent {
|
|||||||
authenticator.init();
|
authenticator.init();
|
||||||
repository.addAuthenticator(authenticator);
|
repository.addAuthenticator(authenticator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Register AuthenticatorConfigService to expose webapp-authenticator configs.
|
||||||
|
BundleContext bundleContext = componentContext.getBundleContext();
|
||||||
|
AuthenticatorConfigService authenticatorConfigService = new AuthenticatorConfigServiceImpl();
|
||||||
|
bundleContext.registerService(AuthenticatorConfigService.class.getName(), authenticatorConfigService, null);
|
||||||
|
|
||||||
AuthenticatorFrameworkDataHolder.getInstance().setWebappAuthenticatorRepository(repository);
|
AuthenticatorFrameworkDataHolder.getInstance().setWebappAuthenticatorRepository(repository);
|
||||||
|
|
||||||
List<CarbonTomcatValve> valves = new ArrayList<CarbonTomcatValve>();
|
List<CarbonTomcatValve> valves = new ArrayList<CarbonTomcatValve>();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user