home/writing/prompt-spring-security-deep-dive

Prompt Spring Security Deep Dive

GPTClaudeGemini··303 copies·updated 2026-07-14
prompt-spring-security-deep-dive.prompt
# Spring Security Deep Dive 레포지토리 제작 프롬프트

나는 "Spring Security Deep Dive" 레포지토리를 만들려고 해.
FilterChainProxy가 어떻게 15개 Filter를 거쳐 인증/인가하는지, JWT 토큰이 SecurityContext에 저장되는 과정을 완전히 파헤치는 레포를 만들 거야.

## 📋 프로젝트 목표

**컨셉**: "요청이 Filter Chain을 거쳐 인증되는 전체 여정"

**핵심 차별화**:
1. Security Filter Chain 15개 완전 분해
2. Authentication vs Authorization 명확한 구분
3. JWT 인증 구현의 모든 과정
4. OAuth2/OpenID Connect 완전 정복

**타겟 독자**:
- Spring Security를 쓰지만 "마법" 같다고 느끼는 개발자
- Filter Chain이 무엇인지 모르는 개발자
- JWT 구현은 했지만 원리를 모르는 개발자
- OAuth2 Authorization Code Flow를 설명 못하는 개발자

**선행 학습**:
- Spring Core Deep Dive (Filter, AOP 이해 필수)
- Spring MVC Deep Dive (DispatcherServlet 이해 권장)

---

## 🎯 1단계: 전체 구조 설계

다음 7개 챕터로 레포지토리를 설계해줘:

### Chapter 1: Security Architecture (7개 문서)
- DelegatingFilterProxy와 FilterChainProxy 관계
- SecurityFilterChain 구성과 우선순위
- Security Filter 15개 완전 정복 (순서와 역할)
- SecurityContext & SecurityContextHolder (ThreadLocal)
- Authentication 객체 구조 (Principal, Credentials, Authorities)
- GrantedAuthority vs Role 차이
- SecurityContextPersistenceFilter 동작

### Chapter 2: Authentication Process (7개 문서)
- AuthenticationManager vs ProviderManager 차이
- AuthenticationProvider 체인 동작
- UserDetailsService 구현과 커스터마이징
- PasswordEncoder 종류와 선택 (BCrypt, Argon2, SCrypt)
- UsernamePasswordAuthenticationFilter 분석
- Remember-Me 인증 메커니즘
- Custom Authentication Provider 작성

### Chapter 3: Authorization & Method Security (6개 문서)
- @PreAuthorize vs @Secured vs @RolesAllowed
- Method Security 동작 원리 (AOP Proxy)
- FilterSecurityInterceptor 내부 구조
- AccessDecisionManager와 Voter 체인
- SpEL을 활용한 복잡한 권한 검사
- Custom Authorization Logic

### Chapter 4: Session Management (6개 문서)
- Session Fixation 공격과 방어
- Concurrent Session Control (동시 로그인 제한)
- Session Timeout 처리
- SessionRegistry 활용
- Stateless Session (JWT 환경)
- CSRF Protection 메커니즘

### Chapter 5: JWT Authentication (7개 문서)
- JWT 구조 완전 분석 (Header, Payload, Signature)
- Custom JWT Authentication Filter 작성
- JWT Token 발급 과정 (JwtTokenProvider)
- JWT Token 검증과 SecurityContext 저장
- Refresh Token 전략 (RTR - Refresh Token Rotation)
- Claims 추출과 사용
- JWT Token 만료 및 갱신 처리

### Chapter 6: OAuth2 & OpenID Connect (7개 문서)
- OAuth2 4가지 Grant Type (Authorization Code, Implicit, Password, Client Credentials)
- Authorization Code Flow 완전 분석
- OAuth2LoginAuthenticationFilter 동작
- ClientRegistration과 InMemoryClientRegistrationRepository
- OAuth2AuthorizedClient 관리
- Custom OAuth2UserService 작성
- JWT Bearer Token Resource Server

### Chapter 7: Advanced Security Topics (5개 문서)
- CORS Configuration (CorsFilter vs @CrossOrigin)
- Security Headers (CSP, XSS Protection, HSTS, X-Frame-Options)
- Security Events & Listeners (AuthenticationSuccessEvent)
- Method Security with SpEL 고급 활용
- Multi-tenancy Security 전략

---

각 챕터는 **5~7개 문서**로 구성해줘. 총 **45개 문서** 목표.

**문서 구조**:

when to use it

Community prompt sourced from the open-source GitHub repo e9ua1/prompt-blueprints (no explicit license). A "Prompt Spring Security Deep Dive" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

writingcommunitygeneral

source

e9ua1/prompt-blueprints · no explicit license