1. 스프링 시큐리티 기본 설정
2. 스프링 시큐리티 폼 인증 설정
3. 스프링 시큐리티 OAuth2 인증 서버 설정
4. 스프링 시큐리티 OAuth2 인증 서버 설정 : 리소스 서버 설정
1. 스프링 시큐리티 기본 설정
1-1) 스프링 시큐리티
- 시큐리티 필터를 적용하기 않음...
- 로그인 없이 접근 가능
- GET /api/events
- GET /api/events/{id}
- 로그인 해야 접근 가능
- 나머지 다...
- POST /api/events
- PUT /api/events/{id{
- ...
1-2) 스프링 시큐리티 OAuth 2.0
- AuthorizationServer: OAuth2 토큰 발행(/oauth/token) 및 토큰 인증(/oauth/authorize)
- Oder 0 (리소스 서버 보다 우선 순위가 높다.)
- ResourceServer: 리소스 요청 인증 처리 (OAuth 2 토큰 검사)
1-3) 스프링 시큐리티 설정
- @EnableWebSecurity
- @EnableGlobalMethodSecurity
- extends WebSecurityConfigurerAdapter
- PasswordEncoder: PasswordEncoderFactories.createDelegatingPassworkEncoder()
- TokenStore: InMemoryTokenStore
- AuthenticationManagerBean
- configure(AuthenticationManagerBuidler auth)
- userDetailsService
- passwordEncoder
- configure(HttpSecurity http)
- configure(WebSecurty web)
- PathRequest.toStaticResources() 사용하기
1-4) 시큐리티 설정 구현-1
1-4)-1. AppConfig(Click)

1-4)-2. SecurityConfig
TokenStore
, *토큰을 저장하는 장소*

-
AuthenticationManager
*외부에서 사용 하기 위해, AuthenticationManagerBean 을 이용하여*
*Spring Security 밖으로 AuthenticationManager 빼 내야 한다.*

-
Spring Security Filter

2. 스프링 시큐리티 폼 인증 설정
2-1) AccountServiceTest

-
Console(Error)

2-2) AccountService
- 패스워드 인코딩해서 매칭시키기
- Test Code(Success)


2-3) AppConfig

-
Browser

-
JsonParser(Success)

3. 스프링 시큐리티 OAuth2 인증 서버 설정
3-1) 테스트할 목록
- 토큰 발행 테스트
- User
- Client
- POST /oauth/token
- HTTP Basic 인증 헤더 (클라이언트 아이디 + 클라이언트 시크릿)
- 요청 매개변수 (MultiValuMap<String, String>)
- grant_type: password
- username
- password
- 응답에 access_token 나오는지 확인
- AuthorizationServer 설정-1
- AuthorizationServer 설정-2
- AuthorizationServer 설정-3
3-2) 테스트할 목록 구현-1
3-3) 테스트할 목록 구현-2
3-4) 테스트할 목록 구현-3
3-5) 테스트할 목록 구현-4
4. 스프링 시큐리티 OAuth2 인증 서버 설정 : 리소스 서버 설정