tags:

views:

761

answers:

2

I am using the Spring Source 2.0 security plugin and I've done the tutorial described on this page using the Requestmap method of security.

Acegi Plugin Tutorial

I now want to create a second bookstore as follows and implement the same tutorial.

grails create-app bookstore2

Both apps will share the same database so all users, roles, etc will be common between the two apps. Finally, I want a given user to be automatically authenticated in the second bookstore if he authenticates in the first. What is the best way to implement this?

+1  A: 

You might want to have a look at CAS. It's a federated login server that allows to use Single Sign On accross multiple web application - independent of it's plattform. It's Java, Spring based, but requires that you familiarize yourself with it's architecture. Spring Security has built-in support for CAS.

Siegfried Puchbauer
Shouldn't there be a much simpler way? Application servers such as Glassfish already provide support for SSO with realms.
Yes, there certainly a simpler way but I do not have much experience with that. CAS provides flexibility, eg. when you want to connect other apps or you want to move an application to another app server.
Siegfried Puchbauer
+1  A: 

You can leverage the "remember me" functionality that Acegi provides. Since it is cookie based, once you authenticate against the first application, it will drop a cookie, and then when you attempt to log in to the second application, as long as the security model is identical, you will be authenticated immediately via the cookie.

See: Acegi Documentation for further details.

Steve Levine
only works if the apps are on the same domain though, otherwise, it would be a security vulnerability.
Chii
True, one work around is to "frame" in the second domain (if you can). Something like: www.bookstore.com and two.bookstore.com points to www.bookstoretwo.com. Then the cookie will work, otherwise, as stated above, it will not work.
Steve Levine
The remember me cookie applies to /bookstore. The second bookstore would be on /bookstore2. I'm guessing that I'll have to create the cookie on /.