programming study/B-Spring Security 6

오류 해결 - 순환참조 The dependencies of some of the beans in the application context form a cycle

순환 참조 오류 The dependencies of some of the beans in the application context form a cycle: 2023-01-11 17:23:41.435 ERROR 10128 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: The dependencies of some of the beans in the application context form a cycle: ┌─────┐ | securityConfig (field priv..

스프링 시큐리티 사용 이유

[Spring Security] 스프링시큐리티의 기본 개념과 구조 (tistory.com) 로그인 인증 인가 처리 보안 스프링 시큐리티를 사용하는 이유? Spring Security 1편 (tistory.com) SpringSecurity를 왜 써야할까? - Flamme Dev (gitbook.io) Spring Security 스프링 시큐리티? (tistory.com) 스프링 시큐리티란? Spring Security 는 Spring 기반으로 인증 과 권한에 대한 것을 Filter에서 처리하는 프레임워크입니다. Filter vs Interceptor Filter는 Dispatcher Servlet 으로 가기전에 적용되므로 가장먼저 URL 요청을 받지만 Interceptor는 Controller 사이에 위..

spring security config 설정할 때 WebSecurityConfigurerAdapter 가 Deprecated 된다. 해결법

출처 - https://devlog-wjdrbs96.tistory.com/434 WebSecurityConfigurerAdapter Deprecated 해결하기 최근에 Spring Security를 설정해보려고 WebSecurityConfigurerAdapter를 사용하려 보니 Deprecated가 되어 있었는데요. @RequiredArgsConstructor @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { private final ObjectMapper objectMapper; private final JwtAuthenticationFilter jwtAuthenticationFilter; @O..

Spring Security 로그인 동작 흐름

요약 로그인 요청이 오면 필터가 가로채서 username,password를 확인하여 세션에 있는 SecurityContextHolder 안에 있는 SecurityContext에 Authentication 객체( user 오브젝트 역할) 를 저장한다. Authentication객체는 AuthenticationManager가 만들어준다. 자세한 과정 - username,password를 가지고 로그인 요청이 왔을 때 AuthenticationFilter가 가로채서 usernamePasswordAuthenticationToken을 만들어준다. - AuthenticationManager이 usernamePasswordAuthenticationToken을 받아서 Authentication ( session )을 ..

Spring Security 사용하기

필요한 의존성 org.springframework.security spring-security-taglibs org.springframework.boot spring-boot-starter-security 스프링 시큐리티 로그인 localhost의 어느 url로 요청하든지 spring security가 가로채서 로그인창이 있는 화면을 띄운다. id는 user password는 spring security가 만든 password를 사용한다. spring을 run하면 log에 패스워드를 보여준다. Using generated security password: ㅁㅁㅁㅁㅁㅁㅁㅁㅁㅁㅁㅁㅁㅁㅁㅁㅁ This generated password is for development use only. Your security..