Here is my problem: I don't want to use any of the spring security kernel filters when the user uses the API (basically all / myapi / ** request) to avoid creating a useless session. Api is based on the oauth icon.
So, I use the spring-security-core plugin to authenticate the user, and I added Config.groovy to my file
grails.plugins.springsecurity.filterChain.chainMap = [ '/myapi/**': 'JOINED_FILTERS,-securityContextPersistenceFilter,-logoutFilter,-authenticationProcessingFilter,-securityContextHolderAwareRequestFilter,-rememberMeAuthenticationFilter,-anonymousAuthenticationFilter,-exceptionTranslationFilter', '/**':'JOINED_FILTERS' ]
Basically, from what I understood, it should not go through any spring security filter for all / myapi / something, but, in fact, it goes through all filters as it creates a session (I do not have everything for the session in / myapi / something.
But according to http://grails-plugins.github.com/grails-spring-security-core/docs/manual/guide/16%20Filters.html
So, you need the / ** catch-all rule at the end for URLs that don't match one of the earlier rules.
And that’s why I don’t understand why the request still goes through all the filters for any / myapi / something.
Some tests I have done can help:
It does not create a session if I only have in my Config.groovy:
grails.plugins.springsecurity.filterChain.chainMap = [ '/myapi/**': 'JOINED_FILTERS,-securityContextPersistenceFilter,-logoutFilter,-authenticationProcessingFilter,-securityContextHolderAwareRequestFilter,-rememberMeAuthenticationFilter,-anonymousAuthenticationFilter,-exceptionTranslationFilter' ]
But it also does not create a session for other URLs without using any other filter, which makes the application work not normally. This example was just to make sure that the session was not created using the / myapi / something query
If I only have:
grails.plugins.springsecurity.filterChain.chainMap = [ '/myapi/**': 'JOINED_FILTERS' ]
Then it goes through all the filters for all / myapi / something request and creates a session. It does not use a filter for another request. This is an excluded behavior.
Thanks so much for your help, I struggled with this several times now, and any ideas would be more than welcome!
Thanks a lot! Have a good day.