[
https://issues.apache.org/jira/browse/CXF-4543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13774612#comment-13774612
]
Colm O hEigeartaigh commented on CXF-4543:
------------------------------------------
Hi Oli,
I merged a fix for this issue, although not quite along the lines you
suggested. Opensaml has the option of adding custom AttributeValues via
Opensaml "XMLObject" instances. WSS4J's AttributeBean already has an option to
allow this via "setCustomAttributeValues(List<?> values)".
So I added a similar method to the STS's Claim class, and updated the
AttributeStatementProvider to set the custom values on the AttributeBean if
they are defined. It's up to the ClaimsHandler implementation to create custom
XMLObjects using Opensaml. So for example, in a unit test I committed:
if (ClaimTypes.MOBILEPHONE.equals(requestClaim.getClaimType())) {
// Test custom (Integer) attribute value
XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
@SuppressWarnings("unchecked")
XMLObjectBuilder<XSInteger> xsIntegerBuilder =
(XMLObjectBuilder<XSInteger>)builderFactory.getBuilder(XSInteger.TYPE_NAME);
XSInteger attributeValue =
xsIntegerBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
XSInteger.TYPE_NAME);
attributeValue.setValue(185912592);
claim.setCustomValues(Collections.singletonList(attributeValue));
}
It's not really possible to define a list of types + then marshal them using
Opensaml.
Colm.
> Encode multi value claims as multi-value saml attribute
> -------------------------------------------------------
>
> Key: CXF-4543
> URL: https://issues.apache.org/jira/browse/CXF-4543
> Project: CXF
> Issue Type: Improvement
> Components: Services
> Affects Versions: 2.7.0
> Reporter: Oliver Wulff
> Assignee: Colm O hEigeartaigh
> Fix For: 3.0.0
>
>
> The current ClaimsAttributeStatementProvider supports encoding for string
> type value of claims. It's up to the ClaimsHandler to implement multi-value
> claim support and encoding.
> As mentioned here:
> http://cxf.547215.n5.nabble.com/SAML-2-0-attibutes-and-claims-naming-convention-td5712967.html
> The type of the value in the class Claim has to be changed from String to
> Object. The ClaimsAttributeStatementProvider can then be configured how to
> encode multi value claims. Fediz already supports both since FEDIZ-22.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira