강의노트
-
[스프링 시큐리티] LogoutFilter강의노트/스프링 시큐리티 2020. 9. 10. 13:52
LogoutFilter 기능 세션 무효화 인증 토큰 삭제 SecurityContext에서 해당 토큰 삭제 쿠키 정보 삭제 로그인 페이지로 리다이렉트 protected void configure(HttpSecurity http) throws Exception { http.logout() // 로그아웃 처리 .logoutUrl("/logout") // 로그아웃 처리 Url .logoutSuccessUrl("/login") // 로그아웃 성공 후 이동페이지 .deleteCookies("JSESSIONID", "remember-me") // 로그아웃 후 쿠키 삭제 .addLogoutHandler(logoutHandler()) // 로그아웃 핸들러 .logoutSuccessHandler(logoutSuccessH..
-
[스프링 시큐리티] UsernamePasswordAuthenticationFilter강의노트/스프링 시큐리티 2020. 9. 10. 11:46
UsernamePasswordAuthenticationFilter Form Login 시도 시 인증처리를 담당하고 처리하는 필터 AntPathRequestMatcher 요청 정보가 매칭되는지 확인한다. default는 login이고 loginProcessingUrl을 변경하면 변경 된 정보로 매칭작업 진행한다. Authentication Authentication 객체를 생성 후 사용자가 로그인 할 때 전달된 Username + Password 값을 인증 객체에 저장하고 AuthenticationManager에 인증을 위임한다. AuthenticationManager AuthenticationManager는 내부적으로 AuthenticationProvider 타입의 객체들을 포함하고 있고 이 객체들 중에..
-
[스프링 시큐리티] Form Login 인증강의노트/스프링 시큐리티 2020. 9. 10. 10:42
WebSecurityConfigurerAdapter WebSecurityConfigurer 객체를 생성하기 위한 추상 클래스를 제공한다. 함수 오버라이딩을 통해서 구현을 커스터마이징 할 수 있다. WebSecurityConfigurer WebSecurity를 커스터마이징 할 수 있다. 웹 보안을 활성화 시키기 위해서 @EnableWebSecurity 어노테이션을 적용한다. @EnableWebSecurity 어노테이션을 적용하면 자동으로 WebSecurityConfigureAdapter를 상속받은 Configuration이 WebSecurity에 적용된다. import org.springframework.context.annotation.Configuration; import org.springframew..
-
[스프링 시큐리티] 프로젝트 구성강의노트/스프링 시큐리티 2020. 9. 10. 10:39
프로젝트 생성 Spring Initializer를 통해서 Spring Security와 테스트를 위한 Spring Web 의존성을 추가한다. Spring Security 의존성 추가 시 내부 동작 서버가 기동되면 스프링 시큐리티의 초기화 작업 및 보안 설정이 진행된다. 별도의 설정이나 구현을 하지 않아도 기본적인 보안 기능이 자동 구성되어 구동된다. 모든 요청은 인증이 되어야 자원에 접근이 가능하다. 인증 방식은 폼 로그인 방식과 httpBasic 로그인 방식을 제공한다. 기본 로그인 페이지를 Spring Security 내부에서 제공한다. 기본 계정 한 개를 제공한다. username : user / password : 어플리케이션 구동 시 로그에 문자열로 제공된다. 참조 : 스프링 시큐리티 - Spr..