How to pass objects from interceptor to controller in Grails 3+
Typically in Grails 3, you have the option to not code the security layer using Grails Spring Security, and just write an interceptor to check for user roles to allow a user to access a particular endpoint. However the ways to pass an object from the interceptor to controller was not documented, so here I am writing this down so that I won’t forget.
In your interceptor
request.setAttribute(‘objectName’, object)
In your controller, access the object by using
request.objectName