Announcement Announcement Module
Collapse
No announcement yet.
Getting a 404 when I try and submit to "/j_spring_security_check" Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting a 404 when I try and submit to "/j_spring_security_check"

    Hi,

    I'm using Spring 3.1.1.RELEASE with the accompanying Spring security. I'm hoping there's something really obvious I'm missing because I repeatedly get 404s when I try and submit to my Spring security check URL -- "/j_spring_security_check". I want to use a custom authentication filter. Below is my Spring security config

    Code:
    	<global-method-security pre-post-annotations="enabled">
    	</global-method-security>
    
        <beans:bean id="pdUsernamePasswordUrlAuthenticationFilter" 
        	class="org.mainco.subco.myproject.security.subcoUsernamePasswordUrlAuthenticationFilter">
    	    <beans:property name="filterProcessesUrl" value="/j_spring_security_check"/>
    	    <beans:property name="authenticationManager" ref="authenticationManager"/>
    	    <beans:property name="authenticationFailureHandler">
    	        <beans:bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
    	            <beans:property name="defaultFailureUrl" value="/pdregistration/loginfailure"/>
    	        </beans:bean>
    	    </beans:property>
        	<beans:property name="authenticationSuccessHandler">
    			<beans:bean class="org.mainco.subco.myproject.security.web.authentication.PDRegistrationAuthenticationSuccessHandler"> 
    				<beans:property name="defaultTargetUrl" value="/pdregistration/authenticate" />
    			</beans:bean>
    		</beans:property>
        </beans:bean>
        
    	<beans:bean id="loginUrlAuthenticationEntryPoint"
    		class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
    		<beans:property name="loginFormUrl" value="/login" />
    	</beans:bean>
    
    	<beans:bean id="subcoSecurityContextRepository"
    		class="org.mainco.subco.myproject.security.subcoSecurityContextRepository" />
    
    	<!--  Reg controller for PD -->
        <http pattern="/pdregistration/*" name="pdSecurity" auto-config="false" use-expressions="true" authentication-manager-ref="authenticationManager" access-denied-page="/denied" entry-point-ref="loginUrlAuthenticationEntryPoint">
    		<custom-filter position="FORM_LOGIN_FILTER" ref="pdUsernamePasswordUrlAuthenticationFilter"/>
    		<intercept-url pattern="/pdregistration/regfailure" access="hasAnyRole('Teacher')"/>
    		<intercept-url pattern="/pdregistration/regsuccess" access="hasAnyRole('Teacher')"/>
    		<intercept-url pattern="/pdregistration/errors/*" access="permitAll" />
    		<logout invalidate-session="true" 
    			logout-success-url="/logout" 
    			logout-url="/j_spring_security_logout" />
    	</http>
    	
    	<authentication-manager alias="authenticationManager" id="authenticationManager">
    		<authentication-provider user-service-ref="sbdUserDetailsService">
    			<password-encoder ref="passwordEncoder" />
    		</authentication-provider>
    	</authentication-manager>
    Here is the Spring security filter in my web.xml file

    Code:
    	<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>
    	</filter-mapping>
    What else am I missing? Note that I define "j_spring_security_check" as the "filterProcessesUrl" of my "pdUsernamePasswordUrlAuthenticationFilter" filter.

    The log entry I get is

    Code:
    09:33:29,134 WARN  [org.springframework.web.servlet.PageNotFound] (http--127.0.0.1-8080-4) No mapping found for HTTP request with URI [/myproject/j_spring_security_check] in DispatcherServlet with name 'myprojectDispatcher'
    Thanks for any advice, - Dave

  • #2
    What does the code for subcoUsernamePasswordUrlAuthenticationFilter look like? Did you add a debug point to the requiresAuthention method?

    Comment

    Working...
    X