No subject
LECUYER, Dominic
dominic.lecuyer at capgemini.com
Tue Apr 21 03:55:47 EDT 2015
Hello,
I've been using OpenSAML for more than a year now, but it has always been transparent with the use of Apache CXF Security Token Service and WSS4J.
Now my needs have become I little more complicated.
I would like to create an attribute in my SAML assertion token. The difficult part is I want this content to be a complex type. Instead of explaining see what I get :
<saml2:Attribute Name="http://cwix.act.nato.int/clearance" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
<saml2:AttributeValue xsi:type="xsd:string"><ns2:Clearance xmlns:ns2="http://xiwc/2015/02/clearance" xmlns="http://xiwc/2015/02/identities" xmlns:ns3="http://xiwc/2014/06/nl/cl"><ns2:Classifications><ns2:Classification>SECRET</ns2:Classification><ns2:Classification>CONFIDENTIAL</ns2:Classification><ns2:Classification>RESTRICTED</ns2:Classification><ns2:Classification>UNCLASSIFIED</ns2:Classification></ns2:Classifications></ns2:Clearance></saml2:AttributeValue>
</saml2:Attribute>
My problem is the escaping of the characters. I am using OpenSaml 3.1.0 and this is how I added this attribute (inspired from ):
try {
InitializationService.initialize();
} catch (InitializationException ex) {
Logger.getLogger(RepositoryClaimsHandler.class.getName()).log(Level.SEVERE, null, ex);
}
XMLObjectBuilderFactory builderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();
XMLObjectBuilder<XSString> xsStringBuilder
= (XMLObjectBuilder<XSString>) builderFactory.getBuilder(XSString.TYPE_NAME);
XSString attributeValue
= xsStringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
attributeValue.setValue(writer.toString());
I also tried with the XSAny type and the "xsAnyAttributeValue.getUnknownXMLObjects().add(myXSStringType)" with no success
I looked at the marshaller and, in a JAXB kind of way, tried to disable character escaping but I couldn't find how to make this configuration .
I am now thinking of how to create my own AbstractXMLObject extentions and factories but this seems to be excessive work with unsure results ^^.
That's why I write to you. Do you have an idea on how to deal with this ?
Regards,
Dominic Lécuyer
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/dev/attachments/20150421/5c5ffb2d/attachment.html>
More information about the dev
mailing list