【问题标题】:Spring Security Refresh Error in Grails jQuery Mobile appGrails jQuery Mobile 应用程序中的 Spring Security 刷新错误
【发布时间】:2012-03-13 07:11:26
【问题描述】:

我有一个 Grails 2.0.1 jQuery Mobile 应用程序,这是我第一次使用 Spring Security。我遵循了 Peter Ledbrook 的 post 中的出色说明。

成功登录后,应用程序的使用和安全控制工作正常。但是,如果用户刷新浏览器,则会发生 AuthenticationServiceException。

登录后浏览器显示的网址是我的应用的根目录加上/j_spring_security_check

http://localhost:8080/myapp/j_spring_security_check

为什么这会附加到我的 URL 中?如果我手动编辑 URL 并指向应用程序的根目录,则重新加载浏览器没有问题。

【问题讨论】:

  • 我建议在 org.springframework.security 上启动日志记录...让我知道它在说什么
  • 调试级别登录没有什么特别突出的。这是我正在研究的一个警告,但它看起来并不相关:ApplicationContext not found in org.codehaus.groovy.grails.APPLICATION_CONTEXT attribute of servlet context
  • 这是正常的 btw .. 无法登录时出现的错误是什么?

标签: grails jquery-mobile spring-security


【解决方案1】:

尝试将data-ajax='false' 设置为表单元素

<form id="loginForm" name='f' action="<c:url value='/j_spring_security_check' />"
                method='POST'  data-ajax="false">

【讨论】:

  • 这对我有用!我非常感谢这一点。我工作了几天试图弄清楚为什么这不起作用。我也必须通过
    帖子将它添加到我的其他页面。
【解决方案2】:

很好的答案。请注意,在使用 Spring Security 时,应用 data-ajax='false' 也适用于 jQuery Mobile“signout”或“logout”按钮。也就是说:

<a href="j_spring_security_logout" data-role="button" data-direction="reverse" data-transition="fade" class="ui-btn-left" data-ajax="false">Sign Out</a>

【讨论】:

    猜你喜欢
    • 2016-01-30
    • 2011-11-01
    • 2013-09-24
    • 1970-01-01
    • 2019-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-02
    相关资源
    最近更新 更多