Friday, September 4, 2009

Google App Engine

Deploying app engine to your own domain

http://code.google.com/appengine/articles/domains.html

basically you need to use Google Apps to manage your domains and point it to your App Engine application.

i have to wait for 15 minutes before my domain points to my app engine.

i register my domain with godaddy through google, and the cname records are added automatically when you add them in Google Apps.




Using Google Account to authenticate users

making use of Google Account has the advantage of offloading the user authentication to Google. You are left with more time to develop your web application.

There are several ways to force users to authenticate.

servlet

http://code.google.com/appengine/docs/java/users/overview.html go to "Using Google Accounts in Java" section


web.xml

please see http://code.google.com/appengine/docs/java/config/webxml.html#Security_and_Authentication


jsp

http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/users/package-summary.html

Package com.google.appengine.api.users
The UserService provides facilities to check whether a user has authenticated using their Google Account, retrieve their email address, and check whether they are an administrator for this application.

See:
Description

Interface Summary
UserService The UserService provides information useful for forcing a user to log in or out, and retrieving information about the user who is currently logged-in.


Class Summary
User User represents a specific user, represented by the combination of an email address and a specific Google Apps domain (which we call an authDomain).
UserServiceFactory Creates a UserService.


Exception Summary
UserServiceFailureException UserServiceFailureException is thrown when any unknown error occurs while communicating with the user service.


Package com.google.appengine.api.users Description

The UserService provides facilities to check whether a user has authenticated using their Google Account, retrieve their email address, and check whether they are an administrator for this application. It can also be used to construct a URL for users to login or logout. More information is available in the on-line documentation.

As an example, your application might, in a JSP file, have code like this:

<%
UserService userService = UserServiceFactory.getUserService();
if (!userService.isUserLoggedIn()) {
%>
Please %>">log in>
<% } else { %>
Welcome, <%= userService.currentUser().getNickname(); %>!
( %>">log out>)
<%
}
%>

No comments: