네이버에서는 스프링 시큐리티를 지원하지 않기 때문에 CommonOAuth2Provider에서 해주던 값들도 수동으로 입력 필요
// application-oauth.properties
# registration
spring.security.oauth2.client.registration.naver.client-id=네이버클라이언트ID
spring.security.oauth2.client.registration.naver.client-secret=네이버클라이언트시크릿
spring.security.oauth2.client.registration.naver.redirect-uri={baseUrl}/{action}/oauth2/code/{registrationId}
spring.security.oauth2.client.registration.naver.authorization-grant-type=authorization_code
spring.security.oauth2.client.registration.naver.scope=name,email,profile_image
spring.security.oauth2.client.registration.naver.client-name=Naver
# provider
spring.security.oauth2.client.provider.naver.authorization-uri=https://nid.naver.com/oauth2.0/authorize
spring.security.oauth2.client.provider.naver.token-uri=https://nid.naver.com/oauth2.0/token
spring.security.oauth2.client.provider.naver.user-info-uri=https://openapi.naver.com/v1/nid/me
/* user-name-attribute=response
: 네이버의 회원 조회 시 반환되는 JSON 형태 때문에
기준이 되는 user_name의 이름을 네이버에서는 response로 해야 함 */
spring.security.oauth2.client.provider.naver.user-name-attribute=response
네이버 오픈 API의 로그인 회원 결과
스프링 시큐리티에선 하위 필드를 명시할 수 없음
최상위 필드들인 resultcode, message, response만 user_name으로 지정 가능
이러한 이유로 스프링 시큐티리에서 인식 가능한 필드는 저 3개 중 골라야 함
여기선 본문에서 담고 있는 response를 user_name으로 지정하고 이후 자바 코드로 response의 id를 user_name으로 지정