How to redirect depending of the role with Grails Acegi on weblogic
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(...)
}
}
}
精彩评论