Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Upgrading to Spring Security 3.1 is really the best way to do this cleanly. If you can't do that you can still achieve the desired result but it's not going to be as pretty. If your resources are cleanly separated in the URL space (as they appear to be) you can add a second Spring Security filter covering only the /api resources and make sure it applies before the default one. To separate the configuration in Spring Security 3.0 you need a separate application context for your second filter, and configure the filter to find it in a well-known place - e.g. a DispatcherServlet creates a context and stores it in the servlet context in an attribute related to its name ("api" in the example below):</p> <pre><code>&lt;filter&gt; &lt;filter-name&gt;apiSecurityFilterChain&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt; &lt;init-param&gt; &lt;param-name&gt;contextAttribute&lt;/param-name&gt; &lt;param-value&gt;org.springframework.web.servlet.FrameworkServlet.CONTEXT.api&lt;/param-value&gt; &lt;/init-param&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;apiSecurityFilterChain&lt;/filter-name&gt; &lt;url-pattern&gt;/api/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;servlet&gt; &lt;servlet-name&gt;api&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;/servlet&gt; </code></pre> <p>The dispatcher servlet in this example has an application context at <code>/WEB-INF/api-servlet.xml</code> which contains a Spring Security filter chain with <code>id="apiSecurityFilter"</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload