-
SecurityFilterChain을 여러개 쓰고자 한다면 securityMatcher!프레임워크/Spring Boot 2024. 5. 3. 17:43
스프링 문서를 돌고 돌다 찾은 키워드를 기록하고자 글을 적습니다.
시큐리티 공식 문서에 보면 경로에 맞는 적절한 필터체인을 구현해서 쓰라고 안내합니다.
하지만 어떻게가 빠져있습니다..
밑으로 내려가면 Order를 정해서 사용할 수 있다고는 하나, Order를 사용해서 FilterChain을 구분하는 방법은 경로를 분리하기 위함이라기 보다는, 동일한 경로 내에서 우선순위를 정하는 용도가 아닐까 합니다.
그래서 돌고 돌다가 문서의 다른 곳에서 securityMatcher 메소드를 찾았습니다.
3번에 보면 applicable only to 라는 문구가 있군요.
그리하여 id/pw 로그인 경로와 Oauth 로그인 경로를 분리해보았습니다.
이후에 Oauth 관련 설정 내용이 많아진다면 Oauth Config는 따로 분리해도 좋을 것 같습니다.
감사합니다.
[Reference]
1st image: https://docs.spring.io/spring-security/reference/servlet/architecture.html
2nd image: https://docs.spring.io/spring-security/reference/servlet/configuration/java.html
'프레임워크 > Spring Boot' 카테고리의 다른 글
필터에서 발생하는 예외 처리하기 (0) 2024.05.07 Spring Security 다이어그램으로 flow 정리하기 (0) 2024.05.07 RestTemplate는 응답 객체를 LinkedHashMap으로 파싱한다 (0) 2024.05.02 RestTemplate은 4xx를 예외로 처리한다. (0) 2024.05.02 SpringBootApplication이 필요한 bean을 찾지 못하는 경우 (0) 2024.04.25