美文网首页
Spring Security——认证失败时获取认证信息

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