I am looking at the documentation of the grails spring security core v3. Grails Spring Security Plugin v3 My aim is to configure url mappings in the yml file, as opposed to it being scattered throughout the code. Their documentation says, that to do this, we must do two things. First, set the
securityConfigType: 'InterceptUrlMap'
and then outline our patterns in the following format:
grails.plugin.springsecurity.interceptUrlMap = [
[pattern: '/', access: ['permitAll']]
]
so I have done just that, in the code below: (Note, this is from their documentation, copied and pasted)
grails:
plugin:
springsecurity:
securityConfigType: 'InterceptUrlMap'
interceptUrlMap: [
[pattern: '/', access: ['permitAll']],
[pattern: '/error', access: ['permitAll']],
[pattern: '/index', access: ['permitAll']],
[pattern: '/index.gsp', access: ['permitAll']],
[pattern: '/shutdown', access: ['permitAll']],
[pattern: '/assets/**', access: ['permitAll']],
[pattern: '/**/js/**', access: ['permitAll']],
[pattern: '/**/css/**', access: ['permitAll']],
[pattern: '/**/images/**', access: ['permitAll']],
[pattern: '/**/favicon.ico', access: ['permitAll']],
[pattern: '/login/**', access: ['permitAll']],
[pattern: '/logout/**', access: ['permitAll']]
]
However, when trying to access my webpage, with the newly built war file, I get an error stating this:
groovy.lang.MissingMethodException: No signature of method: grails.plugin.springsecurity.ReflectionUtils$_splitMap_closure5.doCall() is applicable for argument types: (java.util.ArrayList) values: [[[pattern:/], [access:[permitAll]]]]
Possible solutions: doCall(java.util.Map), findAll(), findAll(), isCase(java.lang.Object), isCase(java.lang.Object)
I am not sure what the issue here is. If i make grails 3.0 use the s2-quickstart generated groovy script, everything works as intended. However, considering 100% of my other configuration is in the YML file, I certainly do not want to go that route.
Am I missing some obvious property here, that needs to be set?
After looking at that error, what I did is I tried to create the mappings using a list of maps. So your code, would turn to something like this:
interceptUrlMap: [
{pattern: '/', access: ['permitAll']},
{pattern: '/error', access: ['permitAll']},
{pattern: '/index', access: ['permitAll']},
{pattern: '/index.gsp', access: ['permitAll']},
{pattern: '/shutdown', access: ['permitAll']},
{pattern: '/assets/**', access: ['permitAll']},
{pattern: '/**/js/**', access: ['permitAll']},
{pattern: '/**/css/**', access: ['permitAll']},
{pattern: '/**/images/**', access: ['permitAll']},
{pattern: '/**/favicon.ico', access: ['permitAll']},
{pattern: '/login/**', access: ['permitAll']},
{pattern: '/logout/**', access: ['permitAll']}
]
I have used this on my local Grails 3.0 application, and it seems to work just fine.