【问题标题】:Spring Boot + Spring Security + Custom filter(siteminder) - Infinte LoopSpring Boot + Spring Security + 自定义过滤器(siteminder) - 无限循环
【发布时间】:2014-11-10 19:00:21
【问题描述】:

我正在尝试为我的 Spring Boot webapp 配置自定义安全过滤器。最初我将其配置为从 Angular JS 自定义表单登录,但现在我试图分离该配置并实现 Siteminder SSO 过滤器。我正在使用 Spring 提供的 RequestHeaderAuthenticationFilter 。我也会发布配置。但是当我添加这个配置时,当我在服务器启动后拉起我的 webapp 时,它会进入一个无限循环。这是无限循环。如果您想查看其他配置或详细信息,请告诉我,但这一周以来一直困扰着我。任何帮助将不胜感激。谢谢!

======================Infinite Loop Start=========================

[ERROR] org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mpe].[dispatcherServlet] - Servlet.service() for servlet dispatcherServlet threw exception
java.lang.StackOverflowError: null
    ====================================624 Times Start=============================================
    at javax.servlet.ServletRequestWrapper.isAsyncStarted(ServletRequestWrapper.java:390) ~[servlet-api.jar:3.0.FR]
    =====================================624 Times End============================================

    at org.apache.catalina.core.ApplicationDispatcher.unwrapRequest(ApplicationDispatcher.java:846) ~[catalina.jar:7.0.55]

    ====================================40Times Start====================
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) ~[catalina.jar:7.0.55]
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) ~[catalina.jar:7.0.55]
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) ~[catalina.jar:7.0.55]
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) ~[catalina.jar:7.0.55]
    at org.springframework.boot.context.web.ErrorPageFilter.forwardToErrorPage(ErrorPageFilter.java:155) ~[spring-boot-1.1.3.RELEASE.jar:1.1.3.RELEASE]
    at org.springframework.boot.context.web.ErrorPageFilter.handleException(ErrorPageFilter.java:138) ~[spring-boot-1.1.3.RELEASE.jar:1.1.3.RELEASE]
    at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:108) ~[spring-boot-1.1.3.RELEASE.jar:1.1.3.RELEASE]
    at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:89) ~[spring-boot-1.1.3.RELEASE.jar:1.1.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) ~[catalina.jar:7.0.55]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) ~[catalina.jar:7.0.55]
    ====================================40 Times End===========================================

    ====================================Infinite Loop End============================================

【问题讨论】:

    标签: spring spring-security spring-boot


    【解决方案1】:

    我从堆栈跟踪中看到 Spring Boot 的 ErrorPageFilter 参与了无限循环,并且您使用的是 Spring Boot 的 1.1.3.RELEASE 版本。 Spring Boot 1.1.5 中的 change was made 以确保其 ErrorPageFilter 在每个请求中仅被驱动一次。您应该升级到最新版本的 Spring Boot(在撰写本文时为 1.1.8.RELEASE)。它要么完全解决您的问题,要么在无限循环结束后让您看到潜在的问题。

    【讨论】:

    • 老兄!你是救世主!!非常感谢!我希望我早点以这种方式发布,而不是在它周围敲打我的头!
    【解决方案2】:

    无限循环是由于配置不正确造成的。一些常见的原因:

    • 如果您有一个“拒绝访问”页面,则不应使用您的安全过滤器对其进行保护。否则,安全过滤器将被无限调用。
    • 如果您使用 JSP 或其他模板技术,请检查您是否没有 infinitely recursive includes

    【讨论】:

      猜你喜欢
      • 2014-10-16
      • 2011-08-23
      • 2014-07-28
      • 2013-07-22
      • 2014-10-24
      • 1970-01-01
      • 1970-01-01
      • 2015-04-06
      • 2011-07-23
      相关资源
      最近更新 更多