I'm trying to figure out how exactly the Spring Social works and I decided to learn it by coding an example application.
The core of the app is based on appfuse quicksart archetype(multimodule, Spring MVC) which has a basic Spring Security already preconfigured.
I'm using this tutorial which describes the intergration of Spring Social with Spring Security. However, the example uses java-based configuration for Spring Social - and as far as I know, the official documentation is mostly java-base too. This is my social.xml
<!-- Ensures that configuration properties are read from a property file -->
<context:property-placeholder location="classpath:*social.properties"/>
<!--
Configures FB support.
-->
<facebook:config app-id="${facebook.app.id}" app-secret="${facebook.app.secret}" />
<social:jdbc-connection-repository data-source-ref="dataSource" connection-signup-ref="accountConnectionSignup"/>
<bean id="userIdSource" class="org.springframework.social.security.AuthenticationNameUserIdSource" />
<!--
This bean is custom account connection signup bean for your registeration logic.
-->
<bean id="accountConnectionSignup" class="com.yoso.socialApp.service.impl.ConnectionSignupManagerImpl"></bean>
<!--
This bean manages the connection flow between the account provider and
the example application.
-->
<bean id="connectController" class="org.springframework.social.connect.web.ConnectController" autowire="constructor">
<constructor-arg index="0" ref="connectionFactoryLocator"/>
<constructor-arg index="1" ref="connectionRepository"/>
</bean>
<bean id="textEncryptor" class="org.springframework.security.crypto.encrypt.Encryptors"
factory-method="noOpText" />
</beans>
The xml configuration should be analogy to SocialContext
from the mentioned tutorial and is based on this SO question.
The security.xml file is unchanged, I've added only this line
<intercept-url pattern="/auth" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER" />
to the html
tag.
I've also added a simple fb button to the login page, which redirects to /auth/facebook
and added a reference to social.xml
to web.xml
. Now, the problem is that whenever I click on the fb button, nothing happens - the page just refreshes itself. No error, no message, not even in the server console.
Also, I'm not sure if I should create some controller for /auth*
because according to documentation, the SocialAuthenticationFilter
should do that for me.