package util;

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

public class UserAuthUtil {
  /**
   * Returns a boolean for the user's login status
   * @return user login status
   */
  public static boolean isUserLoggedIn() {
    UserService userServ = UserServiceFactory.getUserService();
    return userServ.isUserLoggedIn();
  }

  /**
   * @param redirect URL for webpage to return to after login
   * @return
   */
  public static String getLoginURL(String redirect) {
    UserService userServ = UserServiceFactory.getUserService();
    return userServ.createLoginURL(redirect);
  }
  public static String getLogoutURL(String redirect) {
    return UserServiceFactory.getUserService().createLogoutURL(redirect);
  }
  public static User getUser() {
    return UserServiceFactory.getUserService().getCurrentUser();
  }
  public static boolean isUserAuthorized() {
    return getDomainName().equals("google.com");
  }

  private static String getDomainName() {
    String email = getUser().getEmail();
    return email.substring(email.indexOf('@') + 1);
  }
}
@@ -514,17 +514,48 @@
  @return
+ URL for user to click to login
 %0A
-
    */%0A  
@@ -711,32 +711,153 @@
 L(redirect);%0A  %7D
+%0A%0A  /**%0A   * @param redirect URL for webpage to return to after logout%0A   * @return URL for user to click to logout%0A   */
 %0A  public static
@@ -969,24 +969,80 @@
 direct);%0A  %7D
+%0A%0A  /**%0A   * Helper method to return a User object%0A   */
 %0A  public st
@@ -1131,16 +1131,167 @@
 r();%0A  %7D
+%0A%0A  /**%0A   * Determines whether a user is authorized to use the requested resource%0A   * @return true when the user's email domain is %22google.com%22%0A   */
 %0A  publi
@@ -1382,16 +1382,81 @@
 );%0A  %7D%0A%0A
+  /**%0A   * @return domain name from a user's email address%0A   */%0A
   privat

Add javadoc for authentication utility