|
|
@ -14,6 +14,8 @@ import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import com.ruoyi.common.constant.ShiroConstants;
|
|
|
|
import com.ruoyi.common.constant.ShiroConstants;
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
|
|
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
|
|
|
import com.ruoyi.framework.shiro.session.OnlineSession;
|
|
|
|
import com.ruoyi.framework.shiro.session.OnlineSession;
|
|
|
|
import com.ruoyi.system.domain.SysUserOnline;
|
|
|
|
import com.ruoyi.system.domain.SysUserOnline;
|
|
|
@ -34,8 +36,8 @@ public class OnlineWebSessionManager extends DefaultWebSessionManager
|
|
|
|
super.setAttribute(sessionKey, attributeKey, value);
|
|
|
|
super.setAttribute(sessionKey, attributeKey, value);
|
|
|
|
if (value != null && needMarkAttributeChanged(attributeKey))
|
|
|
|
if (value != null && needMarkAttributeChanged(attributeKey))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OnlineSession s = (OnlineSession) doGetSession(sessionKey);
|
|
|
|
OnlineSession session = getOnlineSession(sessionKey);
|
|
|
|
s.markAttributeChanged();
|
|
|
|
session.markAttributeChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -68,13 +70,25 @@ public class OnlineWebSessionManager extends DefaultWebSessionManager
|
|
|
|
Object removed = super.removeAttribute(sessionKey, attributeKey);
|
|
|
|
Object removed = super.removeAttribute(sessionKey, attributeKey);
|
|
|
|
if (removed != null)
|
|
|
|
if (removed != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OnlineSession s = (OnlineSession) doGetSession(sessionKey);
|
|
|
|
OnlineSession s = getOnlineSession(sessionKey);
|
|
|
|
s.markAttributeChanged();
|
|
|
|
s.markAttributeChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return removed;
|
|
|
|
return removed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public OnlineSession getOnlineSession(SessionKey sessionKey)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
OnlineSession session = null;
|
|
|
|
|
|
|
|
Object obj = doGetSession(sessionKey);
|
|
|
|
|
|
|
|
if (StringUtils.isNotNull(obj))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
session = new OnlineSession();
|
|
|
|
|
|
|
|
BeanUtils.copyBeanProp(session, obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return session;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 验证session是否有效 用于删除过期session
|
|
|
|
* 验证session是否有效 用于删除过期session
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|