/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF 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.apache.cxf.fediz.integrationtests;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.xml.XmlConfiguration;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
/**
* In this test-case, the IdP is set up to require client authentication, rather than authenticating using a
* username + password, or via Kerberos.
*/
public class ClientCertificateTest extends AbstractClientCertTests {
static String idpHttpsPort;
static String rpHttpsPort;
private static Server rpServer;
@BeforeClass
public static void init() {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "info");
System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.webflow", "info");
System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security.web", "info");
System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security", "info");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf.fediz", "info");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf", "info");
idpHttpsPort = System.getProperty("idp.https.port");
Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
rpHttpsPort = System.getProperty("rp.https.port");
Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
JettyUtils.initIdpServer();
JettyUtils.startIdpServer();
try {
Resource testServerConfig = Resource.newSystemResource("rp-client-cert-server.xml");
XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream());
rpServer = (Server)configuration.configure();
rpServer.start();
} catch (Exception e) {
e.printStackTrace();
}
}
@AfterClass
public static void cleanup() {
JettyUtils.stopIdpServer();
if (rpServer != null && rpServer.isStarted()) {
try {
rpServer.stop();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public String getIdpHttpsPort() {
return idpHttpsPort;
}
@Override
public String getRpHttpsPort() {
return rpHttpsPort;
}
@Override
public String getServletContextName() {
return "fedizhelloworld";
}
}