고객 SSO와 연동하며 OAuth client와 server를 모두 구현해야 했던 관점에서 Spring Security 5의 OAuth 2.0 지원을 정리한다. 분리돼 혼란스럽던 이전 생태계가 왜 하나의 API로 통합됐는지 역사와 함께, production에서 실제로 필요한 설정 지점을 짚는다.
핵심 포인트- Resource Owner·Client·Resource Server·Authorization Server 네 역할과 authorization code→token 교환→검증 흐름을 사진첩 사례로 설명하고, formLogin처럼 oauth2Login 한 줄에서 시작하는 통합 설정을 제시
- 과거 Spring Security OAuth·Spring Social·Boot @EnableOAuth2Sso로 흩어졌던 설정이 Security 5에서 Client·Resource Server 통합 재구현으로 정리되고, Authorization Server는 community 요구로 별도 project로 부활
- Client는 in-memory authorized client service가 사용자 증가 시 OOM·다중 서버 인증 소실을 유발하므로 JDBC나 앱 data store로 교체. Authorization Server는 최우선 SecurityFilterChain + RegisteredClientRepository + JWKSource 구성이 필요하고 당시 0.2.0엔 UserInfo endpoint를 직접 구현
왜 읽나Spring Security 5로 OAuth client·server를 production에 올려야 하는 백엔드 개발자에게 protocol 역할·migration 배경·설정 함정을 아우르는 안내서.