public MessagePolicy getXWSSPolicy() throws PolicyException { MessagePolicy mp = null; try { mp = _policyContainer.getMessagePolicy(); } catch (PolicyGenerationException ex) { logger.log(Level.SEVERE, "" + effectivePolicy, ex); throw new PolicyException("Unable to digest SecurityPolicy "); } // try{ if (wssAssertion != null) { try { mp.setWSSAssertion( getWssAssertion((com.sun.xml.ws.security.policy.WSSAssertion) wssAssertion)); } catch (PolicyGenerationException ex) { logger.log( Level.SEVERE, LogStringsMessages.SP_0104_ERROR_SIGNATURE_CONFIRMATION_ELEMENT(ex.getMessage()), ex); throw new PolicyException( LogStringsMessages.SP_0104_ERROR_SIGNATURE_CONFIRMATION_ELEMENT(ex.getMessage())); } } if (policyBinding != null && policyBinding.getAlgorithmSuite() != null) { mp.setAlgorithmSuite(getAlgoSuite(policyBinding.getAlgorithmSuite())); } if (policyBinding != null && policyBinding.getLayout() != null) { mp.setLayout(getLayout(policyBinding.getLayout())); } if (isIncoming && reqElements.size() > 0) { try { com.sun.xml.ws.security.impl.policyconv.RequiredElementsProcessor rep = new com.sun.xml.ws.security.impl.policyconv.RequiredElementsProcessor(reqElements, mp); rep.process(); } catch (PolicyGenerationException ex) { logger.log( Level.SEVERE, LogStringsMessages.SP_0103_ERROR_REQUIRED_ELEMENTS(ex.getMessage()), ex); throw new PolicyException( LogStringsMessages.SP_0103_ERROR_REQUIRED_ELEMENTS(ex.getMessage())); } } if (transportBinding) { mp.setSSL(transportBinding); } return mp; }
@Override @SuppressWarnings("unchecked") protected ProcessingContext initializeOutgoingProcessingContext( Packet packet, boolean isSCMessage) { ProcessingContextImpl ctx = null; if (optimized) { ctx = new JAXBFilterProcessingContext(packet.invocationProperties); ((JAXBFilterProcessingContext) ctx).setAddressingVersion(addVer); ((JAXBFilterProcessingContext) ctx).setSOAPVersion(soapVersion); } else { ctx = new ProcessingContextImpl(packet.invocationProperties); } // set timestamp timeout ctx.setTimestampTimeout(this.timestampTimeOut); ctx.setSecurityPolicyVersion(spVersion.namespaceUri); try { MessagePolicy policy = null; if (packet.getMessage().isFault()) { policy = getOutgoingFaultPolicy(packet); } else if (isRMMessage(packet)) { SecurityPolicyHolder holder = outProtocolPM.get("RM"); policy = holder.getMessagePolicy(); } else if (isSCCancel(packet)) { SecurityPolicyHolder holder = outProtocolPM.get("SC"); policy = holder.getMessagePolicy(); } else { policy = getOutgoingXWSSecurityPolicy(packet, isSCMessage); } if (debug && policy != null) { policy.dumpMessages(true); } // this might mislead if there is a bug in code above // but we are doing this check for cases such as no-fault-security-policy if (policy != null) { ctx.setSecurityPolicy(policy); } if (isTrustMessage(packet)) { ctx.isTrustMessage(true); } // set the policy, issued-token-map, and extraneous properties // ctx.setIssuedTokenContextMap(issuedTokenContextMap); if (isSCMessage) { ctx.setAlgorithmSuite(policy.getAlgorithmSuite()); } else { ctx.setAlgorithmSuite(getAlgoSuite(getBindingAlgorithmSuite(packet))); } ctx.setSecurityEnvironment(secEnv); ctx.isInboundMessage(false); if (serverCert != null) { ctx.getExtraneousProperties().put(XWSSConstants.SERVER_CERTIFICATE_PROPERTY, serverCert); } @SuppressWarnings("unchecked") Map<Object, Object> extProps = ctx.getExtraneousProperties(); extProps.put(WSITServerAuthContext.WSDLPORT, pipeConfig.getWSDLPort()); } catch (XWSSecurityException e) { log.log(Level.SEVERE, LogStringsMessages.WSITPVD_0006_PROBLEM_INIT_OUT_PROC_CONTEXT(), e); throw new RuntimeException( LogStringsMessages.WSITPVD_0006_PROBLEM_INIT_OUT_PROC_CONTEXT(), e); } return ctx; }