Package com.google.appengine.api.users

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


  public void setAfterLogoutEndpoint(String afterLogoutEndpoint) {
    this.afterLogoutEndpoint = afterLogoutEndpoint;
  }

  private String createLoginUrl(String destinationUrl) {
    UserService userService = UserServiceFactory.getUserService();

    return userService.createLoginURL(destinationUrl);
  }
View Full Code Here


    return userService.createLoginURL(destinationUrl);
  }

  private String createLogoutUrl(String destinationUrl) {
    UserService userService = UserServiceFactory.getUserService();

    return userService.createLogoutURL(destinationUrl);
  }
View Full Code Here

    String beginHtml = "<html><body><h2>";
    String endHtml = "</h2></body></html>";
    String novaLínia = "<br></br>";
    String llibre, entrada, valor;
   
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    if (user !=null) {
      Date date = new Date();
      llibre = req.getParameter("llibre");
      entrada = req.getParameter("entrada");
      valor = req.getParameter("valor");
      resp.setContentType("text/html");
      resp.getWriter().println(beginHtml);
      resp.getWriter().println("Versió v011svn. " +
          DateFormat.getDateInstance().format(date) + " - " + DateFormat.getTimeInstance().format(date)  
        + novaLínia + "Salutacions " +
          user + novaLínia + "Això és codi Java 6 executat al cloud de Google." );
      resp.getWriter().println("<br></br><br>llibre: " + llibre + "</br>");
      resp.getWriter().println("<br>entrada: " + entrada + "</br>");
      resp.getWriter().println("<br>valor: " + valor + "</br>");
      resp.getWriter().println(beginHtml);
      resp.getWriter().println(beginHtml);
      resp.getWriter().println(endHtml);
    }else{
      resp.sendRedirect(userService.createLoginURL(req.getRequestURI()));     
    }
   
  }
View Full Code Here

    // thus dont have any credentials
    setCredentialsMatcher(new AllowAllCredentialsMatcher());
  }

  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) {
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    if (user == null){
      throw new AccountException("Not authenticated.");
    }
   
    return new SimpleAuthenticationInfo(user, null, getName());
View Full Code Here

  }

  @Override
  protected AuthenticationToken createToken(
      ServletRequest request, ServletResponse response) {
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    return createToken(user.getUserId(), null, request, response);
  }
View Full Code Here

  }

  @Override
  protected boolean onAccessDenied(ServletRequest request,
                                   ServletResponse response) throws Exception{
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
   
    if (user == null){
      saveRequest(request);
     
      String requestURI = WebUtils.getRequestUri(WebUtils.toHttp(request));
     
      String loginUrl = this.getLoginUrl();
      if (loginUrl == null){
        loginUrl = userService.createLoginURL(requestURI);
        WebUtils.issueRedirect(request, response, loginUrl);
      }else{
        request.setAttribute("requestURI", requestURI);
        request.getRequestDispatcher(loginUrl).forward(request, response);
      }
View Full Code Here

    if (util.isNullOrEmpty(confirmation)) {
      throw new IllegalArgumentException("Required parameter 'confirmation' is missing.");
    }
    confirmation = URLDecoder.decode(confirmation, "UTF-8");
   
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    if (user == null) {
      response.sendRedirect(userService.createLoginURL(util.getSelfUrl(request)));
      return;
    }
    String email = user.getEmail().toLowerCase();
   
    NamespaceManager.set("nsadmin");
View Full Code Here

    Entity entity = addEntityToDatastore(email, namespace);
    if (entity == null) {
      throw new IllegalStateException("Couldn't add entry to datastore.");
    }
   
    UserService userService = UserServiceFactory.getUserService();
    User currentUser = userService.getCurrentUser();
   
    try {
      sendEmailInvitation(currentUser.getEmail(), email,
        (String) entity.getProperty("confirmation"));
    } catch (IOException e) {
View Full Code Here

    HttpServletResponse httpResponse = (HttpServletResponse) response;
    String namespace = httpRequest.getParameter("ns");
    String requestUri = httpRequest.getRequestURI().toLowerCase();
   
    if (requestUri.contains("admin") && !requestUri.startsWith("/_ah/")) {
      UserService userService = UserServiceFactory.getUserService();
      User currentUser = userService.getCurrentUser();
     
      if (namespace == null) {
        List<String> authorizedNamespaces = util.getAuthorizedNamespacesForUser(currentUser);
        switch (authorizedNamespaces.size()) {
          case 0:
View Full Code Here

      if (jsonRpcRequest != null) {
        String method = jsonRpcRequest.getMethod();
        if (method != null) {
          Class<? extends Command> commandClass = CommandType.valueOfIngoreCase(method).getClazz();

          UserService userService = UserServiceFactory.getUserService();

          if (commandClass.isAnnotationPresent(NonAdmin.class) || userService.isUserAdmin() ||
              util.isUserPermissionedForNamespace(userService.getCurrentUser(),
                NamespaceManager.get())) {
            Command command = injector.getInstance(commandClass);
            command.setParams(jsonRpcRequest.getParams());

            try {
View Full Code Here

TOP

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

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.