authentication - j_spring_security_check 404 Error in JSF login -
i creating simple jsf login form spring security authentication:
<form action="#{request.contextpath}/j_spring_security_check" method="post"> <h:outputlabel for="j_username" value="username"/> <h:inputtext id="j_username"/> <br/> <h:outputlabel for="j_password" value="password"/> <h:inputsecret id="j_password"/> <br/> <h:commandbutton value="login"/> </form> and applicationcontext.xml:
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:security="http://www.springframework.org/schema/security" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> <security:http auto-config="true" use-expressions="true"> <security:intercept-url pattern="/login.xhtml" access="hasrole('is_authenticated_anonymously')"/> <security:intercept-url pattern="/**" access="hasrole('role_user')"/> <security:form-login login-page="/login.xhtml" default-target-url="/" authentication-failure-url="/login?login_error=1"/> </security:http> <security:authentication-manager> <security:authentication-provider> <security:user-service> <security:user name="sajjad" password="200200" authorities="role_user"/> </security:user-service> </security:authentication-provider> </security:authentication-manager> </beans> and web.xml:
<filter> <filter-name>springsecurityfilterchain</filter-name> <filter-class>org.springframework.web.filter.delegatingfilterproxy</filter-class> </filter> <filter-mapping> <filter-name>springsecurityfilterchain</filter-name> <url-pattern>/*</url-pattern> <dispatcher>forward</dispatcher> </filter-mapping> <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/applicationcontext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> and faces-context.xml:
<application> <el-resolver>org.springframework.web.jsf.el.springbeanfaceselresolver</el-resolver> </application> what wrong code?
add login-processing-url="/j_spring_security_check" <security:http>
Comments
Post a Comment