没有命名空间的Saml Assertion AttributeValue

时间:2015-08-18 13:10:42

标签: java saml-2.0 opensaml

目前,以下java代码正在

中生成名称空间
SAMLObjectBuilder attrBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Attribute.DEFAULT_ELEMENT_NAME);
         Attribute attrFirstName = (Attribute) attrBuilder.buildObject();
         attrFirstName.setName(name);
         attrFirstName.setNameFormat("xyz");
         // Set custom Attributes
         XMLObjectBuilder stringBuilder = getSAMLBuilder().getBuilder(XSString.TYPE_NAME);
         XSString attrValueFirstName = (XSString) stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
         attrValueFirstName.setValue(value);
         attrFirstName.getAttributeValues().add(attrValueFirstName);

这为我生成了以下xml doc: -

<saml:Attribute Name="xyz" NameFormat="xyz">
            <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
                CustomValue</saml:AttributeValue>

虽然我想要没有名称空间的输出如下,但是有可能吗?

<saml:Attribute Name="xyz" NameFormat="xyz"><saml:AttributeValue>CustomValue</saml:AttributeValue>

0 个答案:

没有答案