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; }
protected com.sun.xml.wss.impl.MessageLayout getLayout( com.sun.xml.ws.security.policy.MessageLayout layout) { switch (layout) { case Strict: { if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "MessageLayout has been configured to be STRICT "); } return com.sun.xml.wss.impl.MessageLayout.Strict; } case Lax: { if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "MessageLayout has been configured to be LAX "); } return com.sun.xml.wss.impl.MessageLayout.Lax; } case LaxTsFirst: { if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "MessageLayout has been configured to be LaxTimestampFirst "); } return com.sun.xml.wss.impl.MessageLayout.LaxTsFirst; } case LaxTsLast: { if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "MessageLayout has been configured tp be LaxTimestampLast "); } return com.sun.xml.wss.impl.MessageLayout.LaxTsLast; } default: { if (logger.isLoggable(Level.SEVERE)) { logger.log(Level.SEVERE, LogStringsMessages.SP_0106_UNKNOWN_MESSAGE_LAYOUT(layout)); } throw new RuntimeException(LogStringsMessages.SP_0106_UNKNOWN_MESSAGE_LAYOUT(layout)); } } }