Ejemplo n.º 1
0
 @Override
 public void unbind(User user) {
   SessionMap<String, Object> session = userToSession.remove(user);
   if (session != null) {
     session.remove(User.USER);
     log.debug("Session[{}] unbinded user[{}]", identityHashCode(session), user);
   }
 }
  public String intercept(ActionInvocation invocation) throws Exception {

    LOG.debug("Authenticating chat user");

    SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION);
    User user = (User) session.get(USER_SESSION_KEY);

    if (user == null) {
      return Action.LOGIN;
    }
    return invocation.invoke();
  }
Ejemplo n.º 3
0
 @Override
 public String execute() throws Exception {
   if (session instanceof org.apache.struts2.dispatcher.SessionMap) {
     ((SessionMap) session).invalidate();
   }
   return SUCCESS;
 }
Ejemplo n.º 4
0
  public String UserLogin() throws Exception {
    String hashedPassword = org.apache.commons.codec.digest.DigestUtils.md5Hex(getPassword());
    LoginBean bean = new LoginBean(getUserName(), hashedPassword, getUserType());
    LoginDAO lDao = new LoginDAO();
    if (lDao.login(bean)) {
      sMap.put("userName", getUserName());
      sMap.put("userType", getUserType());

      logger.info("--> User : "******" Logged in Successfully as " + getUserType());
      return getUserType();
    }
    return "input";
  }
Ejemplo n.º 5
0
 @Override
 public void bind(User user, SessionMap<String, Object> session) {
   session.put(User.USER, user);
   userToSession.put(user, session);
   log.debug("User[{}] was binded to session[{}]", user, identityHashCode(session));
 }