views:

46

answers:

2

Hi,

We have a Django project which runs on Google App Engine and used db.UserProperty in several models. We don't have an own User model.

My boss would like to use RPXNow (Janrain) for authentication, but after I integrated it, the users.get_current_user() method returned None. It makes sense, because not Google authenticated me. But what should I use for db.UserProperty attributes? Is it possible to use rpxnow and still can have Google's User object as well?

After this I tried to use OpenID authentication (with federated login) in my application, and it works pretty good: I still have users.get_current_user() object. As far as I know, rpxnow using openID as well, which means (for me) that is should be possible to get User objects with rpxnow. But how?

Cheers, psmith

+1  A: 

You can only get a User object if you're using one of the built-in authentication methods. User objects provide an interface to the Users API, which is handled by the App Engine infrastructure. If you're using your own authentication library, regardless of what protocol it uses, you will have to store user information differently.

Nick Johnson
I hoped it is possible, but thanks for the answer.
psmith
A: 

I haven't tried it yet, but App Engine now supports Federated Login (OpenID) as an authentication mechanism. You can enable it from your dashboard.

Read more here: http://code.google.com/googleapps/domain/sso/openid_reference_implementation.html

Regardless of this, it is very easy -once you have integrated RPXNow- to link it to your application using the Polymodel, as follows:

class InternalUser(polymodel.PolyModel):
  name = db.StringProperty(required=True)
  groups = db.ListProperty(db.Key)

class GoogleUser(InternalUser):
  google_user = db.UserProperty(required=True)

class OpenIDUser(InternalUser):
  unique_identifier = db.StringProperty(required=True)

And then instead of using db.UserProperty you would use db.ReferenceProperty(required=True, reference_class=InternalUser).

gnz
Thanks for your answer. The current database contains `db.UserProperty` attributes so migration would not be easy.So I use federated login for now, maybe Google will offer a better solution later :)
psmith