Hi
We have a Spring application that uses customised authorization to integrate with our corporate user database using acegi 0.8.2.
Here's the changed config:
<bean id="regAuthenticationDAO" class="uk.co.anm.london.security.RegJdbcDaoImpl">
<property name="dataSource">
<ref bean="regSource"/>
</property>
<property name="usersByUsernameMapping">
<ref bean="usersByUsernameMapping"/>
</property>
<property name="authoritiesByUsernameMapping">
<ref bean="authoritiesByUsernameMapping"/>
</property>
</bean>
<!-- New bean(s) to override Acegi queries -->
<bean id="usersByUsernameMapping" class="uk.co.anm.london.security.mapping.UserByUse rnameMapping">
<property name="dataSource">
<ref bean="regSource" />
</property>
<property name="sql">
<value>SELECT userid, email as username,password,'true' as enabled FROM users WHERE email = ? and valid='Y'</value>
</property>
</bean>
<bean id="authoritiesByUsernameMapping" class="uk.co.anm.london.security.mapping.Authoriti esByUsernameMapping">
<property name="dataSource">
<ref bean="regSource" />
</property>
<property name="sql">
<value>SELECT email as username, 'REGISTERED_USER' as authority FROM users WHERE email = ? and valid='Y'</value>
</property>
</bean>
<bean id="registrationAuthenticationProvider" class="net.sf.acegisecurity.providers.dao.DaoAuthe nticationProvider">
<property name="authenticationDao"><ref local="regAuthenticationDAO"/></property>
<property name="userCache"><ref local="acegiUserCache"/></property>
</bean>
<bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderMana ger">
<property name="providers">
<list>
<ref local="registrationAuthenticationProvider"/>
<ref local="rememberMeAuthenticationProvider"/>
</list>
</property>
</bean>
This has been working fine but what we now need to do is to chain another authentication provider. I've read that 0.8.* doesn't do this very elegantly but 0.9 does. So off I go and download the 0.9 jar and find that the getters and setters for both usersByUsernameMapping and authoritiesByUsernameMapping have been refactored out and that the MappingSqlQuery inner classes are now private.
I have 2 questions:
1. How do I now customize the queries?
2. Why!?!? This really irritating as I've already had to change all this once before when upgrading to 0.8 in the first place. I've also seen that all the packages have changed in 1.0. Should we go straight to that and avoid yet more refactoring hassle.
Many thanks
Charlie


After a brief but bloody struggle with the new configuration all is working perfectly.
