[Spring Security] User Authentication Example - 2. Custom Authentication Provider 구현 및 Login Form 작성
1. AuthenticationProvider 인터페이스 구현 org.springframework.security.authentication.AuthenticationProvider 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 public class CustomAuthenticationProvider implements AuthenticationProvider { private UserService userService; private static final Logger logger = LoggerFactory.getLogger(CustomAuthenticationProvider. class ); @Override public Authentication authenticate(Authentication auth) throws AuthenticationException { String email = ( String ) auth.getPrincipal(); String password = ( String ) auth.getCredentials(); User user = (User) userService.loadUserByUsername(email); if (user.getPassword(). equals (password)) { logger.info( "Authentication Success!!! {}" , em