0

At our company, we have multiple products which share authentication settings. In particular, we use Spring LDAP, but since our use case and configuration is more complex, we would like to use multiple LDAP authentication providers, reconfigure them on-the-fly and have a fallback in case the primary LDAP is dead. Here's a rough diagram showing the current architecture of the LDAP components:
enter image description here

Optimally, I would like to be able to turn the entire top row of classes into a separate project which we could load into our applications by adding it to the pom.xml and applying minimal configuration. What would be the most standard approach to allow us to easily plug this into multiple Spring applications?

The most problematic part seems to be the fact that the Manager needs to be able to somehow invalidate the existing providers and force their reload based on the new configuration. How should I accomplish this?

I feel that one option would be to force the users of the module to implement an instance of an interface which the module would provide, say LDAPAuthProviderResetter, which would be autowired to the Manager Bean which would then communicate with this instance instead of the custom AuthProviderManager which could be a custom part of each of the applications which would use the module. Having stood on the shoulders of giants before, I wonder if this kind of architecture is the best I can do.

1 Answer 1

1

The most common way is by writing a so called "spring starter" which is basically a jar containing a configuration object that can load in beans on different conditionals.

so in your case you can add a starter which comes with configuration details, that the other providers need to read if your starter exists on the classpath.

You can in starters load custom beans, custom configuration on different conditionals and basically do all the stuff you want/need.

I suggest you read the documentation on how to build a spring starter and you most likely will find what you are looking for there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.