Advertisements

Tuesday, August 8, 2017

Spring Security 4.0 problem authenticating - ALWAYS MOVING TO authentication-failure-url

This project is about authenticating using LDAP provider(ApacheDS), also I took the project from krams. I had to change the version of the spring security I used the following versions:




I did a lot of testing trying to make it work using context mapping example:

Using a RequestMapping path:



Also in the security spring


 at the web xml

Also what happened as well is that : at the form login in the security spring (check second image) file at the property login processing url instead of using the j_spring_security_check I used the login path, doing this I have solved the problem at the authentication part when entering the credentials it was always moving to the authentication failure url.




Keep in mind also we have to change the login page at the form tag and attribute attribute, I had to indicate as well using the login path.

Take a look in the previous image and it shows the login form using the input tags but named in the wrong way, leave it as it is it won't login as expected, the spring login form expects to receive the following names instead:




If we don't specify what is our custom login page, every time someone try to hit a page the does require login, it will redirect to the default login spring page instead of our custom. To fix this we need to specify the following in the security file:



When defining the logout form the key is to specify the log out tag in the spring security file, also implementing the url to do it is shown as follow:



No comments:

Post a Comment