
🤍스프링 시큐리티 프로젝트 생성 1. application.properties에 시큐리티 설정 추가 logging.level.org.springframework.security.web=trace logging.level.org.zerock=debug 2. 시큐리티 설정 클래스 SecurityConfig 작성 @Configuration @Log4j2 public class SecurityConfig extends WebSecurityConfigurerAdapter { } 💡인증(Authentication) & 인가(Authorization) 은행에 금고가 있고 사용자가 금고 내용을 열어 본다고 가정했을 때 사용자가 신분증으로 자신을 증명 => 인증 은행에서 사용자가 금고를 열어볼 수 있는지 판단 => 인가..

🤍스프링 시큐리티 구현하기 스프링 시큐리티는 스프링 기반의 애플리케이션(인증, 권한, 인가 등)을 담당하는 스프링 하위 프레임워크임. 1. 인증이 안 된 사용자들이 출입할 수 있는 /auth/ 경로를 UserController에 추가해 준다. 2. 요청이 들어왔을 때 인증이 필요한지, 필요하지 않은지 구분하는 시큐리티 필터를 등록하는 SecurityConfig 클래스 생성 3. 설정 후 localhost:8080 주소로 접근하면 아래와 같은 화면이 뜨지만 4. 인증없이 접근할 수 있도록 설정해놓은 /auth/ 주소로 접속하면 페이지가 잘 뜨는 것을 확인할 수 있다. 5. 기존에 작성한 loginForm.jsp에서 form태그를 수정한다. 6.SecurityConfig 코드를 아래와 같이 수정하면 위의 f..

폼은 지난번에 만들어둔 loginForm을 활용하고 Ajax 코드도 회원가입 코드를 복사해서 수정 후 활용할 것이다. 1. 로그인 버튼 수정 로그인 2. User.js 에 로그인 코드 작성 let index = { init: function(){ $("#btn-save").on("click",()=>{//function(){} 대신 ()=>{} : this를 바인딩하기 위해서 this.save(); }); $("#btn-login").on("click",()=>{//function(){} 대신 ()=>{} : this를 바인딩하기 위해서 this.login(); }); }, login: function(){ //alert('user의 save함수 호출됨'); let data = { username: $(..