use of org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface in project jbossws-cxf by jbossws.
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);
/* TODO explain why this is not needed for setup and then remove
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");
*/
WSTrustTestUtils.setupWsseAndSTSClientOnBehalfOf((BindingProvider) proxy, bus);
assertEquals("OnBehalfOf WS-Trust Hello World!", proxy.sayHello(getServerHost(), String.valueOf(getServerPort())));
} finally {
bus.shutdown(true);
}
}
Aggregations