|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
|
|
|
2
|
+<!DOCTYPE html>
|
|
|
3
|
+<html lang="en">
|
|
|
4
|
+ <head>
|
|
|
5
|
+ <meta charset="utf-8">
|
|
|
6
|
+ <title>Spring Social</title>
|
|
|
7
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
8
|
+ <meta name="description" content="">
|
|
|
9
|
+ <meta name="author" content="">
|
|
|
10
|
+
|
|
|
11
|
+ <!-- Le styles -->
|
|
|
12
|
+ <link href="assets/css/bootstrap.css" rel="stylesheet">
|
|
|
13
|
+ <style type="text/css">
|
|
|
14
|
+ body {
|
|
|
15
|
+ padding-top: 60px;
|
|
|
16
|
+ padding-bottom: 40px;
|
|
|
17
|
+ }
|
|
|
18
|
+ </style>
|
|
|
19
|
+ <link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
|
|
|
20
|
+
|
|
|
21
|
+ <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
|
|
|
22
|
+ <!--[if lt IE 9]>
|
|
|
23
|
+ <script src="assets/js/html5shiv.js"></script>
|
|
|
24
|
+ <![endif]-->
|
|
|
25
|
+
|
|
|
26
|
+ <!-- Fav and touch icons -->
|
|
|
27
|
+ <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
|
|
|
28
|
+ <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
|
|
|
29
|
+ <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
|
|
|
30
|
+ <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">
|
|
|
31
|
+ <link rel="shortcut icon" href="assets/ico/favicon.png">
|
|
|
32
|
+ </head>
|
|
|
33
|
+
|
|
|
34
|
+ <body>
|
|
|
35
|
+
|
|
|
36
|
+ <div class="navbar navbar-inverse navbar-fixed-top">
|
|
|
37
|
+ <div class="navbar-inner">
|
|
|
38
|
+ <div class="container">
|
|
|
39
|
+ <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
|
|
40
|
+ <span class="icon-bar"></span>
|
|
|
41
|
+ <span class="icon-bar"></span>
|
|
|
42
|
+ <span class="icon-bar"></span>
|
|
|
43
|
+ </button>
|
|
|
44
|
+ <a class="brand" href="#">SpringSource</a>
|
|
|
45
|
+ <div class="nav-collapse collapse">
|
|
|
46
|
+ <ul class="nav">
|
|
|
47
|
+ <li class="active"><a href="#">Spring Social</a></li>
|
|
|
48
|
+ <li class="dropdown">
|
|
|
49
|
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Learn <b class="caret"></b></a>
|
|
|
50
|
+ <ul class="dropdown-menu">
|
|
|
51
|
+ <li><a href="#">Reference Docs</a></li>
|
|
|
52
|
+ <li><a href="#">API Docs</a></li>
|
|
|
53
|
+ <li><a href="#">Tutorials</a></li>
|
|
|
54
|
+ <li class="nav-header">Videos</li>
|
|
|
55
|
+ </ul>
|
|
|
56
|
+ </li>
|
|
|
57
|
+ <li class="dropdown">
|
|
|
58
|
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Develop <b class="caret"></b></a>
|
|
|
59
|
+ <ul class="dropdown-menu">
|
|
|
60
|
+ <li><a href="#">Catalyst</a></li>
|
|
|
61
|
+ <li><a href="#">Samples</a></li>
|
|
|
62
|
+ <li><a href="#">GitHub Project</a></li>
|
|
|
63
|
+ </ul>
|
|
|
64
|
+ </li>
|
|
|
65
|
+ <li class="dropdown">
|
|
|
66
|
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Community <b class="caret"></b></a>
|
|
|
67
|
+ <ul class="dropdown-menu">
|
|
|
68
|
+ <li><a href="#">StackOverflow</a></li>
|
|
|
69
|
+ <li><a href="#">Community Extensions</a></li>
|
|
|
70
|
+ </ul>
|
|
|
71
|
+ </li>
|
|
|
72
|
+ </ul>
|
|
|
73
|
+ </div><!--/.nav-collapse -->
|
|
|
74
|
+ </div>
|
|
|
75
|
+ </div>
|
|
|
76
|
+ </div>
|
|
|
77
|
+
|
|
|
78
|
+ <div class="container">
|
|
|
79
|
+
|
|
|
80
|
+ <!-- Main hero unit for a primary marketing message or call to action -->
|
|
|
81
|
+ <div class="hero-unit">
|
|
|
82
|
+ <img src="assets/img/Untitled.png" style="float:left;margin-right: 50px;">
|
|
|
83
|
+ <h1>Spring Social</h1>
|
|
|
84
|
+ <p>Easily connect your applications with third-party APIs such as Facebook, Twitter, LinkedIn, and more.</p>
|
|
|
85
|
+ <p><a href="#" class="btn btn-primary btn-large">Learn more »</a></p>
|
|
|
86
|
+ </div>
|
|
|
87
|
+
|
|
|
88
|
+ <!-- Example row of columns -->
|
|
|
89
|
+ <div class="row">
|
|
|
90
|
+ <div class="span4">
|
|
|
91
|
+ <h2>Why Spring Social?</h2>
|
|
|
92
|
+ <p>
|
|
|
93
|
+ Modern applications must be able to readily connect to one or more third party APIs.
|
|
|
94
|
+ But the security requirements around these APIs (usually OAuth) can be daunting.
|
|
|
95
|
+ Spring Social reduces API connectivity to little more than a configuration exercise, leaving your application to merely use the APIs.
|
|
|
96
|
+ </p>
|
|
|
97
|
+ </div>
|
|
|
98
|
+ <div class="span4">
|
|
|
99
|
+ <h2>Alternatives</h2>
|
|
|
100
|
+ <p>Although there are many OAuth client libraries available, most of them focus on the backend exchange for tokens, leaving it to you to handle the front-end redirects and callbacks. Only Spring Social handles the entire OAuth "dance", including browser-level redirects, requiring little or no OAuth expertise.</p>
|
|
|
101
|
+ </div>
|
|
|
102
|
+ <div class="span4">
|
|
|
103
|
+ <h2>Extensibility</h2>
|
|
|
104
|
+ <p>Spring Social was designed with extensibility in mind. Although the core project only supports a handful of API providers, Spring Social's extensibility has led to dozens of community extensions. And there's always room for more.</p>
|
|
|
105
|
+ </div>
|
|
|
106
|
+ </div>
|
|
|
107
|
+
|
|
|
108
|
+ <br><br>
|
|
|
109
|
+
|
|
|
110
|
+ <div class="row">
|
|
|
111
|
+ <div class="span12">
|
|
|
112
|
+ <h2>Configuring Spring for API Connectivity</h2>
|
|
|
113
|
+ </div>
|
|
|
114
|
+ </div>
|
|
|
115
|
+ <div class="row">
|
|
|
116
|
+ <div class="span4">
|
|
|
117
|
+ <p>Spring Social configuration includes enabling support for one or more API providers (<code>EnableFacebook</code> in this configuration), a connection repository (seen here as <code>@EnableJdbcConnectionRepository</code>) for storing connections made on behalf of a user, and a <code>ConnectController</code> whose job is to establish those connections.</p>
|
|
|
118
|
+ </div>
|
|
|
119
|
+ <div class="span8">
|
|
|
120
|
+ <p>
|
|
|
121
|
+ <pre class="pre-scrollable"><small>@Configuration
|
|
|
122
|
+@EnableFacebook(appId="${facebook.clientId}",
|
|
|
123
|
+ appSecret="${facebook.clientSecret}")
|
|
|
124
|
+@EnableJdbcConnectionRepository
|
|
|
125
|
+public class SocialConfig {
|
|
|
126
|
+
|
|
|
127
|
+ @Bean
|
|
|
128
|
+ public ConnectController connectController(
|
|
|
129
|
+ ConnectionFactoryLocator connFactoryLocator,
|
|
|
130
|
+ ConnectionRepository connectionRepo) {
|
|
|
131
|
+ return new ConnectController(connFactoryLocator, connectionRepo);
|
|
|
132
|
+ }
|
|
|
133
|
+
|
|
|
134
|
+}</small></pre>
|
|
|
135
|
+ </p>
|
|
|
136
|
+ </div>
|
|
|
137
|
+
|
|
|
138
|
+ </div>
|
|
|
139
|
+
|
|
|
140
|
+ <br><br>
|
|
|
141
|
+ <div class="row">
|
|
|
142
|
+ <div class="span12">
|
|
|
143
|
+ <h2>Using API Bindings</h2>
|
|
|
144
|
+ </div>
|
|
|
145
|
+ </div>
|
|
|
146
|
+ <div class="row">
|
|
|
147
|
+ <div class="span4">
|
|
|
148
|
+ <p>Spring Social offers Java bindings against all of the API providers it supports.
|
|
|
149
|
+ To use these API bindings, you simply inject them where they're needed.</p>
|
|
|
150
|
+ <p>Note that since the API bindings are acting on behalf of a user, they are
|
|
|
151
|
+ request-scoped and therefore many operations can only be performed within the scope of a request.</p>
|
|
|
152
|
+ </div>
|
|
|
153
|
+ <div class="span8">
|
|
|
154
|
+ <p>
|
|
|
155
|
+ <pre class="pre-scrollable"><small>@Controller
|
|
|
156
|
+public class FacebookFriendsController {
|
|
|
157
|
+
|
|
|
158
|
+ private final Facebook facebook;
|
|
|
159
|
+
|
|
|
160
|
+ @Inject
|
|
|
161
|
+ public FacebookFriendsController(Facebook facebook) {
|
|
|
162
|
+ this.facebook = facebook;
|
|
|
163
|
+ }
|
|
|
164
|
+
|
|
|
165
|
+ @RequestMapping(value="/facebook/friends", method=RequestMethod.GET)
|
|
|
166
|
+ public String showFeed(Model model) {
|
|
|
167
|
+ model.addAttribute("friends",
|
|
|
168
|
+ facebook.friendOperations().getFriendProfiles());
|
|
|
169
|
+ return "facebook/friends";
|
|
|
170
|
+ }
|
|
|
171
|
+
|
|
|
172
|
+}</small></pre>
|
|
|
173
|
+ </p>
|
|
|
174
|
+ </div>
|
|
|
175
|
+ </div>
|
|
|
176
|
+
|
|
|
177
|
+ <br><br>
|
|
|
178
|
+ <div class="row">
|
|
|
179
|
+ <div class="span12">
|
|
|
180
|
+ <h2>Extending Spring Social</h2>
|
|
|
181
|
+ </div>
|
|
|
182
|
+ </div>
|
|
|
183
|
+ <div class="row">
|
|
|
184
|
+ <div class="span4">
|
|
|
185
|
+ <p>Spring Social was designed with extensibility in mind. Although the core project only supports a handful of API providers, Spring Social's extensibility has led to dozens of community extensions. And there's always room for more.</p>
|
|
|
186
|
+ <p>[EDITOR NOTE: Here I'd like to use a tabbed panel for code to show the connection factory, service, provider, and API adapter.]</p>
|
|
|
187
|
+ </div>
|
|
|
188
|
+ <div class="span8">
|
|
|
189
|
+ <p>
|
|
|
190
|
+ <pre class="pre-scrollable"><small>public class NetFlixConnectionFactory
|
|
|
191
|
+ extends OAuth1ConnectionFactory<NetFlixApi>{
|
|
|
192
|
+
|
|
|
193
|
+ public NetFlixConnectionFactory(String clientKey, String clientSecret) {
|
|
|
194
|
+ super("netflix",
|
|
|
195
|
+ new NetFlixServiceProvider(clientKey, clientSecret),
|
|
|
196
|
+ new NetFlixApiAdapter());
|
|
|
197
|
+ }
|
|
|
198
|
+
|
|
|
199
|
+}</small></pre>
|
|
|
200
|
+ </p>
|
|
|
201
|
+ </div>
|
|
|
202
|
+ </div>
|
|
|
203
|
+
|
|
|
204
|
+ <hr>
|
|
|
205
|
+ <footer>
|
|
|
206
|
+ <p>© SpringSource 2013</p>
|
|
|
207
|
+ </footer>
|
|
|
208
|
+
|
|
|
209
|
+ </div> <!-- /container -->
|
|
|
210
|
+
|
|
|
211
|
+ <!-- Le javascript
|
|
|
212
|
+ ================================================== -->
|
|
|
213
|
+ <!-- Placed at the end of the document so the pages load faster -->
|
|
|
214
|
+ <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
|
|
|
215
|
+ <script src="assets/js/bootstrap.js"></script>
|
|
|
216
|
+
|
|
|
217
|
+ </body>
|
|
|
218
|
+</html>
|