spring - The page is directed to /j_spring_security_check even after entering correct credentials -
i'm using spring security in spring project. following springsecurityconfiguration.xml file. after try log in using correct credentials, page redirects
please note falls beyond application terror movies. custom_login page presented @
<?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" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <security:http auto-config="true" use-expressions="true"> <security:expression-handler ref="expressionhandler" /> <security:intercept-url pattern="/admin/*" access="hasipaddress('127.0.0.1') , (isanonymous() ? false : principal.lastname== 'scarioni') , over18" /> <security:intercept-url pattern="/movies/**/*" access="hasrole('role_user')" /> <security:intercept-url pattern="/movies/*" access="hasanyrole('role_user','role_vip')" /> <security:intercept-url pattern="/j_spring_security_switch_user" access="hasrole('role_admin')" /> <security:intercept-url pattern="/j_spring_security_exit_user" access="hasrole('role_admin')" /> <security:intercept-url pattern="/custom_login" requires-channel="https" /> <security:intercept-url pattern="/j_spring_security_check" requires-channel="https" /> <security:remember-me key="terror-key" /> <security:logout delete-cookies="jsessionid" success-handler-ref="logoutredirecttoany" /> <security:custom-filter ref="switchuser" before="filter_security_interceptor" /> <security:form-login login-page="/custom_login" authentication-failure-handler-ref="servererrorhandler" username-parameter="user_param" password-parameter="pass_param" /> <security:session-management> <security:concurrency-control max-sessions="1" /> </security:session-management> </security:http> <security:authentication-manager> <security:authentication-provider user-service-ref="inmemoryuserservicewithcustomuser" /> </security:authentication-manager> <bean id="switchuser" class="org.springframework.security.web.authentication.switchuser.switchuserfilter"> <property name="userdetailsservice" ref="inmemoryuserservicewithcustomuser" /> <property name="targeturl" value="/" /> </bean> <bean id="expressionhandler" class="com.apress.pss.terrormovies.security.customwebsecurityexpressionhandler" /> <bean id="inmemoryuserservicewithcustomuser" class="com.apress.pss.terrormovies.spring.custominmemoryuserdetailsmanager"> <constructor-arg> <list> <bean class="com.apress.pss.terrormovies.model.user"> <constructor-arg value="admin" /> <constructor-arg value="admin" /> <constructor-arg> <list> <bean class="org.springframework.security.core.authority.simplegrantedauthority"> <constructor-arg value="role_admin" /> </bean> </list> </constructor-arg> <constructor-arg value="scarioni" /> <constructor-arg value="19" /> </bean> <bean class="com.apress.pss.terrormovies.model.user"> <constructor-arg value="paco" /> <constructor-arg value="tous" /> <constructor-arg> <list> <bean class="org.springframework.security.core.authority.simplegrantedauthority"> <constructor-arg value="role_user" /> </bean> </list> </constructor-arg> <constructor-arg value="miranda" /> <constructor-arg value="20" /> </bean> <bean class="com.apress.pss.terrormovies.model.user"> <constructor-arg value="lucas" /> <constructor-arg value="fernandez" /> <constructor-arg> <list> <bean class="org.springframework.security.core.authority.simplegrantedauthority"> <constructor-arg value="role_vip" /> </bean> <bean class="org.springframework.security.core.authority.simplegrantedauthority"> <constructor-arg value="role_user" /> </bean> </list> </constructor-arg> <constructor-arg value="silva" /> <constructor-arg value="20" /> </bean> </list> </constructor-arg> </bean> <bean id="logoutredirecttoany" class="org.springframework.security.web.authentication.logout.simpleurllogoutsuccesshandler"> <property name="targeturlparameter" value="redirectto" /> </bean> <bean id="servererrorhandler" class="com.apress.pss.terrormovies.security.servererrorfailurehandler" /></beans>
in
<security:form-login>
tags, add following application knows re-direct upon successful login attempt:
default-target-url="/movies"
Comments
Post a Comment