重命名 SaTokenEventRelease -> SaTokenEventCenter

This commit is contained in:
click33 2022-08-20 04:25:03 +08:00
parent ce5b46f9a1
commit 0dd6e1a429
7 changed files with 25 additions and 25 deletions

View File

@ -7,12 +7,12 @@ import cn.dev33.satoken.exception.SaTokenException;
import cn.dev33.satoken.stp.SaLoginModel;
/**
* Sa-Token 事件发布器
* Sa-Token 事件中心 事件发布器
*
* @author kong
* @since: 2022-8-19
*/
public class SaTokenEventRelease {
public class SaTokenEventCenter {
// --------- 注册侦听器
@ -39,7 +39,7 @@ public class SaTokenEventRelease {
if(listenerList == null) {
throw new SaTokenException("重置的侦听器集合不可以为空");
}
SaTokenEventRelease.listenerList = listenerList;
SaTokenEventCenter.listenerList = listenerList;
}
/**
@ -66,7 +66,7 @@ public class SaTokenEventRelease {
throw new SaTokenException("注册的侦听器不可以为空");
}
}
SaTokenEventRelease.listenerList.addAll(listenerList);
SaTokenEventCenter.listenerList.addAll(listenerList);
}
/**

View File

@ -11,7 +11,7 @@ import java.util.concurrent.ConcurrentHashMap;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.application.SaSetValueInterface;
import cn.dev33.satoken.dao.SaTokenDao;
import cn.dev33.satoken.listener.SaTokenEventRelease;
import cn.dev33.satoken.listener.SaTokenEventCenter;
import cn.dev33.satoken.util.SaFoxUtil;
/**
@ -73,7 +73,7 @@ public class SaSession implements SaSetValueInterface, Serializable {
this.id = id;
this.createTime = System.currentTimeMillis();
// $$ 发布事件
SaTokenEventRelease.doCreateSession(id);
SaTokenEventCenter.doCreateSession(id);
}
/**
@ -233,7 +233,7 @@ public class SaSession implements SaSetValueInterface, Serializable {
public void logout() {
SaManager.getSaTokenDao().deleteSession(this.id);
// $$ 发布事件
SaTokenEventRelease.doLogoutSession(id);
SaTokenEventCenter.doLogoutSession(id);
}
/** 当Session上的tokenSign数量为零时注销会话 */

View File

@ -26,7 +26,7 @@ import cn.dev33.satoken.exception.NotRoleException;
import cn.dev33.satoken.exception.NotSafeException;
import cn.dev33.satoken.exception.SaTokenException;
import cn.dev33.satoken.fun.SaFunction;
import cn.dev33.satoken.listener.SaTokenEventRelease;
import cn.dev33.satoken.listener.SaTokenEventCenter;
import cn.dev33.satoken.session.SaSession;
import cn.dev33.satoken.session.TokenSign;
import cn.dev33.satoken.strategy.SaStrategy;
@ -364,7 +364,7 @@ public class StpLogic {
setLastActivityToNow(tokenValue);
// $$ 发布事件账号xxx 登录成功
SaTokenEventRelease.doLogin(loginType, id, tokenValue, loginModel);
SaTokenEventCenter.doLogin(loginType, id, tokenValue, loginModel);
// 检查此账号会话数量是否超出最大值
if(config.getMaxLoginCount() != -1) {
@ -429,7 +429,7 @@ public class StpLogic {
deleteTokenToIdMapping(tokenValue);
deleteTokenSession(tokenValue);
// $$ 发布事件指定账号注销
SaTokenEventRelease.doLogout(loginType, loginId, tokenValue);
SaTokenEventCenter.doLogout(loginType, loginId, tokenValue);
}
// 注销 Session
session.logoutByTokenSignCountToZero();
@ -466,7 +466,7 @@ public class StpLogic {
deleteTokenToIdMapping(tokenValue);
deleteTokenSession(tokenValue);
// $$ 发布事件指定账号注销
SaTokenEventRelease.doLogout(loginType, loginId, tokenValue);
SaTokenEventCenter.doLogout(loginType, loginId, tokenValue);
}
// 注销 Session
session.logoutByTokenSignCountToZero();
@ -496,7 +496,7 @@ public class StpLogic {
}
// $$ 发布事件某某Token注销下线了
SaTokenEventRelease.doLogout(loginType, loginId, tokenValue);
SaTokenEventCenter.doLogout(loginType, loginId, tokenValue);
// 4. 清理User-Session上的token签名 & 尝试注销User-Session
SaSession session = getSessionByLoginId(loginId, false);
@ -533,7 +533,7 @@ public class StpLogic {
clearLastActivity(tokenValue);
// 将此 token 标记为已被踢下线
updateTokenToIdMapping(tokenValue, NotLoginException.KICK_OUT);
SaTokenEventRelease.doKickout(loginType, loginId, tokenValue);
SaTokenEventCenter.doKickout(loginType, loginId, tokenValue);
}
// 注销 Session
session.logoutByTokenSignCountToZero();
@ -562,7 +562,7 @@ public class StpLogic {
updateTokenToIdMapping(tokenValue, NotLoginException.KICK_OUT);
// $$. 发布事件某某Token被踢下线了
SaTokenEventRelease.doKickout(loginType, loginId, tokenValue);
SaTokenEventCenter.doKickout(loginType, loginId, tokenValue);
// 4. 清理User-Session上的token签名 & 尝试注销User-Session
SaSession session = getSessionByLoginId(loginId, false);
@ -589,7 +589,7 @@ public class StpLogic {
clearLastActivity(tokenValue);
// 将此 token 标记为已被顶替
updateTokenToIdMapping(tokenValue, NotLoginException.BE_REPLACED);
SaTokenEventRelease.doReplaced(loginType, loginId, tokenValue);
SaTokenEventCenter.doReplaced(loginType, loginId, tokenValue);
}
}
}
@ -1655,7 +1655,7 @@ public class StpLogic {
getSaTokenDao().set(splicingKeyDisable(loginId), DisableLoginException.BE_VALUE, disableTime);
// $$ 发布事件
SaTokenEventRelease.doDisable(loginType, loginId, disableTime);
SaTokenEventCenter.doDisable(loginType, loginId, disableTime);
}
/**
@ -1684,7 +1684,7 @@ public class StpLogic {
getSaTokenDao().delete(splicingKeyDisable(loginId));
// $$ 发布事件
SaTokenEventRelease.doUntieDisable(loginType, loginId);
SaTokenEventCenter.doUntieDisable(loginType, loginId);
}

View File

@ -7,7 +7,7 @@ import cn.dev33.satoken.dao.SaTokenDao;
import cn.dev33.satoken.exception.ApiDisabledException;
import cn.dev33.satoken.exception.SaTokenException;
import cn.dev33.satoken.jwt.exception.SaJwtException;
import cn.dev33.satoken.listener.SaTokenEventRelease;
import cn.dev33.satoken.listener.SaTokenEventCenter;
import cn.dev33.satoken.stp.SaLoginModel;
import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpLogic;
@ -99,7 +99,7 @@ public class StpLogicJwtForStateless extends StpLogic {
String tokenValue = createTokenValue(id, loginModel.getDeviceOrDefault(), loginModel.getTimeout(), loginModel.getExtraData());
// $$ 发布事件账号xxx 登录成功
SaTokenEventRelease.doLogin(loginType, id, tokenValue, loginModel);
SaTokenEventCenter.doLogin(loginType, id, tokenValue, loginModel);
return tokenValue;
}

View File

@ -16,7 +16,7 @@ import cn.dev33.satoken.dao.SaTokenDao;
import cn.dev33.satoken.id.SaIdTemplate;
import cn.dev33.satoken.id.SaIdUtil;
import cn.dev33.satoken.json.SaJsonTemplate;
import cn.dev33.satoken.listener.SaTokenEventRelease;
import cn.dev33.satoken.listener.SaTokenEventCenter;
import cn.dev33.satoken.listener.SaTokenListener;
import cn.dev33.satoken.sign.SaSignTemplate;
import cn.dev33.satoken.stp.StpInterface;
@ -89,7 +89,7 @@ public class SaBeanInject {
*/
@Autowired(required = false)
public void setSaTokenListener(List<SaTokenListener> listenerList) {
SaTokenEventRelease.registerListenerList(listenerList);
SaTokenEventCenter.registerListenerList(listenerList);
}
/**

View File

@ -14,7 +14,7 @@ import cn.dev33.satoken.dao.SaTokenDao;
import cn.dev33.satoken.id.SaIdTemplate;
import cn.dev33.satoken.id.SaIdUtil;
import cn.dev33.satoken.json.SaJsonTemplate;
import cn.dev33.satoken.listener.SaTokenEventRelease;
import cn.dev33.satoken.listener.SaTokenEventCenter;
import cn.dev33.satoken.listener.SaTokenListener;
import cn.dev33.satoken.sign.SaSignTemplate;
import cn.dev33.satoken.solon.model.SaContextForSolon;
@ -67,7 +67,7 @@ public class XPluginImp implements Plugin {
// TODO这里需要改为注入一组 Bean
context.getWrapAsyn(SaTokenListener.class, bw->{
// SaManager.setSaTokenListener(bw.raw());
SaTokenEventRelease.registerListener(bw.raw());
SaTokenEventCenter.registerListener(bw.raw());
});
// 注入权限认证 Bean

View File

@ -16,7 +16,7 @@ import cn.dev33.satoken.dao.SaTokenDao;
import cn.dev33.satoken.id.SaIdTemplate;
import cn.dev33.satoken.id.SaIdUtil;
import cn.dev33.satoken.json.SaJsonTemplate;
import cn.dev33.satoken.listener.SaTokenEventRelease;
import cn.dev33.satoken.listener.SaTokenEventCenter;
import cn.dev33.satoken.listener.SaTokenListener;
import cn.dev33.satoken.sign.SaSignTemplate;
import cn.dev33.satoken.stp.StpInterface;
@ -89,7 +89,7 @@ public class SaBeanInject {
*/
@Autowired(required = false)
public void setSaTokenListener(List<SaTokenListener> listenerList) {
SaTokenEventRelease.registerListenerList(listenerList);
SaTokenEventCenter.registerListenerList(listenerList);
}
/**