| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 |
- CORS
- redis
- JPA
- 페이징
- AWS
- docker
- securitycontextholderfilter
- @Transactional
- Web
- docker compose
- Routing Key
- @ComponentScan
- Dead Letter Queue
- mybatis
- 쿠버네티스
- kafka
- JPQL
- 서블릿 컨테이너
- 스프링 부트
- Spring
- JdbcTemplate
- Spring Data JPA
- dockerhub
- 컨테이너
- JWT
- Spring Container
- DI
- 지연 로딩
- MSA
- DLQ
- Today
- Total
목록Spring (80)
look-forest
메소드 시큐리티서비스 계층 메소드를 직접 호출 시 사용하는 보안 기능. (웹 기반일 경우 필요 X) 1. 메소드 시큐리티 설정@EnableMethodSecurity 애노테이션을 통해 메서드 보안이 활성화되며, AOP 를 통해 @PreAuthorize, @PostAuthorize 같은 메서드 보안 애노테이션을 사용할 수 있게 된다@EnableMethodSecurity(securedEnabled = true, prePostEnabled = true, jsr250Enabled = true)@Configurationpublic class MethodSecurity { // 추가적인 보안 설정이 필요한 경우 이곳에 작성 // AuthenticationManager를 Bean으로 등록 @Bean ..
기타 필터들에 대해서 정리해보자. Security filter chain: [ DisableEncodeUrlFilter WebAsyncManagerIntegrationFilter SecurityContextHolderFilter HeaderWriterFilter CsrfFilter LogoutFilter UsernamePasswordAuthenticationFilter DefaultLoginPageGeneratingFilter DefaultLogoutPageGeneratingFilter BasicAuthenticationFilter RequestCacheAwareFilter SecurityContextHolderAwareRequestFilter Anonymou..
인가 전체 구조AuthorizationFilterAuthorizationManager 를 사용하여 Access Control 또는 예외 처리 하는 필터.대부분의 경우 FilterChainProxy에 마지막 필터로 들어있다. (인증을 거친 후 최종 인가) 아래와 같이 SecurityFilterChain의 authorizeHttpRequests()로 설정한 값에 따라 인가를 수행한다.http .authorizeHttpRequests((auth) -> auth .requestMatchers("/").permitAll() .anyRequest().permitAll()); 주요 로직 : doFilter()public class Authorizati..
인증 전체 과정 개요Request에 맞는 Authentication Filter가 동작해서 AuthenticationToken을 만든다.인증 토큰에 맞는 AuthenticationProvider가 동작해서 인증 결과를 만든다.인증 결과로 접근 권한을 확인하여 접근을 허락하거나 거부한다. 인증 전체 구조 UsernamePasswordAuthenticationFilterPOST : “/login” 경로에서 Form 기반 인증을 진행할 수 있도록, multipart/form-data 형태의 username/password 데이터를 받아 인증 클래스에게 값을 넘겨주는 역할.커스텀 SecurityFilterChain을 생성하면 자동 등록이 안되기 때문에 아래 구문을 통해서 필터를 활성화시켜야 한다.http.for..
서블릿 필터 → 스프링 빈으로 시큐리티 로직 위임DelegatingFilterProxy와 FilterChainProxyDelegatingFilterProxy서블릿 필터 처리를 스프링에 들어있는 빈으로 위임하고 싶을 때 사용하는 서블릿 필터스프링 빈을 찾아 요청을 넘겨주는 서블릿 필터. 스프링 시큐리티 의존성을 추가하면 자동 추가된다.FilterChainProxy에게 시큐리티 관련 처리를 위임한다.타겟 빈 이름을 설정해야 하는데, 스프링 부트를 사용할 때는 자동으로 등록된다. (SecurityFilterAutoConfiguration)FilterChainProxyDelagatingFilterProxy에 의해 호출되는 SecurityFilterChain을 들고 있는 빈보통 “springSecurityFilt..
먼저 스프링 시큐리티 기본 구현 방법을 알아보자.스프링 시큐리티 사용법스프링 시큐리티 연동 스프링 시큐리티 의존성을 추가하고 나면 모든 요청은 인증을 필요로 하고,기본 로그인 페이지가 나타나며,기본 유저가 생성된다. (by UserDetailsServiceAutoConfiguration, SecurityProperties) 스프링 시큐리티 설정DefaultSecurityFilterChain이 아닌 커스텀 SecurityFilterChain를 등록하려면 아래와 같이 SecurityFilterChain 인터페이스를 반환하면 된다.@Configuration@EnableWebSecuritypublic class SecurityConfig { @Bean public SecurityFilterChain ..
시큐리티 동작 원리시프링 시큐리티는 WAS의 필터 단에서 요청을 가로챈 후 시큐리티 역할 수행WAS의 필터에 필터를 만들어넣고 해당 필터에서 요청을 가로챔 스프링 컨테이너 내부에 구현되어있는 시큐리티 감시 로직을 거침시큐리티 로직을 마친 후 다시 WAS의 다음 필터 진행 스프링 시큐리티 로직은 여러개의 필터들이 나열된 필터 체인 형태로 구성각각의 필터에서 CSRF, 로그인/로그아웃, 인가 등 작업 수행 전체 구조 DelegatingFilterProxy스프링 빈을 찾아 요청을 넘겨주는 서블릿 필터. 스프링 시큐리티 의존성을 추가하면 자동 추가됨FiterChainProxy DelagatingFilterProxy에 의해 호출되는 SecurityFilterChain을 들고 있는 빈SecutiryFilt..
REST API의 리소스 모델로 응답하기 RepresentationModel REST API의 리소스 모델Spring HATEOAS에서 RepresentationModel은 REST API에서 리소스를 표현하고 하이퍼미디어를 추가하는 기본 클래스. 이 클래스는 서버가 리소스의 상태와 함께 하이퍼링크를 포함해, 클라이언트가 어떤 행동을 수행할 수 있는지 명시적으로 알려줄 수 있도록 도와줘, 이를 통해 클라이언트는 서버의 응답에 포함된 링크를 통해 상태 전이를 수행할 수 있게 된다.public class EntityModel extends RepresentationModel> { RepresentationModel은 기본적으로 단순한 리소스 표현을 다루며, EntityModel, CollectionModel..