springSecurityLoginProcess
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
OAuth2User oauth2User = this.userService.loadUser(new OAuth2UserRequest(loginAuthenticationToken.getClientRegistration(), accessToken, additionalParameters));
return authenticationResult;
}b. loadUser์์ ๋ฆฌํดํ๋ OAuth2User๋ principal์ด ๋ ๊ฒ์ด๊ธฐ์ ์ค์ํ๋ค. principal์ ํ์ฌ ์ ์ ํ
์ด๋ธ์ ๋ง๊ฒ ๊ตฌํํ๊ณ ์ถ๋ค๋ฉด OAuth2User ์ธํฐํ์ด์ค๋ง ์์ํด์ ํ์ฌ ํ
์ด๋ธ์ ๋ง๊ฒ ๊ตฌํํ๋ฉด ๋๋ค.
c. `OAuth2LoginAuthenticationProvider` ์ authenticate ๋ฉ์๋๋ `ProviderManager`์ authenticate๋ฉ์๋์์ ํธ์ถํ๋ค.
d. `ProviderManager`์ authenticate ๋ฉ์๋๋ `OAuth2LoginAuthenticationFilter` ์์ ํธ์ถํ๋ค.
```xml
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
OAuth2LoginAuthenticationToken authenticationResult = (OAuth2LoginAuthenticationToken)this.getAuthenticationManager().authenticate(authenticationRequest);
}
```
๋ฆฌํด๋ `Authentication` ๊ฐ์ฒด๋ฅผ `OAuth2LoginAuthenticationToken` ๋ก ๋ค์ด์บ์คํ
ํ๋ค.
e. ์์์`OAuth2LoginAuthenticationFilter` ์ `attemptAuthentication` ๋ฉ์๋์์ `AuthenticationManager`๋ฅผ ๊ฐ์ ธ์์ `authenticate`๋ฉ์๋๋ฅผ ํธ์ถํ๋ค. ์ด `attemptAuthentication` ๋ `AbstractAuthenticationProcessingFilter` ์ `doFilter` ๋ฉ์๋์์ ํธ์ถํ๋ค.
```xml
private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
Authentication authenticationResult = this.attemptAuthentication(request, response);
}
```
f. ์ด `AbstractAuthenticationProcessingFilter` ๋ `FilterChainProxy` ์์ ํธ์ถ๋๋ค.
g. ๊ทธ ๋ค์์ `FilterChainProxy` ๋ ๋ค์ ํํฐ์ธ `OAuth2AuthorizationRequestRedirectFilter`๋ฅผ ํธ์ถํ๋ค.
h. ๊ทธ ๋ค์์ `OncePerRequestFilter` ์ด๋ค.
j. ์ด์ ๋ณ์๋ณ ํํฐ๋ฅผ ๋ค ๊ฑฐ์น๋ค.Last updated