Results 1 to 2 of 2

Thread: cannot forward to j_spring_security_check (SS 2.0.4/Tapestry5/JBoss 4.2.3)

  1. #1
    Join Date
    Nov 2008
    Posts
    7

    Default cannot forward to j_spring_security_check (SS 2.0.4/Tapestry5/JBoss 4.2.3)

    Hello,

    I'm trying to make form login work with Tapestry 5 and SS 2.0.4

    When the login form submission is made, the POST request ends up in Login.onSubmit() (where Login is the Java class corresponding to the form and onSubmit() is the submission handler). Well, the request should be forward to j_spring_security_check since I want to let SS handle security. The forward fails however with
    Code:
    The requested resource (/myapp/j_spring_security_check) is not available.
    If I hit /myapp/j_spring_security_check directly from a browser, the URL exists (if I do a GET there is the expected exception about null credentials, that's ok, it proves the execution path is the right one).

    From Login.java I perform a simple forward:
    Code:
    request.getRequestDispatcher("/j_spring_security_check").forward (request, response);
    (BTW, I've also tried without the / in the front, no change.

    If I step through the code, it only happens inside Tomcat's classes, never hitting Spring. Which means a forward doesn't go through Spring. Is there a way to do this?

    web.xml contains the following:

    Code:
        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>
    
        <filter>
            <filter-name>TapestryFilter</filter-name>
            <filter-class>org.apache.tapestry5.spring.TapestrySpringFilter</filter-class>
        </filter>
    
        <filter-mapping>
            <filter-name>TapestryFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    
        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    my applicationContext-security.xml (included in the main applicationContext.xml) has the following
    Code:
     <?xml version="1.0" encoding="UTF-8"?>
    
    <b:beans xmlns="http://www.springframework.org/schema/security"
        xmlns:b="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                            http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">
    
        <http>
            <intercept-url pattern="/" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
            <intercept-url pattern="/Start" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
            <intercept-url pattern="/Login" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
            <intercept-url pattern="/protected/**" access="ROLE_USER"/>
    
            <form-login login-page="/Login"
                        default-target-url="/Start"
                        authentication-failure-url="/Login?login_error=1" login-processing-url="/j_spring_security_check"/>
            <anonymous />
            <logout logout-success-url="/Start"/>
        </http>
    
       <authentication-provider user-service-ref="myUserDetailsService">
       </authentication-provider>
    </b:beans>
    Any advice is highly appreciated.

    Thanks,
    JL

  2. #2
    Join Date
    Nov 2008
    Posts
    7

    Default found the solution

    Adding the <dispatcher> elements solved it.


    Code:
       <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
            <dispatcher>FORWARD</dispatcher>
            <dispatcher>REQUEST</dispatcher>
        </filter-mapping>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •