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

                 Key: CXF-3705
                 URL: https://issues.apache.org/jira/browse/CXF-3705
             Project: CXF
          Issue Type: Improvement
          Components: WS-* Components
    Affects Versions: 2.4.1
            Reporter: Sergey Zhemzhitsky


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

Sometimes it's needed to support non-standard algorithm suite. Now it's hardly 
possible to do.

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};
    }

}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to