Spring Social

org.springframework.social.connect.mem
Class InMemoryUsersConnectionRepository

java.lang.Object
  extended by org.springframework.social.connect.mem.InMemoryUsersConnectionRepository
All Implemented Interfaces:
UsersConnectionRepository

public class InMemoryUsersConnectionRepository
extends java.lang.Object
implements UsersConnectionRepository

UsersConnectionRepository that stores connections in memory. Intended for testing and small-scale applications as a convenient alternative to JdbcUsersConnectionRepository and an in-memory H2 database. Not intended for production use, as it will be cleared out when the application exits.

Author:
Craig Walls

Constructor Summary
InMemoryUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator)
           
 
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.util.List<java.lang.String> findUserIdsWithConnection(Connection<?> connection)
          Find the ids for local application users that have the given Connection.
 void setConnectionSignUp(ConnectionSignUp connectionSignUp)
          The command to execute to create a new local user profile in the event no user id could be mapped to a connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryUsersConnectionRepository

public InMemoryUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator)
Method Detail

setConnectionSignUp

public void setConnectionSignUp(ConnectionSignUp connectionSignUp)
The command to execute to create a new local user profile in the event no user id could be mapped to a connection. Allows for implicitly creating a user profile from connection data during a provider sign-in attempt. Defaults to null, indicating explicit sign-up will be required to complete the provider sign-in attempt.

See Also:
findUserIdsWithConnection(Connection)

findUserIdsWithConnection

public java.util.List<java.lang.String> findUserIdsWithConnection(Connection<?> connection)
Description copied from interface: UsersConnectionRepository
Find the ids for local application users that have 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. No entries indicates no application users are associated with the connection; ProviderSignInController will offer the user a signup page to register with the app. A single entry indicates that exactly one application user is associated with the connection and is used to sign in that user via ProviderSignInController. Multiple entries indicate that multiple application users are associated with the connection and handled as an error by ProviderSignInController.

Specified by:
findUserIdsWithConnection in interface UsersConnectionRepository
Parameters:
connection - the service provider connection resulting from the provider sign-in attempt
Returns:
the user ids associated with the connection.

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.

Spring Social