createStaticBus(SecurityPolicyTest.class.getResource("https_config.xml").toString())
.getExtension(PolicyEngine.class).setEnabled(true);
getStaticBus().getOutInterceptors().add(new LoggingOutInterceptor());
EndpointImpl ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortHttps"));
ep.setWsdlLocation(wsdl.getPath());
ep.setAddress(POLICY_HTTPS_ADDRESS);
ep.publish();
ep.getServer().getEndpoint().getEndpointInfo().setProperty(SecurityConstants.CALLBACK_HANDLER,
new ServerPasswordCallback());
Endpoint.publish(POLICY_ADDRESS, new DoubleItImpl());
ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
ep.setEndpointName(
new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortEncryptThenSign")
);
ep.setWsdlLocation(wsdl.getPath());
ep.setAddress(POLICY_ENCSIGN_ADDRESS);
ep.publish();
EndpointInfo ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "bob.properties", "alice.properties");
ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
ep.setEndpointName(
new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortSignThenEncrypt")
);
ep.setWsdlLocation(wsdl.getPath());
ep.setAddress(POLICY_SIGNENC_ADDRESS);
ep.publish();
ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "bob.properties", "alice.properties");
ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortSign"));
ep.setWsdlLocation(wsdl.getPath());
ep.setAddress(POLICY_SIGN_ADDRESS);
ep.publish();
ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "bob.properties", "alice.properties");
ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortXPath"));
ep.setWsdlLocation(wsdl.getPath());
ep.setAddress(POLICY_XPATH_ADDRESS);
ep.publish();
ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "alice.properties", "bob.properties");
ep = (EndpointImpl)Endpoint.publish(POLICY_SIGNENC_PROVIDER_ADDRESS,
new DoubleItProvider());
ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "bob.properties", "alice.properties");
ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortSignedOnly"));
ep.setWsdlLocation(wsdl.getPath());
ep.setAddress(POLICY_SIGNONLY_ADDRESS);
ep.publish();
ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "bob.properties", "alice.properties");
ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortCXF3041"));
ep.setWsdlLocation(wsdl.getPath());
ep.setAddress(POLICY_CXF3041_ADDRESS);
ep.publish();
ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "bob.properties", "alice.properties");
ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortCXF3042"));
ep.setWsdlLocation(wsdl.getPath());
ep.setAddress(POLICY_CXF3042_ADDRESS);
ep.publish();
ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "alice.properties", "alice.properties");
ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortCXF3452"));
ep.setWsdlLocation(wsdl.getPath());
ep.setAddress(POLICY_CXF3452_ADDRESS);
ep.publish();
ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "alice.properties", "alice.properties");
ei.setProperty(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
}