I started to play with Acegi this weekend and made good progress. Everything is working very well until I tried to test login with wrong password.
Here is my setup: Basically, I have only two pages: /login.html and /home.html. Both pages are mapped to JSP pages with tiles using spring MVC. I created two authentication providers: daoAuthenticationProvider with InMemoryImpl and anonymousAuthenticationProvider. Anonymous users can only access /login.html and authenticated users can access both pages. The following is my authenticationProcessingFilter setup:
As you can see, the application should re-direct to /login.html?error=1 page when a wrong username or password is provided. The problem is that it re-directed to /login.html page but without the error parameter. After I enabled the DEBUG logs, I found the following:Code:<!-- Authentication processing filter --> <bean id="authenticationProcessingFilter" class="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilter"> <property name="authenticationManager"> <ref local="authenticationManager"/> </property> <property name="authenticationFailureUrl"> <value>/login.html?error=1</value> </property> <property name="defaultTargetUrl"> <value>/home.html</value> </property> <property name="filterProcessesUrl"> <value>/j_acegi_security_check</value> </property> </bean>
Somehow, the AuthenticationProcessingFilterEntryPoint redirects /login.html?error=1 to /login.html. So why is this happening? Did I configure anything wrong.Code:... <AccessDeniedException thrown> ... [DEBUG,SecurityEnforcementFilter,http-8080-Processor23] Authentication entry point being called; target URL added to Session: http://localhost:8080/testplan/login.html?error=1 [DEBUG,SecurityEnforcementFilter,http-8080-Processor23] Authentication entry point being called; target URL added to Session: http://localhost:8080/testplan/login.html?error=1 [DEBUG,SecurityEnforcementFilter,http-8080-Processor23] Authentication entry point being called; target URL added to Session: http://localhost:8080/testplan/login.html?error=1 [DEBUG,AuthenticationProcessingFilterEntryPoint,http-8080-Processor23] Redirecting to: http://localhost:8080/testplan/login.html [DEBUG,AuthenticationProcessingFilterEntryPoint,http-8080-Processor23] Redirecting to: http://localhost:8080/testplan/login.html [DEBUG,HttpSessionContextIntegrationFilter,http-8080-Processor23] Context stored to HttpSession: 'net.sf.acegisecurity.context.security.SecureContextImpl@18dfa76: Authentication: net.sf.acegisecurity.providers.anonymous.AnonymousAuthenticationToken@182c2d9: Username: anonymousUser; Password: [PROTECTED]; Authenticated: true; Details: null; Granted Authorities: ROLE_ANONYMOUS' [DEBUG,HttpSessionContextIntegrationFilter,http-8080-Processor23] ContextHolder set to null as request processing completed
Thanks for any help!
Kenny


