props.put("user", "alice"); props.put("passwordType", "PasswordText"); WSS4JStaxOutInterceptor wss4jOut = new WSS4JStaxOutInterceptor(props); wss4jOut = new WSS4JStaxOutInterceptor(props); client.getOutInterceptors().add(wss4jOut); String s = greeter.greetMe("CXF"); wss4jOut = new WSS4JStaxOutInterceptor(props); client.getOutInterceptors().add(wss4jOut); greeter.greetMe("CXF"); try { props.put("passwordType", "PasswordText"); wss4jOut = new WSS4JStaxOutInterceptor(props); client.getOutInterceptors().add(wss4jOut); ((BindingProvider)greeter).getRequestContext().put("password", "password");
WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
WSS4JOutInterceptor outInterceptor = null; if (test.isStreaming()) { staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {
@org.junit.Test public void testSignatureProgrammaticStAX() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = ActionTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSignatureConfigPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); // Programmatic interceptor WSSSecurityProperties properties = new WSSSecurityProperties(); properties.setActions(Collections.singletonList(WSSConstants.SIGNATURE)); properties.setSignatureUser("alice"); properties.setCallbackHandler(new KeystorePasswordCallback()); properties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KEYIDENTIFIER_SECURITY_TOKEN_DIRECT_REFERENCE); Properties sigProperties = CryptoFactory.getProperties("alice.properties", this.getClass().getClassLoader()); properties.setSignatureCryptoProperties(sigProperties); WSS4JStaxOutInterceptor outInterceptor = new WSS4JStaxOutInterceptor(properties); Client client = ClientProxy.getClient(port); client.getOutInterceptors().add(outInterceptor); assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
WSS4JOutInterceptor outInterceptor = null; if (test.isStreaming()) { staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else { staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps); bus.getOutInterceptors().add(staxOutInterceptor); } else {