Spring oauth / token返回404错误

时间:2016-03-15 10:32:29

标签: java spring spring-mvc oauth

我使用Spring oAuth2身份验证收到404错误。我的web.xml看起来像这样:

   <!-- Servlets -->
   <servlet>    
       <servlet-name>servlet</servlet-name>
       <servlet-class>
           org.springframework.web.servlet.DispatcherServlet
       </servlet-class>
       <load-on-startup>1</load-on-startup>
   </servlet>
<servlet-mapping>
       <servlet-name>servlet</servlet-name>
       <url-pattern>/v1/*</url-pattern>
   </servlet-mapping>

当我将url-pattern更改为'/ *'时,我将获得带有访问令牌的Status 200。这是web.xml中的剩余代码段:

      <!-- Loads Spring Security config file -->
   <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/spring-security.xml,                     
        </param-value>
    </context-param>

<!-- Spring Security -->

 <!-- filters -->
  <filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    <init-param>
      <param-name>contextAttribute</param-name>
      <param-value>org.springframework.web.servlet.FrameworkServlet.CONTEXT.servlet</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

我想使用<url-pattern>/v1/*</url-pattern>来完成这项工作。请帮忙。

0 个答案:

没有答案