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:
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.