【问题标题】:How to redirect depending of the role with Grails Acegi on weblogic如何根据 weblogic 上的 Grails Acegi 的角色进行重定向
【发布时间】:2011-06-27 17:13:19
【问题描述】:

在我的 index.gsp 中,我有这个:

<g:ifAnyGranted role="IS_AUTHENTICATED_ANONYMOUSLY">
  <% response.sendRedirect("login/auth"); %>
</g:ifAnyGranted>
<g:ifAnyGranted role="ROLE_ADMIN">
  <% response.sendRedirect("admin/tasks"); %>
</g:ifAnyGranted>
<g:ifAnyGranted role="ROLE_VIEWER_I, ROLE_VIEWER_E">
  <% response.sendRedirect("items/list"); %>
</g:ifAnyGranted>

如果我在 tomcat 上运行它,那就没问题了。

但是在 weblogic 11g 上部署后,它就无法正常工作了。

你有什么想法吗?

非常感谢

【问题讨论】:

    标签: grails weblogic spring-security


    【解决方案1】:

    我建议在控制器而不是视图中执行此操作。

    class SomeController {   
       def springSecurityService   
       def someAction = {
          if (springSecurityService.isLoggedIn()) {
             response.sendRedirect(...)
          }
          else {
             response.sendRedirect(...)
          }
       }
    }
    

    【讨论】:

    • 是的,这是我的新实现。非常感谢。
    • 很奇怪。我添加了这个实现,但现在它不适用于 weblogic。我创建了另一个主题:stackoverflow.com/questions/6190651/… 你能再帮我一次吗?
    猜你喜欢
    • 2020-03-11
    • 2021-09-17
    • 2023-03-27
    • 2019-01-24
    • 2014-07-03
    • 1970-01-01
    • 2011-05-30
    • 1970-01-01
    • 2010-12-24
    相关资源
    最近更新 更多