Facebook Connect Login with Spring Security

Kadir Pekel already described a procedure to integrate Facebook Connect in a blog entry. So just a quick summary on my experiences:

Dependency on Facebook Java API

Add a dependency to the Facebook Java API. Easy done with Maven:

Spring Security Facebook

Download the code for spring-security-facebook and either integrate that into your project or build it into an own jar.

Spring Config and HTML

The only missing thing is to configure the Facebook Security code in the Spring configuration files and the according HTML code.

  • Adjust the Spring Config to have an additional authentication provider.
  • The Facebook On-Login function must redirect to the configured authentication URL, e.g. /j_spring_security_facebook.

Details on adding these things can be found in my description on Multiple Authentication Providers.