0

I'm attempting to package the spring-security-ldap and spring-security-core in a single plugin that supplies company standard domain-classes, controllers and some utilities. In addition, I would like to include LDAP configuration settings.

The intent is to create one plugin that all company applications can depend on for rapid development of new applications.

In my BuildConfig.groovy I have the following plugins:

compile ":spring-security-ldap:1.0.5"
compile ":spring-security-core:1.2.7"

Then in my plugin descriptor doWithSpring closure I have dynamic config settings:

config.grails.plugins.springsecurity.ldap.authorities.retrieveDatabaseRoles = true
config.grails.plugins.springsecurity.ldap.authorities.retrieveGroupRoles = true
config.grails.plugins.springsecurity.ldap.context.server = 'ldap://<myip>'
config.grails.plugins.springsecurity.ldap.context.managerDn = 'CN=<ldap_user>,CN=Users,DC=company,DC=local'
config.grails.plugins.springsecurity.ldap.context.managerPassword = 'secret'
config.grails.plugins.springsecurity.ldap.search.base //etc...

Now I also have a loadBefore in my descriptor to say:

def loadBefore = ["springSecurityCore"]

This works great on my local machine, it's only when I have the CI software compile does it fail.

build 11-Oct-2013 09:26:30 C:\Users\me.grails\2.1.1\projects\MyApp\plugins\spring-security-ldap-1.0.5\src\java\org\codehaus\groovy\grails\plugins\springsecurity\ldap\DatabaseOnlyLdapAuthoritiesPopulator.java:22: error: package org.springframework.ldap.core does not exist build 11-Oct-2013 09:26:30 import org.springframework.ldap.core.DirContextOperations;

Is there any way to preset configuration information prior to the SpringSecurity plugins grab hold with their defaults?

Is there any way to "reload" the plugin configurations after I've changed them?

EDIT Example of plugin is now on Github

4

1 回答 1

1

我有一个做同样事情的插件。我使用Platform Core来配置我的默认值,声明doWithConfig

def doWithConfig = { config -> 
  application {
    //Spring Security LDAP
    grails.plugins.springsecurity.ldap.useRememberMe = false
    if(grails.plugins.springsecurity.ldap.active) {
      grails.plugins.springsecurity.providerNames = ['ldapAuthProvider', 'anonymousAuthenticationProvider'] // specify this when you want to skip attempting to load from db and only use LDAP
    }
  }         
}

我还将我的插件设置为在 之后加载,因为我覆盖了一些 Spring Bean:

def loadAfter = ['springSecurityCore','springSecurityLdap']
于 2013-10-11T16:44:28.250 回答