GAE: Tidbits on UserService

GAE : UserService

Google UserService is used to check whether the user has logged in and also to get the details of the logged in user.

UserServiceFactory is a Factory class to to get handle to a UserService

UserService provide information to force the user to login, logout and also to get the details of the user.

userService.getCurrentUser() =>  gives information about the current user.

The createLoginURL() and createLogoutURL() methods of the UserService generate URLs that go to Google Accounts

 

 

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

……….
……….

UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
String loginUrl = userService.createLoginURL(“/”);
String logoutUrl = userService.createLogoutURL(“/”);

……….
……….

user.getEmail()
user.getUserId()

 

Posted in: GAE

Leave a Comment