Peter
Peter

Reputation: 48958

Google Appengine custom authentication

I would like to test appengine. At this moment it is not clear to me if there are libraries that support custom authentication. I want the user to be able to create an account on the site without having to have a google (or any other) account.

Does that kind of libraries exists or do you have to write it from scratch? Can anyone provide me with some step by step example? (if such library exists of course..)

(I would like to use Java if possible)

Thanks!

Upvotes: 3

Views: 1519

Answers (2)

Xion
Xion

Reputation: 22770

I'm not aware about any libraries designed specifically for supporting custom login. However, what you need for is ability to store session-specific data and this is doable via Session library from gaeutilities that implements sessions based on cookies and datastore.

Link: http://gaeutilities.appspot.com/session

Example:

from appengine_utlities import sessions

def authenticate(login, password):
    user = User.all().filter('login', login).filter('password', password).get()
    if not user: return False

    s = sessions.Session()
    s["user"] = user
    return True

def is_authenticated():
    s = sessions.Session()
    return s.has_key("user")

def get_user():
    s = sessions.Session()
    return s["user"] if s.has_key("user") else None

Upvotes: 2

Dmitry
Dmitry

Reputation: 3780

Don't you want to consider Google Friend Connect authentication? It includes not only Google accounts, but also Yahoo, Open ID and some others and pretty easy to setup.

Upvotes: 0

Related Questions