开发者

How to use both database and LDAP authentication in Spring security?

We have a Sprin开发者_C百科g MVC application. We now have to integrate spring security in it.

The authentication can be done using either database or using LDAP.

We will a have a configuration setting either in a properties file or a database to decide which authentication to use i.e. if the user should be authenticated against a database or a LDAP.

At any given time there will be only one type of authentication.

e.g. A company test1 can have a database authentication and another company test 2 can have ldap authentication.


Some ideas:

  1. If each client is deployed separately with its own configuration, configure the DAO and LDAP authentication in 2 different XML files. At build time, choose which one you want to use and bundle it in your WAR.
  2. If there is only 1 WAR, maybe try including both XML files in the WAR, and set a system property using -Dmyprop=foo (o some other way) when starting up the app. Then, in your Spring config, include the appropriate config file using ${myprop} so that the correct file is called and used.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜