Are you trying to add this information to the SAML Assertion created in the STS after receiving a Claim? If so then you shouldn't be adding it to the "requestClaim", but to the ProcessedClaim instance that is created in the CallbackHandler. I added a test to CXF that shows how to do it in a CustomClaimsHandler:
https://github.com/apache/cxf/blob/master/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java Colm. On Mon, Jan 29, 2018 at 6:48 PM, Tóth Csaba <[email protected]> wrote: > Hello! > Thanx, but look like not helped: > > XMLObjectBuilderFactory builderFactory = > > XMLObjectProviderRegistrySupport.getBuilderFactory(); > @SuppressWarnings("unchecked") > XMLObjectBuilder<XSAny> xsAnyBuilder = > > (XMLObjectBuilder<XSAny>)builderFactory.getBuilder(XSAny.TYPE_NAME); > XSAny attributeValue = > > xsAnyBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME); > > XSAny node = > xsAnyBuilder.buildObject(new QName("... namespace ... "," ... element > name... "),new QName("http://www.w3.org/2001/XMLSchema-instance","CE")); > > attributeValue.getUnknownXMLObjects().add(node); > > node.getUnknownAttributes().put(new > QName(".. attr namespace...","Code"),code); > requestClaim.addValue(attributeValue); > > but I get an error for the building the SAML, that "Cannot replace an > element's default namespace" > Csaba > > > On 2018.01.29. 17:59, Colm O hEigeartaigh wrote: > > This WSS4J unit test might help you - it shows how to add a custom > > Attribute: > > > > https://github.com/apache/wss4j/blob/94f0e42d03011fa97122bcd495d268 > ff33a5107f/ws-security-dom/src/test/java/org/apache/ > wss4j/dom/saml/SamlTokenTest.java#L578 > > > > Colm. > > > > On Mon, Jan 29, 2018 at 3:42 PM, Tóth Csaba <[email protected]> wrote: > > > >> Hello! > >> > >> I need to put an XML fragment to one of the SAML Attribute: > >> > >> <saml-a:Attribute xmlns:saml-a="urn:oasis:names:tc:SAML:2.0:assertion" > >> xmlns:wsa="http://www.w3.org/2005/08/addressing"> > >> <saml-a:AttributeValue xmlns:xsi="http://www.w3.org/ > >> 2001/XMLSchema-instance"> > >> <PurposeOfUse xmlns=" .... " xsi:type=" ... " attr1=" ... " > >> attr2=" ... "/> > >> </saml-a:AttributeValue> > >> </saml-a:Attribute> > >> > >> (the xsi:type is not an standard schema type) > >> > >> I get this information from an Claim. I parse already, and I have all > >> the fields. I need some solution how can I put to the requestClaim ant > >> the ClaimParser > >> I try to use the OpenSAML, to create a AttributeValue, but I dont know > >> how to create the PurposeOfUse element. > >> > >> Any idee? > >> Thanx > >> > >> Csaba > >> > >> > >> > >> > > > > -- Colm O hEigeartaigh Talend Community Coder http://coders.talend.com
