use of org.jboss.as.test.integration.ws.WrapThreadContextClassLoader in project wildfly by wildfly.
the class WSTrustTestCase method testHolderOfKey.
@Test
@RunAsClient
@OperateOnDeployment(HOLDER_OF_KEY_SERVER_DEP)
@WrapThreadContextClassLoader
public void testHolderOfKey() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/holderofkeywssecuritypolicy", "HolderOfKeyService");
final URL wsdlURL = new URL("https", serviceURL.getHost(), serviceURL.getPort() - 8080 + 8444, "/jaxws-samples-wsse-policy-trust-holderofkey/HolderOfKeyService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
HolderOfKeyIface proxy = (HolderOfKeyIface) service.getPort(HolderOfKeyIface.class);
WSTrustTestUtils.setupWsseAndSTSClientHolderOfKey((BindingProvider) proxy, bus);
assertEquals("Holder-Of-Key WS-Trust Hello World!", proxy.sayHello());
} finally {
bus.shutdown(true);
}
}
use of org.jboss.as.test.integration.ws.WrapThreadContextClassLoader in project wildfly by wildfly.
the class WSTrustTestCase method testUsingEPR.
/**
* WS-Trust test with the STS information coming from EPR specified in service endpoint contract policy
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testUsingEPR() 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);
WSTrustTestUtils.setupWsse(proxy, bus);
try {
assertEquals("WS-Trust Hello World!", proxy.sayHello());
} catch (Exception e) {
throw e;
}
} finally {
bus.shutdown(true);
}
}
use of org.jboss.as.test.integration.ws.WrapThreadContextClassLoader in project wildfly by wildfly.
the class WSTrustTestCase method testNoClientCallback.
/**
* No CallbackHandler is provided in STSCLient. Username and password provided instead.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testNoClientCallback() 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.setupWsseAndSTSClientNoCallbackHandler(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
assertEquals("WS-Trust Hello World!", proxy.sayHello());
} finally {
bus.shutdown(true);
}
}
use of org.jboss.as.test.integration.ws.WrapThreadContextClassLoader in project wildfly by wildfly.
the class WSTrustTestCase method testActAs.
/**
* Request a security token that allows it to act as if it were somebody else.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(ACT_AS_SERVER_DEP)
@WrapThreadContextClassLoader
public void testActAs() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy", "ActAsService");
final URL wsdlURL = new URL(serviceURL + "ActAsService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ActAsServiceIface proxy = (ActAsServiceIface) service.getPort(ActAsServiceIface.class);
WSTrustTestUtils.setupWsseAndSTSClientActAs((BindingProvider) proxy, bus);
assertEquals("ActAs WS-Trust Hello World!", proxy.sayHello(serviceURL.getHost(), String.valueOf(serviceURL.getPort())));
} finally {
bus.shutdown(true);
}
}
use of org.jboss.as.test.integration.ws.WrapThreadContextClassLoader in project wildfly by wildfly.
the class WSTrustTestCase method testOnBehalfOf.
/**
* Request a security token that allows it to act on behalf of somebody else.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(ON_BEHALF_OF_SERVER_DEP)
@WrapThreadContextClassLoader
public void testOnBehalfOf() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy", "OnBehalfOfService");
final URL wsdlURL = new URL(serviceURL + "OnBehalfOfService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
OnBehalfOfServiceIface proxy = (OnBehalfOfServiceIface) service.getPort(OnBehalfOfServiceIface.class);
WSTrustTestUtils.setupWsseAndSTSClientOnBehalfOf((BindingProvider) proxy, bus);
assertEquals("OnBehalfOf WS-Trust Hello World!", proxy.sayHello(serviceURL.getHost(), String.valueOf(serviceURL.getPort())));
} finally {
bus.shutdown(true);
}
}
Aggregations