package com.tofly.auth.handler;

import com.tofly.common.oauth.handler.AbstractAuthenticationFailureEvenHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.stereotype.Component;

/**
 * @author Administrator
 * @date 2019/9/10  11:14
 */
@Component
@Slf4j
public class AuthAuthenticationFailureEvenHandler extends AbstractAuthenticationFailureEvenHandler {
    @Override
    public void handle(AuthenticationException authenticationException, Authentication authentication) {
        log.info("用户：{} 登录失败，异常：{}", authentication.getPrincipal(),
                authenticationException.getLocalizedMessage());
    }
}
