思路参考:
Java中SpringSecurity密码错误5次锁定用户的实现方法_JAVA教程_服务器之家
异常抛出参考: spring cloud oauth2 登录一定次数后锁定_hqmeng的博客-优快云博客_oauth 用户被锁定
自己写的:
===============================1、失败锁定账号==========================
登录失败的监听处理(失败次数累加、超过则锁定)
@Component
public class AuthenticationFailureListener implements ApplicationListener<AuthenticationFailureBadCredentialsEvent> {
@Value("${loginMgmt.loginErrorMax}")
private Integer loginErrorMax;//#登录错误最大次数(锁定)