I found an example of simple grails auth, where beforeInterceptor is used in the controller to redirect users if they are not logged in. It looks like this:
def beforeInterceptor = [action:this.&checkUser,except:['login']]
def checkUser() {
if(!session.user) {
redirect(controller:'home')
return false
}
}
This is good and good if you have only one controller that you must provide. What happens when you have more than one? I cannot put a method checkUserin a service because the service cannot redirect and probably does not have an object session. Please, help
source
share