use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.
the class WSSecurityPolicyExamples23xTestCase method test2312.
/**
* 2.3.1.2 (WSS1.0) SAML1.1 Assertion (Sender Vouches) over SSL
*
* @throws Exception
*/
@Test
@RunAsClient
@WrapThreadContextClassLoader
@OperateOnDeployment(DEPLOYMENT)
public void test2312() throws Exception {
Service service = Service.create(new URL(serviceURLHttps + "SecurityService2312?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService2312Port"), ServiceIface.class);
SamlCallbackHandler cbh = new SamlCallbackHandler();
cbh.setConfirmationMethod("urn:oasis:names:tc:SAML:1.0:cm:sender-vouches");
((BindingProvider) proxy).getRequestContext().put(SecurityConstants.SAML_CALLBACK_HANDLER, cbh);
assertTrue(proxy.sayHello().equals("Hello - (WSS1.0) SAML1.1 Assertion (Sender Vouches) over SSL"));
}
use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.
the class WSSecurityPolicyExamples23xTestCase method test2314.
/**
* 2.3.1.4 (WSS1.0) SAML1.1 Sender Vouches with X.509 Certificates, Sign, Optional Encrypt
*
* @throws Exception
*/
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test2314() throws Exception {
Service service = Service.create(new URL(serviceURL + "SecurityService2314?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService2314Port"), ServiceIface.class);
Map<String, Object> reqCtx = ((BindingProvider) proxy).getRequestContext();
SamlCallbackHandler cbh = new SamlCallbackHandler();
cbh.setConfirmationMethod("urn:oasis:names:tc:SAML:1.0:cm:sender-vouches");
reqCtx.put(SecurityConstants.SAML_CALLBACK_HANDLER, cbh);
reqCtx.put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
reqCtx.put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
reqCtx.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
reqCtx.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
reqCtx.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
try {
assertTrue(proxy.sayHello().equals("Hello - (WSS1.0) SAML1.1 Sender Vouches with X.509 Certificates, Sign, Optional Encrypt"));
} catch (Exception e) {
throw CryptoCheckHelper.checkAndWrapException(e);
}
}
use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.
the class WSTrustTestCase method test.
/**
* WS-Trust test with the STS information programmatically provided
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void test() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl");
WSTrustTestUtils.setupWsseAndSTSClient(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
try {
assertEquals("WS-Trust Hello World!", proxy.sayHello());
} catch (Exception e) {
throw CryptoCheckHelper.checkAndWrapException(e);
}
} finally {
bus.shutdown(true);
}
}
use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.
the class WSTrustTestCase method testBearer.
@Test
@RunAsClient
@OperateOnDeployment(BEARER_SERVER_DEP)
@WrapThreadContextClassLoader
public void testBearer() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/bearerwssecuritypolicy", "BearerService");
Service service = Service.create(new URL(serviceURL + "BearerService?wsdl"), serviceName);
BearerIface proxy = (BearerIface) service.getPort(BearerIface.class);
WSTrustTestUtils.setupWsseAndSTSClientBearer((BindingProvider) proxy, bus);
assertEquals("Bearer WS-Trust Hello World!", proxy.sayHello());
} finally {
bus.shutdown(true);
}
}
use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.
the class WSTrustTestCase method testNoSignatureUsername.
/**
* No SIGNATURE_USERNAME is provided to the service. Service will use the
* client's keystore alias in its place.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testNoSignatureUsername() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl");
WSTrustTestUtils.setupWsseAndSTSClientNoSignatureUsername(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
assertEquals("WS-Trust Hello World!", proxy.sayHello());
} finally {
bus.shutdown(true);
}
}
Aggregations