【问题标题】:Grails Acegi : Redirection on a ajax method and not on the webpage. Why?Grails Acegi:在 ajax 方法上而不是在网页上重定向。为什么?
【发布时间】:2011-08-17 00:53:16
【问题描述】:

我将 Acegi 与 grails 一起使用,但我遇到了重定向问题。

我在 UrlMapping 中定义了这个:

"/" { 
  controller = "mycontroller"
  action = "myaction"
}

在我的控制器中:

myaction = {
    if (authenticateService.isLoggedIn(){ "/mycontext/public" }
    else {
       // pseudo code
       if (role = ROLE_1) {
           redirect "/mycontext/myactionforNormalUser"
       }
       else if (role = ROLE_ADMIN) {
           redirect "/mycontext/myactionforROLEADMIN"
       }
    }
}

如果我在没有登录的情况下访问我的应用程序,我会被重定向到公共页面,所以这是正确的。 但是在管理员登录时,我被重定向到 auth/deniedAjax(acegi),而不是在我的页面上。 如果我以普通用户身份登录,我将重定向到我的 gsp 中定义的 ajax 方法。

你有什么想法吗?

非常感谢。

【问题讨论】:

  • 您可能不太幸运能在旧的、过时的、不受支持的插件上获得支持。你真的应该考虑升级到 spring-security-core 插件:burtbeckwith.github.com/grails-spring-security-core/docs/manual/…
  • +1 用于升级到 Spring Security
  • 我现在升级。我稍后会添加我的反馈。谢谢
  • 我升级到 SpringSecurity,它现在工作正常。谢谢
  • 但是现在,经过一些更改,它无法正常工作。在我登录后,用户被重定向到一个 ajax 方法。但默认网址是“/”。我不明白!

标签: grails spring-security


【解决方案1】:

现在使用 Spring Security 升级并正常工作

【讨论】:

    猜你喜欢
    • 2016-09-15
    • 1970-01-01
    • 2018-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-13
    • 2011-06-27
    • 1970-01-01
    相关资源
    最近更新 更多