Grails 4: Is spring-security-ldap updated for Grails 4.0?

Viewed 382

I am upgrading my Grails 3.3.2 application to Grails 4.0.0.RC2 and all references to org.springframework.security.ldap classes are unresolved. I'm not sure if this is a matter of waiting for a later version of the plugin or if there's something different I should be doing for Grails 4. If I need to wait for a later version, is there an ETA on this?

I'm using this version in my build.gradle file:

compile "org.grails.plugins:spring-security-ldap:3.0.2"  

Here's an example of some unresolved errors:

unable to resolve class org.springframework.ldap.core.DirContextOperations
unable to resolve class org.springframework.ldap.core.DirContextAdapter
1 Answers

Due to Gradle change:

Separation of compile and runtime dependencies when consuming POMs

To use some Grails 3 plugins in Grails 4 apps you need to include their transitive dependencies directly. Otherwise they are not brought into the classpath.

The fix is to include the dependencies directly in your build.

ext {
    springSecurityVersion="5.1.6.RELEASE"
    springSecurityCoreVersion="4.0.0.RC2"
    springSecurityLdapVersion="3.0.2"

}
dependencies {
...
// Security
    compile "org.grails.plugins:spring-security-core:$springSecurityCoreVersion"
    compile ("org.grails.plugins:spring-security-ldap:$springSecurityLdapVersion") {
        exclude group: 'org.grails.plugins', module:'spring-security-core'
    }
    compile "org.springframework.security:spring-security-ldap:$springSecurityVersion", {
        ['apacheds-core', 'apacheds-core-entry', 'apacheds-protocol-ldap', 'apacheds-protocol-shared',
         'apacheds-server-jndi', 'commons-logging', 'fest-assert', 'jcl-over-slf4j', 'junit',
         'ldapsdk', 'logback-classic', 'mockito-core', 'shared-ldap', 'slf4j-api', 'spring-beans',
         'spring-context', 'spring-core', 'spring-ldap-core', 'spring-security-core',
         'spring-test', 'spring-tx'].each { exclude module: it }
    }

    compile 'org.springframework.ldap:spring-ldap-core:2.0.4.RELEASE', {
        ['commons-lang', 'gsbase', 'junit', 'mockito-core', 'powermock-api-mockito',
         'powermock-api-support', 'powermock-core', 'powermock-module-junit4',
         'powermock-module-junit4-common', 'powermock-reflect', 'slf4j-log4j12', 'spring-beans',
         'spring-core', 'spring-data-commons', 'spring-test', 'spring-tx'].each { exclude module: it }
    }

I took the transitive dependencies from the plugin:

https://github.com/grails-plugins/grails-spring-security-ldap/blob/master/build.gradle#L63-L76

Related