我正在尝试使用 Spring Social 1.1.4 来实现社交提供商登录。
在文档中,here我们可以通过SpringSocialConfigurer配置SocialAuthenticationFilter。这里的例子是Java配置。
但是,由于使用基于 XML 配置的现有框架的一些限制,我需要仅使用 XML 配置来实现上述内容。
如何在 spring security 配置 xml 中注入(inject)这个 SpringSocialConfigurer。我的意思是,我应该使用
<sec:custom-filter ...>
或
<sec:http ...>
还是其他什么?
最佳答案
您可以将其添加到安全配置中:
<!-- Adds social authentication filter to the Spring Security filter chain. -->
<security:custom-filter ref="socialAuthenticationFilter" before="PRE_AUTH_FILTER"/>
并添加bean:
<bean id="socialAuthenticationFilter" class="org.springframework.social.security.SocialAuthenticationFilter">
<constructor-arg index="0" ref="authenticationManager"/>
<constructor-arg index="1" ref="userIdSource"/>
<constructor-arg index="2" ref="usersConnectionRepository"/>
<constructor-arg index="3" ref="connectionFactoryLocator"/>
</bean>
关于java - 通过 XML 使用 SpringSocialConfigurer 添加 SocialAuthenticationFilter,以便通过社交提供商登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34400437/