Package com.poker

Examples of com.poker.User


        String userToken = rc.getCookie("userToken");
       
        if (userIdStr != null && userToken != null){
            // get the User from the DAO
            Long userId = ObjectUtil.getValue(userIdStr, Long.class, null);
            User user = PokerUsersListener.getUser(userId);
           
            // Build the expectedUserToken from the user info
            // For this example, simplistic userToken (sha1(username,password))
            String expectedUserToken = Hashing.sha1().hashString(user.getUsername() + user.getId()).toString();
           
            if (Objects.equal(expectedUserToken, userToken)){
                // if valid, then, we create the AuthTocken with our User object
                AuthToken<User> authToken = new AuthToken<User>();
                authToken.setUser(user);
View Full Code Here


        }
    }
   
    @WebModelHandler(startsWith = "/")
    public void pageIndex(@WebModel Map m,RequestContext rc) {
      User user = getUserFromSession(rc);
      m.put("user", user);
      m.put("playerId", rc.getReq().getSession().getAttribute("playerId"));
    }
View Full Code Here

      m.put("playerId", rc.getReq().getSession().getAttribute("playerId"));
    }
   
    @WebActionHandler
    public Object login(@WebParam("userId") Long userId,@WebParam("username") String username,RequestContext rc) {
        User user = PokerUsersListener.getUser(userId);
        if (user == null) {
            if(username != null){
              user = new User();
              user.setId(System.currentTimeMillis());
              user.setUsername(username);
              setUserToSession(rc, user);
            }
        } else {
          setUserToSession(rc, user);
        }
View Full Code Here

        }
    }

    // get the user from the session
    private User getUserFromSession(RequestContext rc) {
      User user = (User) rc.getReq().getSession().getAttribute("user");
      return user;
    }
View Full Code Here

  public void sessionCreated(HttpSessionEvent httpSessionEvent) {
  }

  @Override
  public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
    User user = (User) httpSessionEvent.getSession().getAttribute("user");
    usersMap.remove(user.getId());
  }
View Full Code Here

TOP

Related Classes of com.poker.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.