Exception while configuration oauth2 provider
Configuration:
Code:
<beans:bean id="tokenServices" class="org.springframework.security.oauth2.provider.token.InMemoryOAuth2ProviderTokenServices">
<beans:property name="supportRefreshToken" value="true"/>
</beans:bean>
<oauth:provider client-details-service-ref="clientDetails" token-services-ref="tokenServices">
<oauth:verification-code approval-handler-ref="myUserApprovalHandler" />
</oauth:provider>
Implementation:
Code:
public class MyUserApprovalHandler implements UserApprovalHandler {
public boolean isApproved(ClientAuthenticationToken clientAuthentication) {
return true;
}
}
Why I get the next exception ?
(Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.security.oauth.examples.sparkl r.mvc.MyUserApprovalHandler] to required type [org.springframework.security.web.RedirectStrategy] for property 'redirectStrategy': no matching editors or conversion strategy found)
Code:
ERROR ContextLoader - Context initialization failed <org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChainProxy': Cannot resolve reference to bean 'oauth2VerificationCodeFilter' while setting bean property 'filterChainMap' with key [/**] with key [11]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauth2VerificationCodeFilter': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.security.oauth.examples.sparklr.mvc.MyUserApprovalHandler' to required type 'org.springframework.security.web.RedirectStrategy' for property 'redirectStrategy'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.security.oauth.examples.sparklr.mvc.MyUserApprovalHandler] to required type [org.springframework.security.web.RedirectStrategy] for property 'redirectStrategy': no matching editors or conversion strategy found>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChainProxy': Cannot resolve reference to bean 'oauth2VerificationCodeFilter' while setting bean property 'filterChainMap' with key [/**] with key [11]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauth2VerificationCodeFilter': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.security.oauth.examples.sparklr.mvc.MyUserApprovalHandler' to required type 'org.springframework.security.web.RedirectStrategy' for property 'redirectStrategy'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.security.oauth.examples.sparklr.mvc.MyUserApprovalHandler] to required type [org.springframework.security.web.RedirectStrategy] for property 'redirectStrategy': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:355)