如果是在个性化用户类型的登录界面,登录的系统,则在退出时返回对应用户类型的登录界面。

This commit is contained in:
thinkgem
2020-09-20 09:41:54 +08:00
parent 055d791c44
commit f3bb96d719

View File

@@ -38,16 +38,17 @@ public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter
try { try {
Object principal = subject.getPrincipal(); Object principal = subject.getPrincipal();
if (principal != null){ if (principal != null){
// // 记录用户退出日志(@Deprecated v4.0.5支持setAuthorizingRealm之后版本可删除此if子句 LoginInfo loginInfo = (LoginInfo)principal;
// if (authorizingRealm == null){
// LogUtils.saveLog(UserUtils.getUser(), ServletUtils.getRequest(), // 退出成功之前调用退出事件,方便记录日志等相关销毁工作
// "系统退出", Log.TYPE_LOGIN_LOGOUT); authorizingRealm.onLogoutSuccess(loginInfo, (HttpServletRequest)request);
// }
// else{ // 设定了用户类型的登录页面,则退出到对应用户类型的登录页面
// 退出成功之前初始化授权信息并处理登录后的操作 String userType = loginInfo.getParam("userType");
authorizingRealm.onLogoutSuccess((LoginInfo)subject.getPrincipal(), if(StringUtils.isNotBlank(userType)){
(HttpServletRequest)request); redirectUrl += StringUtils.contains(redirectUrl, "?") ? "&" : "?";
// } redirectUrl += "param_userType=" + userType;
}
} }
// 退出登录 // 退出登录
subject.logout(); subject.logout();