Task List
Steps to Reproduce
- Create new Grails application and install Spring Security Core plugin v3.2.0
- In application.yml, under evnironments->development, add configuration grails.plugin.springsecurity.active: false
- Add <sec:ifAllGranted roles="ROLE_USER"> tag to the sample index.gsp homepage.
Expected Behaviour
If Spring Security Core plugin is disabled, tags from SecurityTagLib should be disabled as well.
Actual Behaviour
The following error is received:
Error executing tag <sec:ifAllGranted>: No bean named 'roleHierarchy' available
Stacktrace (partial):
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'roleHierarchy' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:687)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1218)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:284)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1086)
at grails.plugin.springsecurity.SpringSecurityUtils.getBean(SpringSecurityUtils.groovy:647)
at grails.plugin.springsecurity.SpringSecurityUtils.findInferredAuthorities(SpringSecurityUtils.groovy:642)
at grails.plugin.springsecurity.SpringSecurityUtils.ifAllGranted(SpringSecurityUtils.groovy:196)
at grails.plugin.springsecurity.SpringSecurityUtils.ifAllGranted(SpringSecurityUtils.groovy:192)
at grails.plugin.springsecurity.SecurityTagLib$_closure1.doCall(SecurityTagLib.groovy:62)
at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:446)
at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:364)
Other tags are also executed; for instance, if a block of text is surrounded with sec:ifLoggedIn and Spring Security is set active: false in application.yml, the block of text will not appear if the user is not logged in.
Environment Information
- Operating System: Windows 10
- GORM Version: 6.1
- Grails Version (if using Grails): 3.3.9
- JDK Version: 1.8.0_211
Example Application
Task List
Steps to Reproduce
Expected Behaviour
If Spring Security Core plugin is disabled, tags from SecurityTagLib should be disabled as well.
Actual Behaviour
The following error is received:
Error executing tag <sec:ifAllGranted>: No bean named 'roleHierarchy' availableStacktrace (partial):
Other tags are also executed; for instance, if a block of text is surrounded with sec:ifLoggedIn and Spring Security is set active: false in application.yml, the block of text will not appear if the user is not logged in.
Environment Information
Example Application