Custom intercept flow based on attribute value
Marco Naimoli
marco.naimoli at unipd.it
Thu Oct 18 07:16:28 EDT 2018
Hello, for anyone interested, problem is solved: not using an elegant
way, but it seems to work: I've added a "getValue()" after "get(0)":
<decision-state id="MyCheck">
<if
test="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.idp.profile.context.RelyingPartyContext)).getSubcontext(T(net.shibboleth.idp.attribute.context.AttributeContext)).getUnfilteredIdPAttributes().get('myattribute').getValues().get(0).getValue().equals('N')"
then="ActionTrue" else="ActionFalse" />
</decision-state>
I first tried using SimpleAttributePredicate, using a bean like this:
<bean id="beanCheck"
class="net.shibboleth.idp.profile.logic.SimpleAttributePredicate"
p:useUnfilteredAttributes="true">
<property name="attributeValueMap">
<map>
<entry key="myattribute">
<list>
<value>N</value>
</list>
</entry>
</map>
</property>
</bean>
and evaluating it in the flow (created an action-state with evaluate and
transition expressions, but in the logs I always found
Executing [EvaluateAction at 320c0075 expression = beanCheck,
resultExpression = [null]]
while I was expecting something like 'true'
Probably I didn't write the correct evaluate expression (I'm not a Java
or Spring programmer, of course), or my approach is completely
wrong; however if anyone wants to provide an example I think it could be
useful to others
Thank you
Marco
Il 17/10/2018 22:33, Marco Naimoli ha scritto:
> Thank you Scott
> Marco
>
> "Cantor, Scott" <cantor.2 at osu.edu> ha scritto:
>
>>> Does anyone can help me to understand what's wrong with my test
>>> condition ?
>>
>> The values of an IdPAttribute is not a simple string, it's an
>> IdPAttributeValue<Type> generic.
>>
>> Usually you're much better off wiring up a Predicate (like our built
>> in SimpleAttributePredicate) and applying that in your flow logic to
>> mask off all that crazy expression stuff.
>>
>> -- Scott
>>
>> --
>> For Consortium Member technical support, see
>> https://wiki.shibboleth.net/confluence/x/coFAAg
>> To unsubscribe from this list send an email to
>> users-unsubscribe at shibboleth.net
>
>
More information about the users
mailing list