public class JdbcUsersConnectionRepository extends Object implements UsersConnectionRepository
UsersConnectionRepository
that uses the JDBC API to persist connection data to a relational database.
The supporting schema is defined in JdbcUsersConnectionRepository.sql.Constructor and Description |
---|
JdbcUsersConnectionRepository(DataSource dataSource,
ConnectionFactoryLocator connectionFactoryLocator,
org.springframework.security.crypto.encrypt.TextEncryptor textEncryptor) |
Modifier and Type | Method and Description |
---|---|
ConnectionRepository |
createConnectionRepository(String userId)
Create a single-user
ConnectionRepository instance for the user assigned the given id. |
Set<String> |
findUserIdsConnectedTo(String providerId,
Set<String> providerUserIds)
Find the ids of the users who are connected to the specific provider user accounts.
|
List<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.
|
void |
setTablePrefix(String tablePrefix)
Sets a table name prefix.
|
public JdbcUsersConnectionRepository(DataSource dataSource, ConnectionFactoryLocator connectionFactoryLocator, org.springframework.security.crypto.encrypt.TextEncryptor textEncryptor)
public void setConnectionSignUp(ConnectionSignUp connectionSignUp)
connectionSignUp
- a ConnectionSignUp
objectfindUserIdsWithConnection(Connection)
public void setTablePrefix(String tablePrefix)
tablePrefix
- the tablePrefix to setpublic List<String> findUserIdsWithConnection(Connection<?> connection)
UsersConnectionRepository
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.findUserIdsWithConnection
in interface UsersConnectionRepository
connection
- the service provider connection resulting from the provider sign-in attemptpublic Set<String> findUserIdsConnectedTo(String providerId, Set<String> providerUserIds)
UsersConnectionRepository
findUserIdsConnectedTo
in interface UsersConnectionRepository
providerId
- the provider id, e.g. "facebook"providerUserIds
- the set of provider user ids e.g. ("125600", "131345", "54321").public ConnectionRepository createConnectionRepository(String userId)
UsersConnectionRepository
ConnectionRepository
instance for the user assigned the given id.
All operations on the returned repository instance are relative to the user.createConnectionRepository
in interface UsersConnectionRepository
userId
- the id of the local user account.