Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3705

It's impossible to extend org.apache.cxf.ws.security.policy.model.AlgorithmSuite with a custom non-standad algorithms.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.1
    • 2.4.3
    • WS-* Components
    • Unknown

    Description

      It's hardly possible to extend org.apache.cxf.ws.security.policy.model.AlgorithmSuite with a custom non-standad algorithms.

      The possible solution is to refactor org.apache.cxf.ws.security.policy.builders.AlgorithmSuiteBuilder to get all algorithm suites using cxf extension mechanism, for example,

      public class AlgorithmSuiteBuilder implements AssertionBuilder<Element> {
      
          private Bus bus;
      
          public AlgorithmSuiteBuilder(Bus bus) {
              this.bus = bus;
          }
      
          public Assertion build(Element element, AssertionBuilderFactory factory)
              throws IllegalArgumentException {
      
              SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
                  ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
      
              Element policyElem = DOMUtils.getFirstElement(element);
      
              String algoSuiteName = DOMUtils.getFirstElement(policyElem).getLocalName();
      
              AlgorithmSuiteLoader loader = bus.getExtension(AlgorithmSuiteLoader.class);
              AlgorithmSuite suite = loader.getAlgorithmSuite(algoSuiteName, consts);
              if(suite == null) {
                  throw new IllegalArgumentException("Algorithm suite \"" + algoSuiteName + "\" is not registered");
              }
      
              return suite;
          }
      
          public QName[] getKnownElements() {
              return new QName[]{SP11Constants.ALGORITHM_SUITE, SP12Constants.ALGORITHM_SUITE};
          }
      
      }
      
      public interface AlgorithmSuiteLoader {
      
          AlgorithmSuite getAlgorithmSuite(String localName, SPConstants consts);
      
      }
      

      Attachments

        Activity

          People

            coheigea Colm O hEigeartaigh
            szhemzhitsky Sergey Zhemzhitsky
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: