views:

60

answers:

3

Does the spring framework support multi applications sharing a common user base?

e.g. 2 separate web applications somehow hook into a single database to get user related information (username, password, and maybe even roles)

The idea is this, something similiar to asp.net membership

it works like this, you can have 10 websites, all pulling their membership API from the same datasource. Security (roles) and site mappings are all peformed via this membership API.

Usually what happens is you release a application. Then you release another application, and then your clients ask if you can merge the users etc. The asp.net membership solves this problem from the get-go.

update

I am not asking for single-sign on in the sense that you can go to any website by just logging in once. But rather you have the same login credentials that can be used on all sites.

+2  A: 

A single database can be accessed by multiple applications, including Spring applications. Just provide access to this database to each applications, typically through a datasource (and yes, a Java application can use several datasources).

[EDIT] The intent of the OP is actually not clear. According to some comments, it seems that the question might be about SSO. In that case, I'd suggest to have a look at Spring Security, or a CAS implementation like JA-SIG CAS, or Spring Security with CAS.

PS: I don't mean to be rude but you should learn How To Ask Questions The Smart Way. For example here, you should expose your goal instead of asking for a specific solution (see Describe the goal, not the step). First, readers can't guess what you don't tell them and it is very frustrating (even if I'm happy to help). Second, you'll get much better answers (and avoid frustration on both sides). Seriously, read that paper, it's really worth it.

Pascal Thivent
+1000 for the recommendation to learn how to ask questions. mrblah has been asking nearly (or more than) 20 questions a day, usually without sufficient information for someone to know what he's asking, and rarely follows up with clarification -- I'm totally unclear why people continue to play along with his game.
delfuego
@pascal thanks for the suggestion, and for @delfuego http://j.mp/1QGRZO
mrblah
@mrblah, as you'll read in Pascal's link about asking questions, I'm not looking to be your friend, I'm looking for you to respect the time of people here by doing some work on your own before asking questions, and then by doing us the favor of asking questions in a way where people know what you're asking, know what you've tried, and know what your actual question is. It's not really all that hard, and it's certainly the better way to get help when you need it.
delfuego
A: 

Yes ... sort of. Take a look at SpringSecurity.

I say "sort of" because Spring currently does not offer an off-the-shelf solution to the problem of user account management. You have the choice of hooking into an existing solution (e.g. LDAP) or rolling your own "user details service" and tools for account management.

Also, SpringSecurity doesn't yet (AFAIK) have a true "single-sign-on" solution.

But certainly, once you have implemented a SpringSecurity based solution to authentication / access control, it should be easy to apply it across multiple websites, with a unified user account-base ... or not.

EDIT in response to comments, when I say that SpringSecurity + LDAP is not an off-the-shelf solution to user account management, I mean that it is not something (like the OP) can simply add to his Spring-based webapps and deploy in Tomcat / whatever. Instead, he would have to

  1. research how LDAP works,
  2. select and LDAP implementation,
  3. install an LDAP implementation,
  4. configure and tailor LDAP as required,
  5. integrate with SpringSecurity,
  6. figure out to implement extensions to his web-apps so that remote users can self register, change their passwords, change their profiles, etcetera.

To my mind SpringSecurity + LDAP is a good solution if you already have a corporate LDAP setup (or if you have extensive LDAP expertise), but it is not a good match to the OP's requirement for a simple solution.

Stephen C
I'm confused -- why is Spring Security's support of LDAP **not** an off-the-shelf solution to user account management?That being said, the question is a lot more basic than this; the OP seems to be asking whether or not two Java applications can use the same database, which is sort of baffling.
delfuego
delfeugo, no that is not what I am asking. I was hoping spring has something similiar to the asp.net membership. multiple apps can share the same userbase, have different roles setup for each site, etc.
mrblah
And as I asked above, I'm still unclear what you're looking for -- single sign-on? authentication backed by a single set of users? I really, really think you need to spend time with Pascal's "How To Ask Questions The Smart Way" link -- this whole thing is a muddled mess.
delfuego
@delfuego - I assume you are talking to the OP in your last comment.
Stephen C
+1  A: 

Sure you can. Look at Terracota with Spring. It allows the use of distributed cache. i.e. you can write to a hashmap and it gets transparently replicated to a hashmap on another instance of JVM(i.e. application).

http://www.springsource.org/node/279

also google "cluster spring".

You can put anything into a data structure: user info, roles, etc. It also you give you a nice little clustering solution where you can easily load balance sessions between multiple instances of an application.

related questions