org.springframework.social.connect.jdbc
Class JdbcUsersConnectionRepository

java.lang.Object
  extended by org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository
All Implemented Interfaces:
UsersConnectionRepository

public class JdbcUsersConnectionRepository
extends java.lang.Object
implements UsersConnectionRepository

UsersConnectionRepository that uses the JDBC API to persist connection data to a relational database. The supporting schema is defined in JdbcMultiUserConnectionRepository.sql.


Constructor Summary
JdbcUsersConnectionRepository(javax.sql.DataSource dataSource, ConnectionFactoryLocator connectionFactoryLocator, org.springframework.security.crypto.encrypt.TextEncryptor textEncryptor)
           
 
Method Summary
 ConnectionRepository createConnectionRepository(java.lang.String userId)
          Create a single-user ConnectionRepository instance for the user assigned the given id.
 java.util.Set<java.lang.String> findUserIdsConnectedTo(java.lang.String providerId, java.util.Set<java.lang.String> providerUserIds)
          Find the ids of the users who are connected to the specific provider user accounts.
 java.lang.String findUserIdWithConnection(Connection<?> connection)
          Find the id of the single user that has the given Connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcUsersConnectionRepository

public JdbcUsersConnectionRepository(javax.sql.DataSource dataSource,
                                     ConnectionFactoryLocator connectionFactoryLocator,
                                     org.springframework.security.crypto.encrypt.TextEncryptor textEncryptor)
Method Detail

findUserIdWithConnection

public java.lang.String findUserIdWithConnection(Connection<?> connection)
Description copied from interface: UsersConnectionRepository
Find the id of the single user that has the given Connection. Used to support the ProviderSignIn scenario where the user id returned is used to sign a local application user in using his or her provider account. Returns null if there is not exactly one local user connected to the provider user. May never return null if this method implicitly creates a user account from the connection if no such user account already exists.

Specified by:
findUserIdWithConnection in interface UsersConnectionRepository
Parameters:
connection - the service provider connection resulting from the provider sign-in attempt

findUserIdsConnectedTo

public java.util.Set<java.lang.String> findUserIdsConnectedTo(java.lang.String providerId,
                                                              java.util.Set<java.lang.String> providerUserIds)
Description copied from interface: UsersConnectionRepository
Find the ids of the users who are connected to the specific provider user accounts.

Specified by:
findUserIdsConnectedTo in interface UsersConnectionRepository
Parameters:
providerId - the provider id, e.g. "facebook"
providerUserIds - the set of provider user ids e.g. ("125600", "131345", "54321").
Returns:
the set of user ids connected to those service provider users, or empty if none.

createConnectionRepository

public ConnectionRepository createConnectionRepository(java.lang.String userId)
Description copied from interface: UsersConnectionRepository
Create a single-user ConnectionRepository instance for the user assigned the given id. All operations on the returned repository instance are relative to the user.

Specified by:
createConnectionRepository in interface UsersConnectionRepository
Parameters:
userId - the id of the local user account.
Returns:
the ConnectionRepository, exposing a number of operations for accessing and updating the given user's provider connections.