Grails Acegi : Redirection on a ajax method and not on the webpage. 为什么?

标签 grails spring-security

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

我在 UrlMapping 中这样定义:

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

在我的 Controller 中:

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

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

你有什么想法吗?

非常感谢。

最佳答案

升级后可以正常使用 spring security

关于Grails Acegi : Redirection on a ajax method and not on the webpage. 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5858429/

相关文章:

java - 由 : java. lang.AbstractMethodError : com. myapp.webapp.config.WebConfig$$EnhancerBySpringCGLIB$$b5f5a3c0.configureContentNegotiation 引起

java - Spring Security Java 配置不会拦截访问仅适用于经过身份验证的源的 JSP 的请求

spring -/oauth/token 中的 XSRF token 无效

spring - Grails3 Spring Security Plugin RequestMap模式不起作用

grails - 如何在Grails中使JMS主题变量?

java - Spring Security Java Config 未生成注销 url

java - 如何在 spring boot 中从未经授权的响应中删除变量

unit-testing - 具有Spock模拟功能的Grails单元测试服务

grails - 在 Controller Action 运行时,显示用户消息

grails - 我可以在返回消息输入字符串和参数之前抓取Grails消息字符串吗?