Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.1
-
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); }