Grails, SpringSecurity - disable redirection if not registered

How do I configure grails to not redirect the user / user to the login page if it tries to access a protected resource. I just want to send a 401 status error to redirect to the main page.

+3


source to share


1 answer


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:

https://github.com/alvarosanchez/grails-spring-security-rest/issues/51

In one of our projects, we wanted to submit a 403 response, so we added this line to the .groovy resources:



AuthenticationEntryPoint (org.springframework.security.web.authentication.Http403ForbiddenEntryPoint)

Hope it helps.

+1


source







All Articles