spring security integrate with facebook connect

前端 未结 5 1270
误落风尘
误落风尘 2020-12-15 13:38

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

相关标签:
5条回答
  • 2020-12-15 14:05

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

    0 讨论(0)
  • 2020-12-15 14:16

    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 ;)

    0 讨论(0)
  • 2020-12-15 14:22

    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)

    0 讨论(0)
  • 2020-12-15 14:26

    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

    0 讨论(0)
  • 2020-12-15 14:31

    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.

    0 讨论(0)
提交回复
热议问题