Grails, SpringSecurity - disable redirection if not registered
What you want to do is set up authenticationEntryPoint, which can usually be done in spring / resources.groovy. If you are having difficulty finding the notation in the Spring Security Core plugin documentation, but there is a discussion about Jira tickets that links to it:
In one of our projects, we wanted to submit a 403 response, so we added this line to the .groovy resources:
Hope it helps.
source to share