java - Spring Security lgoin always redirecting to authentication failure URL -
i rather new programming please me out bit here.
i have configured spring security
fetch user details database , when try login following accounts:
- user1 - password1
- admin - password1
the authentication fails redirect me home.jsp/ops=999
login page. user record exists in database cannot seem log in.
this security config xml file.
<http auto-config="true"> <form-login login-page='/home.jsp?ops=9999' default-target-url='/secure/user.jsp' always-use-default-target='true' /> <logout logout-success-url="/home.jsp" logout-url="/j_spring_security_logout" /> </http> <authentication-provider> <jdbc-user-service data-source-ref="application.datasource2" users-by-username-query="select username, password user lower(username) = lower(?)"/> </authentication-provider>
i doing without authentication/authorities login not working. of possible reasons authentication failure? database connection play part? please me out.
thank in advance!
i suggest add intercept-url
. , should below:
<http auto-config="true" use-expressions="true" disable-url-rewriting="true"> <intercept-url pattern="/home.jsp**" access="isanonymous()"/> <intercept-url pattern="/secure/extreme/**" access="hasrole('role_operator')" /> <intercept-url pattern="/secure/**" access="hasrole('role_user')" /> <intercept-url pattern="/**" access="isauthenticated()" /> <form-login login-page='/home.jsp?ops=9999' default-target-url='/secure/user.jsp' always-use-default-target='true' /> <logout logout-success-url="/home.jsp" logout-url="/j_spring_security_logout" /> </http>