Skip to content

Commit

Permalink
Reference doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
habuma committed Aug 22, 2011
1 parent bd0a3d2 commit cf7e538
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
11 changes: 7 additions & 4 deletions docs/src/reference/docbook/connecting.xml
Expand Up @@ -540,25 +540,28 @@ public class SocialConfig {
<programlisting language="java"><![CDATA[
public interface ConnectInterceptor<A> {
void preConnect(ConnectionFactory<A> connectionFactory, WebRequest request);
MultiValueMap<String, String> preConnect(ConnectionFactory<A> connectionFactory, WebRequest request);
void postConnect(Connection<A> connection, WebRequest request);
}]]>
</programlisting>
<para>
The <methodname>preConnect()</methodname> method will be called by <classname>ConnectController</classname> just before redirecting the browser to the provider's authorization page.
The <methodname>preConnect()</methodname> method will be called by <classname>ConnectController</classname> just before redirecting the browser to the provider's authorization page.
It has a return type of <code>MultiValueMap&lt;String, String&gt;</code> which can contain parameters to be passed on the request when <classname>ConnectController</classname> redirects to the provider's authorization URL.
If it has no parameters to contribute to the authorization URL, it may return <code>null</code>.
<methodname>postConnect()</methodname> will be called immediately after a connection has been persisted linking the user's local account with the provider profile.
</para>
<para>
For example, suppose that after connecting a user account with their Twitter profile , you want to immediately post a tweet about that connection to the user's Twitter timeline.
For example, suppose that after connecting a user account with their Twitter profile you want to immediately post a tweet about that connection to the user's Twitter timeline.
To accomplish that, you might write the following connection interceptor:
</para>
<programlisting language="java"><![CDATA[
public class TweetAfterConnectInterceptor implements ConnectInterceptor<Twitter> {
public void preConnect(ConnectionFactory<TwitterApi> provider, WebRequest request) {
public MultiValueMap<String, String> preConnect(ConnectionFactory<TwitterApi> provider, WebRequest request) {
// nothing to do
return null;
}
public void postConnect(Connection<TwitterApi> connection, WebRequest request) {
Expand Down
2 changes: 2 additions & 0 deletions docs/src/reference/docbook/overview.xml
Expand Up @@ -326,9 +326,11 @@ git clone git://github.com/SpringSource/spring-social-samples.git

<itemizedlist>
<listitem><para>spring-social-quickstart - Designed to get you up and running quickly.</para></listitem>
<listitem><para>spring-social-quickstart-30x - Designed to get you up and running quickly as well as using Spring Social with Spring 3.0.x.</para></listitem>
<listitem><para>spring-social-showcase - Illustrates most of Spring Social's features.</para></listitem>
<listitem><para>spring-social-movies - Shows how to extend Spring Social to implement a new ServiceProvider and API binding.</para></listitem>
<listitem><para>spring-social-twitter4j - Shows how to extend Spring Social and re-use an existing API binding.</para></listitem>
<listitem><para>spring-social-popup - Shows how to use Spring Social to drive a browser popup-based connection flow.</para></listitem>
</itemizedlist>
</section>
</chapter>
26 changes: 25 additions & 1 deletion docs/src/reference/docbook/serviceprovider.xml
Expand Up @@ -464,9 +464,33 @@ public interface UsersConnectionRepository {
<title>JDBC-based persistence</title>
<para>
Spring Social provides a JdbcUsersConnectionRepository implementation capable of persisting connections to a RDBMS.
The database schema designed to back this repository is defined in JdbcUsersConnectionRepository.sql.
The database schema designed to back this repository is defined as follows:
</para>

<programlisting language="sql"><![CDATA[
create table UserConnection (userId varchar(255) not null,
providerId varchar(255) not null,
providerUserId varchar(255),
rank int not null,
displayName varchar(255),
profileUrl varchar(512),
imageUrl varchar(512),
accessToken varchar(255) not null,
secret varchar(255),
refreshToken varchar(255),
expireTime bigint,
primary key (userId, providerId, providerUserId));
create unique index UserConnectionRank on UserConnection(userId, providerId, rank);]]>
</programlisting>

<para>
For convenience is bootstrapping the schema from a running application, this schema definition is available in the <code>spring-social-core</code> module as a resource at the path /org/springframework/social/connect/jdbc/JdbcUsersConnectionRepository.sql.
</para>

<para>
The implementation also provides support for encrypting authorization credentials so they are not stored in plain-text.
</para>

<para>
The example code below demonstrates construction and usage of a JdbcUsersConnectionRepository:
</para>
Expand Down

0 comments on commit cf7e538

Please sign in to comment.