Beispiel #1
0
 /**
  * store data to shiro session
  *
  * @param key data's key
  * @param value data's value
  */
 public static void store(Object key, Object value) {
   Session session = getSession();
   session.setAttribute(key, value);
   if (logger.isDebugEnabled()) {
     logger.debug("session timeout default {} s", session.getTimeout() / 1000);
   }
 }
 public void onStop(Session session) {
   // TODO Auto-generated method stub
   logger.debug(
       " ===onStop=== "
           + "sessionid:"
           + session.getId()
           + " sessiontimeout:"
           + session.getTimeout());
 }
Beispiel #3
0
 /**
  * 将一些数据放到ShiroSession中,以便于其它地方使用
  *
  * @see 比如Controller,使用时直接用HttpSession.getAttribute(key)就可以取到
  */
 private void setSession(Object key, Object value) {
   Subject currentUser = SecurityUtils.getSubject();
   if (null != currentUser) {
     Session session = currentUser.getSession();
     System.out.println("Session默认超时时间为[" + session.getTimeout() + "]毫秒");
     if (null != session) {
       session.setAttribute(key, value);
     }
   }
 }