1.의의

2.로그인 페이지 설정

package security.starting;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

	@Override
	protected void configure(HttpSecurity http) throws Exception {
		http
		.authorizeRequests()
		.anyRequest()
    .authenticated();

http
	  .formLogin()
  	.loginPage("/loginPage")   //사용자 정의 로그인 페이지 
		.defaultSuccessUrl("/") //로그인 성공후 이동 페이지 
		.failureUrl("/login")  //로그인 실패 후 이동 페이지
//서버에 사용자 입력값을 전송할 때 폼  입력 요소의 인증 정보 파라미터명을 변경한다.
		.usernameParameter("userId") //ID 파라미터 설정
		.passwordParameter("passwd") //PASSWORD 파라미터 설정
		.loginProcessingUrl("/login_proc") 
		.permitAll();
		  
		  
	}

}

Untitled

3)Cumstom login 인증 화면

3.로그인 성공 처리