Results 1 to 8 of 8

Thread: Upgrading to 0.8.0

  1. #1
    Join Date
    Aug 2004
    Location
    Denver
    Posts
    249

    Default Upgrading to 0.8.0

    I'm trying to upgrade to 0.8.0 and have a couple of questions. With 0.7.0, I only mapped the filters to specific URLs, so they didn't always get processes when they didn't need to be. With 0.8.0, I've tried to do the same thing (see below), but it doesn't seem to work. Should this be possible?

    Code:
        <bean id="filterChainProxy" class="net.sf.acegisecurity.util.FilterChainProxy">
            <property name="filterInvocationDefinitionSource">
                <value>
                    CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
                    PATTERN_TYPE_APACHE_ANT
                    /**=httpSessionContextIntegrationFilter
                    /j_security_check=authenticationProcessingFilter
                    /*.html*=anonymousProcessingFilter,securityEnforcementFilter
                </value>
            </property>
        </bean>
    Also, I noticed that ContextHolderAwareRequestFilter still needs to be added to my web.xml and it doesn't work if I add it as a mapping in the filterChainProxy bean. Is that as designed?

    When I put all the filters following each other after /**, like in the contacts example, everything works, but I'm unable to logout b/c I keep getting logged in again. Logout used to work before, but I suspect the map-to-everything scenario logging me in again shortly after I hit /logout.jsp - where my session is invalidated.

    Thanks,

    Matt

  2. #2

    Default

    Matt,

    I had the same problem with logging out. The authentication obj is no longer stored in the session as per the new docs. As a result, you can only pull it out via the context. So in order to logout the user you have to do ContextHolder.setContext(null);

    I'm not sure about your other questions, unfortunately.

    --Rexxe

  3. #3
    Join Date
    Aug 2004
    Location
    Denver
    Posts
    249

    Default

    Hmmm, this definitely seems like it might be a better choice architecturally, but this means I have to add Acegi-specific code into my app - whereas I never had to before. So far, I've been able to integrate Acegi Security and provide a clean path to back it out and use CMA. Oh well, I guess it's only one line users will have to change.

  4. #4

    Default

    I minimized my use of Ageci code by making a utility class. Then all I have to do is change one file.

  5. #5
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Hi Matt

    I think your issue is the FilterChainProxy, like the FilterSecurityInterceptor, both use FilterInvocationDefinitionSource. The default implementation parses top-down, stopping at the first matching Ant Path. As such your earlier /** would match anything, and that might be the issue. Perhaps try the following re-ordering so more specific URLs are at the top:

    Code:
        <bean id="filterChainProxy" class="net.sf.acegisecurity.util.FilterChainProxy">
            <property name="filterInvocationDefinitionSource">
                <value>
                    CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
                    PATTERN_TYPE_APACHE_ANT
                    /j_security_check=authenticationProcessingFilter
                    /*.html*=anonymousProcessingFilter,securityEnforcementFilter
                    /**=httpSessionContextIntegrationFilter
                </value>
            </property>
        </bean>

  6. #6
    Join Date
    Aug 2004
    Location
    Denver
    Posts
    249

    Default

    Quote Originally Posted by Ben Alex
    Hi Matt

    Perhaps try the following re-ordering so more specific URLs are at the top:

    Code:
        <bean id="filterChainProxy" class="net.sf.acegisecurity.util.FilterChainProxy">
            <property name="filterInvocationDefinitionSource">
                <value>
                    CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
                    PATTERN_TYPE_APACHE_ANT
                    /j_security_check=authenticationProcessingFilter
                    /*.html*=anonymousProcessingFilter,securityEnforcementFilter
                    /**=httpSessionContextIntegrationFilter
                </value>
            </property>
        </bean>
    I tried this and it first resulted in the following error when I first try to hit the application.

    Code:
    java.lang.IllegalStateException&#58; ContextHolder invalid&#58; 'null'&#58; are your filters ordered correctly? HttpSessionContextIntegrationFilter should have already executed by this time &#40;look for it in the stack dump below&#41;
    	at net.sf.acegisecurity.context.security.SecureContextUtils.getSecureContext&#40;SecureContextUtils.java&#58;38&#41;
    	at net.sf.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter&#40;AnonymousProcessingFilter.java&#58;136&#41;
    So I added httpSessionContextIntegrationFilter to the start of the /*.html* mapping and it resulted in a 404 when going to /j_security_check.

    This seems to be the only thing that works:

    Code:
        <bean id="filterChainProxy" class="net.sf.acegisecurity.util.FilterChainProxy">
            <property name="filterInvocationDefinitionSource">
                <value>
                    CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
                    PATTERN_TYPE_APACHE_ANT
                    /**=httpSessionContextIntegrationFilter,authenticationProcessingFilter,remoteUserFilter,anonymousProcessingFilter,securityEnforcementFilter 
                </value>
            </property>
        </bean>
    Matt

  7. #7
    Join Date
    Mar 2005
    Posts
    5

    Default

    I try try the following and it seem work fine, but I don't know the following is better or not?
    Code:
    <bean id="filterChainProxy" class="net.sf.acegisecurity.util.FilterChainProxy"> 
            <property name="filterInvocationDefinitionSource"> 
                <value> 
                    CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON 
                    PATTERN_TYPE_APACHE_ANT 
                    /j_security_check=httpSessionContextIntegrationFilter,authenticationProcessingFilter
                    /*.html*=ahttpSessionContextIntegrationFilter,nonymousProcessingFilter
                    /**=httpSessionContextIntegrationFilter,securityEnforcementFilter 
                </value> 
            </property> 
        </bean>

  8. #8
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Yes, you need HttpSessionContextIntegrationFilter in every mapping where Acegi Security filters or AbstractSecurityInterceptor subclasses will be used.

Similar Threads

  1. Replies: 1
    Last Post: Apr 8th, 2005, 05:51 PM
  2. Replies: 5
    Last Post: Mar 18th, 2005, 04:01 AM
  3. Replies: 0
    Last Post: Mar 15th, 2005, 06:37 AM
  4. Contacts Sample for CAS in version 0.8.0?
    By jpwinans in forum Security
    Replies: 1
    Last Post: Mar 8th, 2005, 04:47 PM
  5. Acegi Security 0.8.0 and subproject status
    By Ben Alex in forum Announcements
    Replies: 0
    Last Post: Mar 3rd, 2005, 11:44 PM

Posting Permissions

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