Grails 3 interceptors and controller by example -


i experimenting grails 3 , new concept of interceptors. given following interceptor/controller:

class authinterceptor {     // ...other stuff in here      boolean before() {         if(fizzbuzz.isfoo()) {             redirect(controller: auth, action: signin)             true         } else {             true         }     } }  class authcontroller {     authservice authservice      def signin() {         string username = params[username]         string password = params[password]         user = authservice.authenticate(username, password)          if(user) {             simplesecurityutils.setcurrentuser(user)             redirect(url: ??? intended_destination ???)         } else {             // auth failed.             redirect(action: failed)         }     } } 
  1. authservice grails service. there 1 instance of authservice per instance of authcontroller. , authcontroller have prototype scope such never storing state, , controller created each request. have change in both (authservice/authcontroller) meet these scope requirements?
  2. assuming authcontroller#signin executed due redirect(controller:auth, action: signin) inside interceptor, how redirect (yet again) user intended destination (that is, url wanted go prior interceptor intercepting request) inside controller action above?

first, if redirect url, must return false cancel rendering process, e.g.

 redirect(controller: auth, action: signin)  false 

second, if want previews intended url, must save it, may be, session, , redirect saved url when finish signin process.