Spring Security——认证失败时获取认证信息
作者:
CoderZS | 来源:发表于
2021-07-20 11:01 被阅读0次@Component
public class AuthenticationFailureListener implements ApplicationListener<AbstractAuthenticationFailureEvent> {
@Override
public void onApplicationEvent(AbstractAuthenticationFailureEvent event) {
//登陆账号 密码
Object username = event.getAuthentication().getPrincipal();
Object credentials = event.getAuthentication().getCredentials();
Object details=event.getAuthentication().getDetails();
String ip = ((WebAuthenticationDetails)details).getRemoteAddress();
}
}

图片.png
本文标题:Spring Security——认证失败时获取认证信息
本文链接:https://www.haomeiwen.com/subject/bqmlmltx.html
网友评论