我有以下 servlet 定义:
<servlet>
<servlet-name>licenseGenService</servlet-name>
<servlet-class>org.springframework.web.context.support.HttpRequestHandlerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>licenseGenService</servlet-name>
<url-pattern>/remoting/licensing</url-pattern>
</servlet-mapping>
<!-- Restful API Servlet-->
<servlet>
<servlet-name>licensingRestService</servlet-name>
<servlet-class>
com.sun.jersey.spi.spring.container.servlet.SpringServlet
</servlet-class>
<init-param>
<param-name>
com.sun.jersey.config.property.packages
</param-name>
<param-value>
com.mydomain.licensing.rest
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>licensingRestService</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
然后是以下安全过滤器:
<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>
因此,根据我所阅读的内容,/*
具有显式 url 的 url 模式会被覆盖。这适用于我的 servlet。问题是,我不想要licenseGenService
servlet 所需的基本身份验证。如何将安全过滤器定义为仅适用于 REST servlet,而不适用于那个licenseGenService
?