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 anyo开发者_开发问答ne provide me with some step by step example? (if such library exists of course..)
(I would like to use Java if possible)
Thanks!
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
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.
精彩评论