SecurityConfigInInterceptor extends AbstractPhaseInterceptor<Message> { @Override public void handleMessage(Message msg) throws Fault { WSSConfig config = (WSSConfig) msg.getContextualProperty(WSSConfig.class.getName()); if (config == null) { config = WSSConfig.getNewInstance(); } config.setProcessor(new QName(SamlConstants.XML_SIGNATURE_NS, SamlConstants.SIGNATURE_TAG), new CONNECTSignatureProcessor()); msg.put(WSSConfig.class.getName(), config); } SecurityConfigInInterceptor(); @Override void handleMessage(Message msg);  }
@Test public void verifySecurityConfig() throws WSSecurityException { Message msg = new MessageImpl(); SecurityConfigInInterceptor interceptor = new SecurityConfigInInterceptor(); interceptor.handleMessage(msg); assertSecurityProcessorIsRegistered(msg); }
@Test public void verifySecurityConfigWithPresetWSSConfig() throws WSSecurityException { Message msg = new MessageImpl(); msg.put(WSSConfig.class.getName(), WSSConfig.getNewInstance()); SecurityConfigInInterceptor interceptor = new SecurityConfigInInterceptor(); interceptor.handleMessage(msg); assertSecurityProcessorIsRegistered(msg); }