Spring Security and JSF redirection after connection does not work

advertisements

I am trying to integrate Spring Security with my JSF application. I am able to get to make the login page show up, but after a successful login, the protected URL does not show up, it stays on the login page.

My applicationContext.xml:

    <security:http auto-config="true" access-denied-page="/login/loginerror.jspx">
    <security:intercept-url pattern="/restricted/**" access="ROLE_SU"/>
    <security:form-login login-page="/login/login.jspx"
                         default-target-url="/restricted/equipment.jspx"/>
    <security:logout logout-success-url="/logoutSuccess.jspx"/>
</security:http>

<security:authentication-provider user-service-ref="userDetailsService"/>

<bean id="userDetailsService" class="com.teach.security.UserDetailsServiceImpl">
    <property name="rolesDao" ref="RolesDAO"/>
</bean>

My JSF managed bean, the method that get called when the user hits submit on the login page:

public void login()
{
FacesContext.getCurrentInstance().getExternalContext().redirect("/spring-authentication/j_spring_security_check?j_username=" + userId + "&j_password=" + password);
}

My Java console confirms a successful login, it says "login successful"


Just to be sure, you are not using an AJAX submit but a standard HTML form submit, is that right?