Custom attribute resolver integration with Spring

Rod Widdowson rdw at steadingsoftware.com
Sat Feb 2 09:16:35 EST 2019


> What do I need to add to the parse method?

That depends what you need to inject into the bean to make it work.  You don't specify details but the complications are

1) Conversions (string to int, string to File ISO to @Duration).  Mostly Spring gets this right or we have added stuff.  You just
set the value and Spring does the rest. Note for the @Duration thing you need the annotation on your setter method's parameter).  

2)  Creating sub-beans.  The simplest example of this is probably the creation of the IdPAttribute beans that the
StaticDataConnector needs.[1]

The most complicated is if you cannot know exactly what/how you want to create until after the parsing is complete (and sometimes
things like property replacement done), in this case you do need to go through a factory bean.  If you look at that reference you
quoted there is a reference to an article on when you need to do this as a last resort [2].  The simplest example of that is in the
RegexSplitAttributeDefinitionParser [3] where we go through a factory bean to create the java.util.regex.Pattern

Rod

[1]
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=blob_plain;f=idp-attribute-resolver-spring/src/main/java/net/shibbole
th/idp/attribute/resolver/spring/ad/impl/RegexSplitAttributeDefinitionParser.java;h=4c2f8d36fd20b8d3b43ed6d404c377972279d625;hb=HEAD

[2] https://wiki.shibboleth.net/confluence/display/IDP30/DoINeedAFactoryBean

[3]
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=blob;f=idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp
/attribute/resolver/spring/dc/impl/StaticDataConnectorParser.java;h=77e33fa0bba8ad44ca1b94c284b07bd95846c112;hb=HEAD

I suspect [1] and [3] will be mangled by Outlook, but you get the idea.   



More information about the dev mailing list