开发者

How to redirect depending of the role with Grails Acegi on weblogic

开发者 https://www.devze.com 2023-02-10 09:48 出处:网络
in my index.gsp, I have this : <g:ifAnyGranted role=\"IS_AUTHENTICATED_ANONYMOUSLY\"> <% response.sendRedirect(\"login/auth\"); %>

in my index.gsp, I have this :

<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>

If I run it on tomcat, that's work fine.

But after a deployment on weblogic 11g, it's not working.

Do you have an idea ?开发者_如何转开发

Thanks a lot


I would recommend doing this in the controller, not the view.

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

精彩评论

暂无评论...
验证码 换一张
取 消