Package com.googlecode.freewebdav.entities

Examples of com.googlecode.freewebdav.entities.WebdavUser


  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    UserService userService = UserServiceFactory.getUserService();
    Principal p = req.getUserPrincipal();
    User u = userService.getCurrentUser();
    if (p != null) {
      WebdavUser wu = ofy.find(WebdavUser.class, u.getUserId());
      String username = req.getParameter("username");
      String password = req.getParameter("password");
      wu.setUsername(username);
      wu.setPassword(password);
      ofy.put(wu);
      resp.sendRedirect("home");
    } else {
      resp.sendRedirect("login");     
    }   
View Full Code Here


    UserService userService = UserServiceFactory.getUserService();
    String thisURL = req.getRequestURI();
    Principal p = req.getUserPrincipal();
    User u = userService.getCurrentUser();
    if (p != null) {
      WebdavUser wu = ofy.find(WebdavUser.class, u.getUserId());
      if (wu == null) {
        wu = new WebdavUser();
        wu.setPassword((new RandPass(RandPass.NONCONFUSING_ALPHABET).getPass(6)));
        wu.setUserId(u.getUserId());
        wu.setUsername(u.getNickname());
        Key<WebdavUser> wuKey = ofy.put(wu);

        WebdavFolder root = new WebdavFolder();
        root.setParent(wuKey);
        ofy.put(root);
      }
     
      resp.getWriter().println(
          String.format(
          "<p>Hello, %s! You can log in to http://freewebdav.appspot.com/webdav/ as %s/%s" +
          "<br><br> You can <a href=\"%s\">sign out</a>.</p>",
          u.toString(),
          wu.getUsername(),
          wu.getPassword(),         
          userService.createLogoutURL(thisURL) ));
    } else {
      resp.sendRedirect("login");
    }
  }
View Full Code Here

    this.ofy = ofy;
  }
 
  @Override
  public Object authenticate(DigestResponse digestResp) {
    WebdavUser wu = getUser(digestResp.getUser());
    if (wu == null)
      return null;
   
        String serverResponse = new DigestGenerator().generateDigest( digestResp, wu.getPassword() );
        String clientResponse = digestResp.getResponseDigest();

        return serverResponse.equals(clientResponse) ? wu : null;
  }
View Full Code Here

        return serverResponse.equals(clientResponse) ? wu : null;
  }
 
  @Override
    public Object authenticate(String user, String password) {
    WebdavUser wu = getUser(user);
    if (wu == null)
      return null;
   
    return wu.getPassword().equals(password) ? wu : null;
  }
View Full Code Here

    log.fine("Resolving resource needed for '" + betterUrl + "' ("+ url + ")");
   
    String[] i = betterUrl.split("/");
//    int c = i.length;
   
    WebdavUser wu = (WebdavUser)WebdavServlet.request().getAuthorization().getTag();
   
    if (wu == null)
      wu = ofy.get(getUserKeyFromHost(ofy, host));
   
    if (wu == null)
View Full Code Here

TOP

Related Classes of com.googlecode.freewebdav.entities.WebdavUser

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.