In CXF class STSClient there is claims property
http://cxf.apache.org/javadoc/latest/org/apache/cxf/ws/security/trust/STSClient.html
But how can you add claims using STSClient XML configuration? It is of type
org.w3c.dom.Element, and is it possible to create Spring bean for this type? 
I also tried to add claims to policy file, but then claims are added under
<SecondaryParameters> element, which are ignored by STS server.
Right now, only idea I got is to subclass STSClient, add List<String>
property and create Element inside setter function, like this:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            StringBuilder sb = new StringBuilder();
            sb.append("<Claims
xmlns=\"http://docs.oasis-open.org/ws-sx/ws-trust/200512\";
xmlns:wsid=\"http://schemas.xmlsoap.org/ws/2005/05/identity\";
Dialect=\"http://schemas.xmlsoap.org/ws/2005/05/identity\";>");
            for (String str : requiredClaims) {
                sb.append("<wsid:ClaimType Uri=\"").append(str).append("\"
Optional=\"true\"/>");
            }
            sb.append("</Claims>");

            InputSource is = new InputSource(new
StringReader(sb.toString()));
            Document d = builder.parse(is);
*            setClaims(d.getDocumentElement());
*
I wonder if there is better solution?
Thanks.



--
View this message in context: 
http://cxf.547215.n5.nabble.com/STSClient-add-Claims-tp5713540.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to