Hi,
I am trying to integrate Spring Security 3 with JSF2.0 (Apache Myfaces) to direct users to a login page when they attempt to access a page that requires authentication.
My applicationContext.xml looks like:
And the "login.html" looks like this:Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <security:http auto-config="true" access-denied-page="/index.jsf"> <security:intercept-url pattern="/authenticated/**" access="ROLE_BLAH_USER" /> <security:intercept-url pattern="/admin/**" access="ROLE_BLAH_ADMIN" /> <security:form-login login-page="/login.html" default-target-url="/authenticated/hello.html"/> <security:logout logout-success-url="/index.jsf" /> </security:http> <security:authentication-manager> <security:authentication-provider user-service-ref="userDetailsService"/> </security:authentication-manager> <bean id="userDetailsService" class="com.blah.security.spring.UserDetailsServiceImpl" /> </beans>
The "login.html" page correctly displays when a user attempts to view any page under the "/authenticated" directory of the webapp.HTML Code:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Blah title</title> </head> <body> <form action="j_spring_security_check" method="post"> <label for="j_username">User name</label> <input type="text" name="j_username" id="j_username"/> <br/> <label for="j_password">Password</label> <input type="password" name="j_password" id="j_password"/> <br/> <input type='checkbox' name='_spring_security_remember_me'/> Remember me on this computer. <br/> <input type="submit" value="Login"/> </form> </body> </html>
But after (I think, successful) login, I do not get redirected to the "default-target-url". It just stays on the same page (i.e. login.html). And I do not get any message saying "Bad Credentials" or anything when I login with an incorrect username and password.
I also do not get anything in my log that tells me that anything is wrong.
Can some one help me please?
Many thanks,
Glen![]()


Reply With Quote
