Skip to content

setting adh.errorPage to null causes Tomcat to fail on startup #635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jknudsen opened this issue Apr 29, 2021 · 2 comments
Closed

setting adh.errorPage to null causes Tomcat to fail on startup #635

jknudsen opened this issue Apr 29, 2021 · 2 comments

Comments

@jknudsen
Copy link
Contributor

jknudsen commented Apr 29, 2021

Setting the adh.errorPage to null causes an Application run failed message with an Exception provided below. Per the documentation null is valid and is what I have used with past versions of this plugin prior to the version 4 for Grails 4.

Steps to Reproduce

  1. Create Application and add the Spring Secuirty Plugin to build.gradle
  2. Set the adh.errorPage to null in application.yml

grails:
plugin:
springsecurity:
adh:
errorPage: null

Expected Behavior

Documentation says it should send a 403:

Location of the 403 error page (or set to null to send a 403 error and not render a page)

Actual Behaviour

Caused by: org.springframework.beans.PropertyBatchUpdateException: Failed properties: Property 'errorPage' threw exception; nested exception is java.lang.AssertionError: ErrorPage must begin with '/'. Expression: ((page == null) || page.startsWith(/)). Values: page =
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:135)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:79)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1705)
... 77 common frames omitted

Environment Information

  • Operating System: Windows 10
  • GORM Version: 7.0.8.RELEASE
  • Grails Version (if using Grails): 4.0.10
  • JDK Version: 8u152 tried 11 also
  • SpringSecurityPlug: org.grails.plugins:spring-security-core:4.0.3

Example Application

https://github.com/jknudsen/testspp

jknudsen added a commit to jknudsen/grails-spring-security-core that referenced this issue Apr 29, 2021
Per the documentation the adh.errorPage can have a null value see issue apache#635 for details
@sdelamo
Copy link
Contributor

sdelamo commented Nov 4, 2021

@jknudsen I don't think it is possible to map a null with yaml and spring boot](spring-projects/spring-framework#19986).

However, you can use application.groovy application.yml or both in Grails 4 or 5 applications.

Thus, you can use application.yml for everything and have an extra file at grails-app/conf/application.groovy

with the content:

grails.plugin.springsecurity.adh.errorPage = null

@sdelamo
Copy link
Contributor

sdelamo commented Nov 4, 2021

I have created a repo with a three and a five Grails applications:

https://github.com/grails-core-issues-forks/-grails-spring-security-core-issue-635-

Both behave the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants