i am new at grails spring security, and i wanted to know if it is possible to enable/disable security of in my app thru an xml entry.
rather than having
grails.plugins.springsecurity.active = true
I d like to read the value from a bean that i declared in my resources.xml file.
grails.plugins.springsecurity.active = com.myorg.util.BeanUtil.getBean(“repositorySettings”).getIsSecured()
Using this approach throws errors. is there a way that i can accomplish this, and read the true/false value from a bean in the resources.xml
It’s somewhat possible.
resources.xmlandresources.groovyare loaded after the plugin is, but parsed before. So you can put code inresources.groovythat will run while it’s being parsed, before the plugin loads the config, and determines whether it’s enabled. But you can’t use a bean for that since it wouldn’t be ready until it’s too late. This wouldn’t be possible inresources.xmlsince that’s just XML butresources.groovyallows Groovy code and bean definitions:If
BeanUtilaccesses theApplicationContextthen this won’t work. But if it’s accessing singletons that aren’t Spring beans it should be fine.