package util;

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

public class UserAuthUtil {
  public static boolean isUserLoggedIn() {
    UserService userServ = UserServiceFactory.getUserService();
    return userServ.isUserLoggedIn();
  }
  public static String getLoginURL(String redirect) {
    UserService userServ = UserServiceFactory.getUserService();
    return userServ.createLoginURL(redirect);
  }
  public static String getLogoutURL(String redirect) {
    UserService userServ = UserServiceFactory.getUserService();
    return userServ.createLogoutURL(redirect);
  }
  public static String getUser() {

  }
}
@@ -8,16 +8,60 @@
  util;%0A%0A
+import com.google.appengine.api.users.User;%0A
 import c
@@ -566,38 +566,22 @@
 ) %7B%0A    
-UserService userServ =
+return
  UserSer
@@ -600,33 +600,96 @@
 getUserService()
-;
+.createLogoutURL(redirect);%0A  %7D%0A  public static User getUser() %7B
 %0A    return user
@@ -688,83 +688,298 @@
 urn 
-u
+U
 serServ
-.createLogoutURL(redirect);%0A  %7D%0A  public static String getUser() %7B%0A
+iceFactory.getUserService().getCurrentUser();%0A  %7D%0A  public static boolean isUserAuthorized() %7B%0A    return getDomainName().equals(%22google.com%22);%0A  %7D%0A  private static String getDomainName() %7B%0A    String email = getUser().getEmail();%0A    return email.substring(email.indexOf('@') + 1);
 %0A  %7D

Add helper functions for authentication and authorization