Package org.beangle.security.core.session

Examples of org.beangle.security.core.session.SessionInfo


  public void onApplicationEvent(SessionDestroyedEvent event) {
    remove(event.getId());
  }

  public void expire(String sessionid) {
    Sessioninfo info = getSessioninfo(sessionid);
    if (null != info) info.expireNow();
  }
View Full Code Here


    Sessioninfo info = getSessioninfo(sessionid);
    if (null != info) info.expireNow();
  }

  public SessionStatus getSessionStatus(String sessionid) {
    Sessioninfo info = getSessioninfo(sessionid);
    if (null == info) return null;
    else return new SessionStatus(info);
  }
View Full Code Here

    Set<String> sessionsUsedByPrincipal = principals.get(principal);
    List<Sessioninfo> list = CollectUtils.newArrayList();
    if (null == sessionsUsedByPrincipal) { return list; }
    synchronized (sessionsUsedByPrincipal) {
      for (final String sessionid : sessionsUsedByPrincipal) {
        Sessioninfo info = getSessioninfo(sessionid);
        if (info == null) {
          continue;
        }
        if (includeExpiredSessions || !info.isExpired()) {
          list.add(info);
        }
      }
    }
View Full Code Here

  public Sessioninfo getSessioninfo(String sessionid) {
    return sessionids.get(sessionid);
  }

  public void register(Authentication auth, String sessionid) throws SessionException {
    Sessioninfo existed = getSessioninfo(sessionid);
    String principal = auth.getName();
    // 是否为重复注册
    if (null != existed && ObjectUtils.equals(existed.getUsername(), principal)) return;
    // 争取名额
    boolean success = controller.onRegister(auth, sessionid, this);
    if (!success) throw new SessionException("security.OvermaxSession");
    // 注销同会话的其它账户
    if (null != existed) {
      existed.addRemark(" expired with replacement.");
      remove(sessionid);
    }
    // 新生
    sessionids.put(sessionid, sessioninfoBuilder.build(auth, controller.getServerName(), sessionid));
    Set<String> sessionsUsedByPrincipal = principals.get(principal);
View Full Code Here

    }
    sessionsUsedByPrincipal.add(sessionid);
  }

  public Sessioninfo remove(String sessionid) {
    Sessioninfo info = getSessioninfo(sessionid);
    if (null == info) { return null; }
    sessionids.remove(sessionid);
    String principal = info.getUsername();
    logger.debug("Remove session {} for {}", sessionid, principal);
    Set<String> sessionsUsedByPrincipal = principals.get(principal);
    if (null != sessionsUsedByPrincipal) {
      synchronized (sessionsUsedByPrincipal) {
        sessionsUsedByPrincipal.remove(sessionid);
View Full Code Here

  public void onApplicationEvent(SessionDestroyedEvent event) {
    remove(event.getId());
  }

  public void expire(String sessionid) {
    Sessioninfo info = getSessioninfo(sessionid);
    if (null != info) info.expireNow();
  }
View Full Code Here

    Sessioninfo info = getSessioninfo(sessionid);
    if (null != info) info.expireNow();
  }

  public SessionStatus getSessionStatus(String sessionid) {
    Sessioninfo info = getSessioninfo(sessionid);
    if (null == info) return null;
    else return new SessionStatus(info);
  }
View Full Code Here

  public Sessioninfo remove(String sessionId) {
    return remove(sessionId, null);
  }

  private Sessioninfo remove(String sessionId, String reason) {
    Sessioninfo info = getSessioninfo(sessionId);
    if (null == info) {
      return null;
    } else {
      // FIXME not in a transcation
      if (null != reason) info.addRemark(reason);
      entityDao.remove(info);
      controller.onLogout(info);
      entries.remove(info.getId());
      Object sessioninfoLog = sessioninfoBuilder.buildLog(info);
      if (null != sessioninfoLog) {
        entityDao.save(sessioninfoLog);
      }
      logger.debug("Remove session {} for {}", sessionId, info.getUsername());
      return info;
    }
  }
View Full Code Here

      return info;
    }
  }

  public void expire(String sessionId) {
    Sessioninfo info = getSessioninfo(sessionId);
    if (null != info) {
      controller.onLogout(info);
      info.expireNow();
      entityDao.saveOrUpdate(info);
    }
  }
View Full Code Here

TOP

Related Classes of org.beangle.security.core.session.SessionInfo

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.