5

may i know is there any tutorials/guideliness on spring security integrate with facebook connect

cometta
  • 35,071
  • 77
  • 215
  • 324

5 Answers5

7

The guys at Springsource have launched 'Spring Social' which is worth keeping an eye on when dealing any social API (including facebook). See http://www.springsource.org/spring-social

Hans Westerbeek
  • 5,645
  • 3
  • 34
  • 35
2

Spring Social is great but works only with Spring Framework 3.0+. So watch your spring version because i tried two days to figure out how to make Spring Social work with Spring Framework 2.5 ;)

Jiri Vlasimsky
  • 684
  • 6
  • 13
1

Maybe you should look at OAuth for Spring Security and Authentication - Facebook Developers

Raghuram
  • 51,854
  • 11
  • 110
  • 122
1

Additionally to Spring security you need Spring social, see Signing in with Service Provider Accounts. A promising blog entry is Integrating your Java Spring MVC webapp with Facebook – Part 1: Doing the OAuth Dance.

ChrLipp
  • 15,526
  • 10
  • 75
  • 107
0

You can use facbook graph api to request the users info and than parse it like this:

        JSONObject resp = new JSONObject(content);
        String facebookid = resp.getString("id");
        String firstName = resp.getString("first_name");
        String lastName = resp.getString("last_name");
        String email = resp.getString("email");
        String phone = resp.getString("mobile_phone");

        JSONObject address = resp.getJSONObject("address");
        String street = address.getString("street");
        String city = address.getString("city");
        String zip = address.getString("zip");
        String state = address.getString("state");
        String country = address.getString("country");

After you have the strings calling your registration method should be easy. Than you just have to auto authenticate them.

I have posted more details about this here: Facebook Connect example in JSP (tomcat)

Community
  • 1
  • 1
MatBanik
  • 26,356
  • 39
  • 116
  • 178