Package com.google.appengine.api.users

Examples of com.google.appengine.api.users.User


    @Override
    public User getValue(PropertyValue propertyValue) {
      UserValue userValue = propertyValue.getUserValue();
      String userId = userValue.hasObfuscatedGaiaid() ? userValue.getObfuscatedGaiaid() : null;
      return new User(userValue.getEmail(), userValue.getAuthDomain(), userId);
    }
View Full Code Here


          authDomain = prop.getValueOrBuilder().getStringValue();
        } else if (prop.getName().equals(PROPERTY_NAME_USER_ID)) {
          userId = prop.getValueOrBuilder().getStringValue();
        }
      }
      return new User(email, authDomain, userId);
    }
View Full Code Here

        if(authDomain != null && email != null){
            String userId = reader.readProperty("userId");
            if(userId != null){
                String federatedIdentity = reader.readProperty("federatedIdentity");
                if(federatedIdentity != null){
                    return new User(email, authDomain, userId, federatedIdentity);
                }
                return new User(email, authDomain, userId);
            }
            return new User(email, authDomain);
        }
        return defaultValue;
    }
View Full Code Here

  @SuppressWarnings("unused")
  protected void doGet(HttpServletRequest request,
      HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    String path = ((HttpServletRequest) request).getRequestURI();
    String action = "";
    String[] splittedURI = path.split("/");
    // if length = 3, this is for action request.
    if (splittedURI.length == 4) {
View Full Code Here

  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    resp.setContentType("text/html;charset=UTF-8");
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    // if (user != null) {
    String action = req.getParameter("action");
    if (action.equalsIgnoreCase("create")) {
      Category cate = new Category();
      if (req.getParameter("title") != null) {
View Full Code Here

  @SuppressWarnings("unused")
  protected void doGet(HttpServletRequest request,
      HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    String path = ((HttpServletRequest) request).getRequestURI();
    String action = "";
    String[] splittedURI = path.split("/");
    // if length = 3, this is for action request.
    if (splittedURI.length == 4) {
View Full Code Here

      }
    };

    @Override
    public void setPropertyValue(PropertyValue propertyValue, Object value) {
      User user = (User) value;
      UserValue userValue = new UserValue();
      userValue.setEmail(user.getEmail());
      userValue.setAuthDomain(user.getAuthDomain());
      userValue.setGaiaid(0);
      propertyValue.setUserValue(userValue);
    }
View Full Code Here

    @Override
    public User getPropertyValue(PropertyValue propertyValue) {
      UserValue userValue = propertyValue.getUserValue();
      String userId = userValue.hasObfuscatedGaiaid() ? userValue.getObfuscatedGaiaid() : null;
      return new User(userValue.getEmail(), userValue.getAuthDomain(), userId);
    }
View Full Code Here

    return getCurrentUser(null);
  }

  public User getCurrentUser(String scope) throws OAuthRequestException {
    GetOAuthUserResponse response = getGetOAuthUserResponse(scope);
    return new User(response.getEmail(), response.getAuthDomain(),
        response.getUserId());
  }
View Full Code Here

public class GuestbookServlet extends HttpServlet {
    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
              throws IOException {
        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();

        if (user != null) {
            resp.setContentType("text/plain");
            resp.getWriter().println("Hello, " + user.getNickname());
        } else {
            resp.sendRedirect(userService.createLoginURL(req.getRequestURI()));
        }
    }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.users.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.