Skip to content
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

Grails4 Could not find matching constructor for InterceptedUrl #11384

Closed
3 of 4 tasks
kszymko opened this issue Aug 9, 2019 · 8 comments
Closed
3 of 4 tasks

Grails4 Could not find matching constructor for InterceptedUrl #11384

kszymko opened this issue Aug 9, 2019 · 8 comments

Comments

@kszymko
Copy link

kszymko commented Aug 9, 2019

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. generate the simple app:
    grails create-app helloworld4
  1. in build.gradle add dependencies:
dependencies {
    ...
    compile 'org.grails.plugins:spring-security-core:4.0.0.RC2'
    compile 'org.springframework.security:spring-security-core:5.1.5.RELEASE'
}
  1. in application.yml add:
grails:
    plugin:
        springsecurity:
            # Whether the plugin is enabled
            active: true
            interceptUrlMap:
                - { pattern: '/assets/**',               access: ['permitAll'] }
                - { pattern: '/css/**',                  access: ['permitAll'] }
                - { pattern: '/images/**',               access: ['permitAll'] }
            securityConfigType: 'InterceptUrlMap'
  1. gradle clean bootRun

Expected Behaviour

Application should start without any problems.

Actual Behaviour

Exception is thrown:

groovy.lang.GroovyRuntimeException: Could not find matching constructor for: grails.plugin.springsecurity.InterceptedUrl(String, ArrayList, org.grails.config.NavigableMap$NullSafeNavigator)

Environment Information

  • Operating System: Win 10
  • Grails Version: 4.0.0
  • JDK Version: 1.8.0_221
  • Container Version (If Applicable): N/A

Example Application

  • N/A
@kszymko kszymko changed the title Grails4 Could not find matching constructor for: grails.plugin.springsecurity.InterceptedUrl(String, ArrayList, org.grails.config.NavigableMap$NullSafeNavigator) Grails4 Could not find matching constructor for InterceptedUrl Aug 9, 2019
@zoladkow
Copy link

zoladkow commented Aug 13, 2019

Putting those mappings in YAML is out of the picture now, you should move to application.groovy file as described in plugin documentation.
There is a note specifically saying why this changed, but cannot locate it now...

@kszymko
Copy link
Author

kszymko commented Aug 13, 2019

According to plugin documentation:

The Spring Security plugin maintains its configuration in grails-app/conf/application.groovy, although you can keep the plugin config in application.yml with the rest of the configuration if you prefer. Default values are in the plugin’s grails-app/conf/DefaultSecurityConfig.groovy file, and you add application-specific values to application.groovy (or application.yml). The default configuration is merged with your settings, with application values overriding the defaults and setting missing values.

I could NOT find anything saying that some Grails3 behaviour was dropped that's why I consider it a bug. Would be nice if you can point me to the doc where you have seen such an info. Thanks.

And by the way I know it works when put into application.groovy, but this should be put into migration info if it is really necessary.

@zyro23
Copy link
Contributor

zyro23 commented Aug 13, 2019

@zoladkow
Copy link

there https://grails-plugins.github.io/grails-spring-security-core/latest/#newInV3

There are a few breaking configuration changes as of version 3.0.0.M2. Prior to that version, some configuration properties were specified as a Map where the keys and values were both data. This caused various problems, primarily due to period characters in map keys. There are now no configuration properties that are single maps; all have been converted to lists of single-entry maps. This includes controllerAnnotations.staticRules and interceptUrlMap (see Configuring Request Mappings to Secure URLs), ipRestrictions (see IP Address Restrictions), filterChain.chainMap (see Filters), secureChannel.definition (see Channel Security), and failureHandler.exceptionMappings.

@kszymko
Copy link
Author

kszymko commented Aug 13, 2019

With compile 'org.grails.plugins:spring-security-core:3.2.3' the above configuration in application.yml works just fine in Grails3 app. So, documentation is misleading here.

Anyway this is NOT a single map it is list of maps which should work fine according to this:

There are now no configuration properties that are single maps; all have been converted to lists of single-entry maps.

@zoladkow
Copy link

Ok. I see your point. Also checked the actual source for InterceptedUrl, which does not seem to have changed at all. Anyway, wherever the magic matching the pattern: and access: to those constructor parameters was, it's clearly broken now...

@jameskleeh
Copy link
Contributor

Duplicate of grails/grails-spring-security-core#573

@rkimaoui
Copy link

I have the same problem when using application.yml

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

5 participants