<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Rod, or anyone,<br>
<br>
I was looking at deprecating the boolean SAML 2 SSO profile config
'allowingDelegation' and implementing a Predicate, which will be
'allowDelegation'.<br>
<br>
Was wondering how we handle auto-conversion of Strings to Predicates
in the config parsers, if at all. I know for native Spring we have
the StringBooleanToPredicateConverter, but doesn't seem to work for
the legacy parsers. <br>
<br>
What I came up with is below. Is this horribly wrong? Is there a
better simpler way?<br>
<br>
Basically, leave the old schema attribute 'allowDelegation' in
place, undeprecated, but convert to a Predicate and set the new
property. For 'allowDelegationPredicateRef', just set the ref
directly.<br>
<br>
<tt> if (element.hasAttributeNS(null, "allowDelegation")) {</tt><tt><br>
</tt><tt> if (element.hasAttributeNS(null,
"allowDelegationPredicateRef")) {</tt><tt><br>
</tt><tt> log.warn("Attribute 'allowDelegation' is
being ignored in favor of 'allowDelegationPredicateRef'");</tt><tt><br>
</tt><tt> } else {</tt><tt><br>
</tt><tt> Boolean value =
AttributeSupport.getAttributeValueAsBoolean(</tt><tt><br>
</tt><tt> element.getAttributeNodeNS(null,
"allowDelegation"));</tt><tt><br>
</tt><tt> if (value != null) {</tt><tt><br>
</tt><tt> if (value) {</tt><tt><br>
</tt><tt>
builder.addPropertyValue("allowDelegation",
Predicates.alwaysTrue());</tt><tt><br>
</tt><tt> } else {</tt><tt><br>
</tt><tt>
builder.addPropertyValue("allowDelegation",
Predicates.alwaysFalse());</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> } else {</tt><tt><br>
</tt><tt> log.error("Attribute 'allowDelegation'
is being ignored because it's not a legal xs:boolean value");</tt><tt><br>
</tt><tt> throw new
BeanDefinitionParsingException(new Problem(</tt><tt><br>
</tt><tt> "Attribute 'allowDelegation' is
being ignored because it's not a legal xs:boolean value",</tt><tt><br>
</tt><tt> new
Location(parserContext.getReaderContext().getResource())));</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> if (element.hasAttributeNS(null,
"allowDelegationPredicateRef")) {</tt><tt><br>
</tt><tt> builder.addPropertyReference("allowDelegation",
</tt><tt><br>
</tt><tt>
StringSupport.trimOrNull(element.getAttributeNS(null,
"allowDelegationPredicateRef")));</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><br>
<br>
Rather than add the new 'allowDelegationPredicateRef' attribute to
the schema, would it be more appropriate to overload
'allowDelegation' to handle both (String) boolean value and bean
ref?<br>
<br>
Have we done anything similar as precedent?<br>
<br>
</body>
</html>