spring security

·Back-end
- JDK: openjdk 17 버전- Spring Boot: 3.0.1- Spring Security: 6.0.1- Gradle 언어: Groovy⛓️ Security Filter ChainSecurity Filter Chain은 Spring Security에서 HTTP 요청의 다양한 보안 기능을 제공하기 위한 여러 종류의 필터들의 모음이다. 기본적으로 제공하는 필터들이 있고, 사용자가 만든 커스텀 필터도 필터 체인으로 등록하여 사용할 수 있다. 각 필터는 특정한 보안 작업을 수행하고 다음의 필터로 요청을 전달하는데, FilterChainProxy를 통해 필터 체인이 관리되며 요청이 적절한 필터로 전달된다.🌲 ApplicationContext 초기화ApplicationContext 초기화 과정은 Sp..
java.lang.NullPointerException: Cannot invoke "org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder.getObject()" because "this.authenticationManagerBuilder" is null🌱 문제 상황기존에 구현했던 로직은 AuthenticationManagerBuilder를 통해 인증된 Authentication을 반환하는 형식이다.실제 구동할 때는 잘 동작하는데, 단위 테스트를 수행할 때는 authenticationManagerBuilder.getObject()에서 NPE가 발생했다.@RequiredArgsCon..
현재 개발 중인 프로젝트에서 Spring Security와 JWT를 이용해 로그인 로직을 구현하고 있다. 구현 중 인증(Authentication) 예외와 JWT 예외 처리를 따로 분리하기 위한 과정을 정리해 보았다. 🔙 이전 진행사항 [Spring Security] SecurityConfig permitAll() 적용 안 되는 이유Spring Security를 도입하면 SecurityConfig 클래스 파일에서 웹 애플리케이션의 인증(Authentication) 및 권한 부여(Authorization) 메커니즘을 설정하고 관리하게 된다. 🌱 SecurityConfig.class@RequiredArgsConstructor@Conchaewsscode.tistory.com [Spring Security]..
현재 개발 중인 프로젝트에서 Spring Security와 JWT를 이용해 로그인 로직을 구현하고 있다. 구현 중 SecurityConfig의 permitAll() 메서드와 JwtAuthenticationFilter의 shoudNotFilter() 메서드의 효율적인 관리를 위한 과정을 정리해 보았다. 🔙 이전 진행사항 [Spring Security] SecurityConfig permitAll() 적용 안 되는 이유Spring Security를 도입하면 SecurityConfig 클래스 파일에서 웹 애플리케이션의 인증(Authentication) 및 권한 부여(Authorization) 메커니즘을 설정하고 관리하게 된다. 🌱 SecurityConfig.class@RequiredArgsConstruct..
·Back-end
@Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.csrf().disable(); return http.build(); } Spring Security 코드를 작성하면서 CSRF 공격에 대비를 하지 않고 이를 비활성화시켜도 되는지에 대한 의문이 들었다. 이에 대해 잘 모른 채로 보안 코드를 작성하는 것은 옳지 않다고 생각되어서 CSRF 보안 코드를 왜 비활성화시키는지 찾아 정리해 보았다. 1. CSRF(Cross-Site Request Forgery) 1.1 Cookie & Session CSRF를 알아보기 앞서 쿠키와 세션에 대한 간단한 이해가 필요하다. 사용자가 특정 서버에 로그인하면 일반적으로..
서채리
'spring security' 태그의 글 목록