Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-26627

Properly handle filter mapping when registering a servlet filter for tests

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.10
    • Component/s: Tests
    • Tags:
    • Sprint:
      nxfit 10.10.5
    • Story Points:
      2

      Description

      When running TestOAuth2Challenge we've noticed this strange behavior:
      registering a servlet filter with any filter mapping associates the filter to any servlet path.

      For instance, with the following contribution:

        <extension target="org.nuxeo.runtime.server" point="filter">
          <filter context="/">
            <filter-name>NuxeoAuthenticationFilter</filter-name>
            <filter-class&gt;org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter</filter-class&gt;
            <display-name>Nuxeo Authentication Filter</display-name>
            <filter-mapping>
              <url-pattern>/authentication/*</url-pattern>
              <dispatcher>REQUEST</dispatcher>
              <dispatcher>FORWARD</dispatcher>
            </filter-mapping>
          </filter>
        </extension>
      

      calling /bla/xxx goes through the Nuxeo Authentication Filter.

      We would expect to only go through the filter for request paths matching the URL pattern defined in the filter mapping.

      This is because of the following code, see NXP-2449:

      filterMap.addServletName("*");
      

      which sets matchAllServletNames = true in Tomcat's FilterMap class.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h