【问题标题】:spring security integrate with facebook connectspring security 与 facebook connect 集成
【发布时间】:2011-04-16 23:54:09
【问题描述】:

请问有没有关于 spring security 与 facebook connect 集成的教程/指南

【问题讨论】:

    标签: spring spring-mvc facebook spring-security


    【解决方案1】:

    Springsource 的人推出了“Spring Social”,在处理任何社交 API(包括 facebook)时都值得关注。见http://www.springsource.org/spring-social

    【讨论】:

      【解决方案2】:

      Spring Social 很棒,但仅适用于 Spring Framework 3.0+。所以请注意您的春季版本,因为我尝试了两天时间来弄清楚如何使 Spring Social 与 Spring Framework 2.5 一起工作;)

      【讨论】:

        【解决方案3】:

        【讨论】:

          【解决方案4】:

          除了 Spring 安全性之外,您还需要 Spring social,请参阅 Signing in with Service Provider Accounts。一个有前途的博客条目是Integrating your Java Spring MVC webapp with Facebook – Part 1: Doing the OAuth Dance

          【讨论】:

            【解决方案5】:

            您可以使用 facbook graph api 来请求用户信息,然后像这样解析它:

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

            在你有字符串之后调用你的注册方法应该很容易。比你只需要自动验证它们。

            我已在此处发布了有关此的更多详细信息: Facebook Connect example in JSP (tomcat)

            【讨论】:

              猜你喜欢
              • 2014-06-19
              • 2011-06-06
              • 2015-11-13
              • 1970-01-01
              • 1970-01-01
              • 2016-03-11
              • 2012-01-20
              • 2013-09-23
              相关资源
              最近更新 更多