스프링 보안과 스프링 소셜을 사용하여 사용자를 인증하고 웹 앱에 로컬 계정을 자동으로 생성합니다. 인증을 위해 OAuth2 scope
을 어떻게 제공합니까? scope
가야 곳 spring-social-samples에서 spring-social-security SocialAuthenticationFilter를 사용하여 OAuth2 범위를 지정하는 방법은 무엇입니까?
<bean id="socialAuthenticationFilter" class="org.springframework.social.security.SocialAuthenticationFilter"
c:_0-ref="authenticationManager"
c:_1-ref="userIdSource"
c:_2-ref="usersConnectionRepository"
c:_3-ref="connectionFactoryLocator"
p:signupUrl="/spring-social-showcase/signup"
p:rememberMeServices-ref="org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0" />
<bean id="socialAuthenticationProvider" class="org.springframework.social.security.SocialAuthenticationProvider"
c:_0-ref="usersConnectionRepository"
c:_1-ref="socialUsersDetailService" />
scope
에 대한 특정 유스 케이스는 사용자가 페이스 북으로 인증 한 후 로컬 계정을 생성하는 사용자의 페이스 북 이메일 (scope="email"
)을 얻을 수 있도록하는 것입니다.
이것이 1.1.0.M4에서 실패하는 것이 두렵습니다. org.springframework.beans.NotWritablePropertyException :에 의한 콩 클래스의 잘못된 속성 '범위'[org.springframework.social.facebook.security.FacebookAuthenticationService] : 콩 속성 '범위'에 쓰기 권한이 없습니다 또는 잘못된 setter 메소드가 있습니다. setter의 매개 변수 유형이 getter의 반환 유형과 일치합니까? – Christoph
속성 이름이 범위에서 1.1.0.M4의 defaultScope로 변경되었습니다. https://github.com/spring-projects/spring-social/blob/1.1.0.M4/spring-social-security/src/main/java/org/springframework/social/security/provider/OAuth2AuthenticationService.java 참조 – Christoph