0
votes

I am writing a grails application using the spring security plugin and would like to use the spring ldap plugin. I need to be able to alter the ldap settings though without re-compiling, so I do not believe I can set this in the config file. I have gotten this to work with different ldap plugins, but they don't play as nice with spring security which I like. Is there anyway to do this?

1

1 Answers

1
votes

One convenient option might be to use an external config file (described here in the Grails docs).

You might, for example, create a separate custom-ldap-settings.properties file containing your Spring Security / LDAP configuration. A partial sample:

...
grails.plugins.springsecurity.ldap.context.server = ldap://<AD Domain IP Address>
grails.plugins.springsecurity.ldap.search.base = ou=Accounts,dc=domain,dc=com
grails.plugins.springsecurity.ldap.search.filter = (AccountName={0})
...

You can then place this .properties file in your classpath for deployment, and then merge these settings into your main config in Config.groovy:

grails.config.locations = [ "classpath:custom-ldap-settings.properties" ]

You can make changes to this external .properties file without recompiling or rebuilding your .war file. After updating settings in your properties file, all you would need to do is restart your application or container (ie. Apache Tomcat).