Hi !
I am using Acegi to secure pages in my application (under /secure/* path). Everything works fine.
Now, I would like to use Acegi for simple authentication purpose on unsecured pages. The idea is to allow registered users to have 'extra' options on those public pages (with tag) without anoying everybody with systematic authentication.
So I thought "Easy !" : I added a 'login' button on those pages, that calls 'acegilogin.html' url and I'm getting my authentication page.
But when logged in, I am redirected to the defaultTargetUrl, not to the page from where I clicked on 'login'.
I guess this is because the url is not caught by the filter chain, so no SavedRequest object is created and no ACEGI_SAVED_REQUEST_KEY attribute can be found in session.
There's certainly a simple way to achieve what I want to do, but I can't find it. I have an idea, but quite difficult to do (pass a Request object, obtained from starting page, as parameter to the authentication page controller and recreate there a SavedRequest object then put it manually in session).
TIA for advises,
--
Arnaud
Here is my acegi context:
Code:<!-- ======================== FILTER CHAIN ======================= --> <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy"> <property name="filterInvocationDefinitionSource"> <value> CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON PATTERN_TYPE_APACHE_ANT /**=httpSessionContextIntegrationFilter,formAuthenticationProcessingFilter,exceptionTranslationFilter,filterSecurityInterceptor </value> </property> </bean> <!-- Start Security filter config --> <bean id="exceptionTranslationFilter" class="org.acegisecurity.ui.ExceptionTranslationFilter"> <property name="authenticationEntryPoint"> <ref bean="formLoginAuthenticationEntryPoint" /> </property> </bean> <bean id="formAuthenticationProcessingFilter" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter"> <property name="filterProcessesUrl"> <value>/j_acegi_security_check</value> </property> <property name="authenticationFailureUrl"> <value>/acegilogin.html?action=error</value> </property> <property name="defaultTargetUrl"> <value>/</value> </property> <property name="authenticationManager"> <ref bean="authenticationManager" /> </property> </bean> <bean id="formLoginAuthenticationEntryPoint" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint"> <property name="loginFormUrl"><value>/acegilogin.html</value></property> <property name="forceHttps"><value>false</value></property> </bean> <bean id="httpSessionContextIntegrationFilter" class="org.acegisecurity.context.HttpSessionContextIntegrationFilter"> </bean> <!-- End Security filter config --> <!-- Start Security interceptor config --> <!-- Define authentication manager, decision manager and secure URL patterns --> <bean id="filterSecurityInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor"> <property name="authenticationManager"> <ref bean="authenticationManager" /> </property> <property name="accessDecisionManager"> <ref bean="accessDecisionManager" /> </property> <property name="objectDefinitionSource"> <value> CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON PATTERN_TYPE_APACHE_ANT /secure/admin/**=ROLE_ADMIN /secure/**=ROLE_ADMIN,ROLE_USER </value> </property> </bean> <!-- End Security interceptor config --> <!-- Start authentication config --> <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager"> <property name="providers"> <list> <ref bean="daoAuthenticationProvider" /> </list> </property> </bean> <bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider"> <property name="userDetailsService"> <ref bean="userDetailsService" /> </property> </bean> <!-- Authentication using In-memory Dao --> <!-- <bean id="userDetailsService" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl"> <property name="userMap"> <value> arnaud=babou,ROLE_ADMIN </value> </property> </bean> --> <!-- Authentication using JDBC Dao --> <bean id="userDetailsService" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl"> <property name="dataSource"> <ref bean="pgDataSource"/> </property> </bean> <!-- End authentication config --> <!-- Start authorization config --> <bean id="accessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased"> <property name="allowIfAllAbstainDecisions" value="false" /> <property name="decisionVoters"> <list> <bean class="org.acegisecurity.vote.RoleVoter" /> </list> </property> </bean> <!-- End authorization config -->


