RequestedAttribute
Massimiliano Masi
max at mascanc.net
Wed May 3 11:59:58 EDT 2017
Hi All,
Sorry in advance for the probably stupid question.
I’m creating a SPSSODescriptor, and I want to add two RequestedAttribtues, like in the example of SAML-METADATA.
<RequestedAttribute
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.7"
FriendlyName="eduPersonEntitlement">
<saml:AttributeValue>
https://ServiceProvider.com/entitlements/123456789 <https://serviceprovider.com/entitlements/123456789>
</saml:AttributeValue>
</RequestedAttribute>
I am using this code (buildSAMLObject is from the Book). I see (in the last for loop) the values in there, :
List<RequestedAttribute> raq = x.getRequestedAttributes().stream().map(z -> {
RequestedAttribute ra;
try {
ra = OpenSAML330LHelper.buildSAMLObject(RequestedAttribute.class);
ra.setName(z.getName());
ra.setNameFormat(z.getNameFormat());
ra.setFriendlyName(z.getFriendlyName());
ra.setIsRequired(z.isRequired());
List<AttributeValue> attrVal = z.getAttributeValues();
if (attrVal != null) {
List<XSString> back = attrVal.stream().map(y -> {
try {
XSStringBuilder stringBuilder = (XSStringBuilder) XMLObjectProviderRegistrySupport.getBuilderFactory()
.getBuilder(XSString.TYPE_NAME);
XSString stringVal = stringBuilder
.buildObject(org.opensaml.saml.saml2.core.AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
stringVal.setValue(y.getAttributeValue());
return stringVal;
} catch (Exception e) {
throw new IllegalStateException(e);
}
}).collect(Collectors.toList());
ra.getAttributeValues().addAll(back);
}
return ra;
} catch (OpenSAMLUtilitiesError e) {
throw new IllegalStateException(e);
}
}).collect(Collectors.toList());
for (int i = 0; i < raq.size(); i++) {
acs.getRequestAttributes().add(raq.get(i));
}
The output is without any attribute value over the Requested Attribute. Am I doing some stupid thing here?
<md:AttributeConsumingService index="0" isDefault="true">
<md:ServiceName>Service Name</md:ServiceName>
<md:ServiceDescription>Service Description</md:ServiceDescription>
<md:RequestedAttribute FriendlyName="XSPA Purpose Of Use" Name="urn:oasis:names:tc:xspa:1.0:subject:purposeofuse" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"/>
<md:RequestedAttribute FriendlyName="XSPA Role" Name="urn:oasis:names:tc:xacml:2.0:subject:role" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"/>
</md:AttributeConsumingService>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/dev/attachments/20170503/40081a91/attachment.html>
More information about the dev
mailing list