Fail to locate j_spring_security_check in Spring Security

565 views Asked by At

I am working on spring Security, I am facing the issue "Problem accessing /CustomRole/j_spring_security_check"

My web.xml file is as follow

<sec:http auto-config="true" disable-url-rewriting="true"
    use-expressions="true">
    <!-- When access is refused, will go to the 403.jsp -->
    <sec:intercept-url pattern="/login.jsp" filters="none" />
    <sec:form-login login-page="/login.jsp"
        authentication-failure-url="/login.jsp?error=true"
        login-processing-url="/j_spring_security_check.action"
        default-target-url="/index.jsp"
        always-use-default-target="true" />
    <sec:logout logout-success-url="/login.jsp" />
    <sec:http-basic />
    <!-- An increase in filter and Acegi, this is not the same, can not modify 
        the default filter, the filter is located in the FILTER_SECURITY_INTERCEPTOR 
        before> -->
    <sec:custom-filter before="FILTER_SECURITY_INTERCEPTOR"
        ref="myFilter" />
</sec:http>

<!-- A custom filter, you must include the authenticationManager, accessDecisionManager, 
    securityMetadataSource three attributes, All control we will achieve in the 
    three class, explain the specific configuration, see> -->
<beans:bean id="myFilter"
    class="com.demo.security.MyFilterSecurityInterceptor">
    <beans:property name="authenticationManager" ref="authenticationManager" />
    <beans:property name="accessDecisionManager" ref="myAccessDecisionManagerBean" />
    <beans:property name="securityMetadataSource" ref="securityMetadataSource" />
</beans:bean>

<!-- The authentication manager, entrance for user authentication, which 
    implements the UserDetailsService interface can be -->
<authentication-manager alias="authenticationManager">
    <authentication-provider user-service-ref="myUserDetailService">
        <!-- If the user's password using encryption, you can add a little salt 
            "" <password-encoder hash="md5"/> -->
    </authentication-provider>
</authentication-manager>
<beans:bean id="myUserDetailService" class="com.demo.security.MyUserDetailService" />

<!-- Access decision device, determines whether a user has a role, that 
    you have sufficient permissions to access a resource -->
<beans:bean id="myAccessDecisionManagerBean" class="com.demo.security.MyAccessDecisionManager">
</beans:bean>

<!-- Resource source data definition, the definition of a resource can be 
    what role access -->
<beans:bean id="securityMetadataSource"
    class="com.demo.security.MyInvocationSecurityMetadataSource" />

After hitting the launch page it open login page successfully.But when i provide login credential and try to hit login it fails and throw error related to "j_spring_security_check"

I have created code as per the available on http://www.programering.com/a/MTNygjMwATY.html

0

There are 0 answers