SpringSecurity-3.基础篇 同账号多端登录被迫下线
maximumSession 设置为1 ,同一个session最大登录客户端数量。
expiredSessionsStrategy: 自定义Session超时策略
二、实例:
1. 建立自定义策略类:
com.zhl.springsecuritydemo.config.CustomExpiredSessionStrategy
public class CustomExpiredSessionStrategy implements SessionInformationExpiredStrategy {
private RedirectStrategy redirectStrategy=new DefaultRedirectStrategy();
private ObjectMapper objectMapper=new ObjectMapper();
/*
* 当Session失效后的处理策略
* */
@Override
public void onExpiredSessionDetected(S