Class JdbcRegisteredClientRepository
- All Implemented Interfaces:
RegisteredClientRepository
RegisteredClientRepository
that uses a
JdbcOperations
for RegisteredClient
persistence.
IMPORTANT: This RegisteredClientRepository
depends on the table
definition described in
"classpath:org/springframework/security/oauth2/server/authorization/client/oauth2-registered-client-schema.sql"
and therefore MUST be defined in the database schema.
NOTE: This RegisteredClientRepository
is a simplified JDBC
implementation that MAY be used in a production environment. However, it does have
limitations as it likely won't perform well in an environment requiring high
throughput. The expectation is that the consuming application will provide their own
implementation of RegisteredClientRepository
that meets the performance
requirements for its deployment environment.
- Since:
- 0.1.2
- See Also:
-
RegisteredClientRepository
RegisteredClient
JdbcOperations
RowMapper
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
ConstructorDescriptionJdbcRegisteredClientRepository
(org.springframework.jdbc.core.JdbcOperations jdbcOperations) Constructs aJdbcRegisteredClientRepository
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionfindByClientId
(String clientId) Returns the registered client identified by the providedclientId
, ornull
if not found.Returns the registered client identified by the providedid
, ornull
if not found.protected final org.springframework.jdbc.core.JdbcOperations
protected final Function<RegisteredClient,
List<org.springframework.jdbc.core.SqlParameterValue>> protected final org.springframework.jdbc.core.RowMapper<RegisteredClient>
void
save
(RegisteredClient registeredClient) Saves the registered client.final void
setRegisteredClientParametersMapper
(Function<RegisteredClient, List<org.springframework.jdbc.core.SqlParameterValue>> registeredClientParametersMapper) final void
setRegisteredClientRowMapper
(org.springframework.jdbc.core.RowMapper<RegisteredClient> registeredClientRowMapper)
-
Constructor Details
-
JdbcRegisteredClientRepository
public JdbcRegisteredClientRepository(org.springframework.jdbc.core.JdbcOperations jdbcOperations) Constructs aJdbcRegisteredClientRepository
using the provided parameters.- Parameters:
jdbcOperations
- the JDBC operations
-
-
Method Details
-
save
Description copied from interface:RegisteredClientRepository
Saves the registered client.IMPORTANT: Sensitive information should be encoded externally from the implementation, e.g.
RegisteredClient.getClientSecret()
- Specified by:
save
in interfaceRegisteredClientRepository
- Parameters:
registeredClient
- theRegisteredClient
-
findById
Description copied from interface:RegisteredClientRepository
Returns the registered client identified by the providedid
, ornull
if not found.- Specified by:
findById
in interfaceRegisteredClientRepository
- Parameters:
id
- the registration identifier- Returns:
- the
RegisteredClient
if found, otherwisenull
-
findByClientId
Description copied from interface:RegisteredClientRepository
Returns the registered client identified by the providedclientId
, ornull
if not found.- Specified by:
findByClientId
in interfaceRegisteredClientRepository
- Parameters:
clientId
- the client identifier- Returns:
- the
RegisteredClient
if found, otherwisenull
-
setRegisteredClientRowMapper
public final void setRegisteredClientRowMapper(org.springframework.jdbc.core.RowMapper<RegisteredClient> registeredClientRowMapper) Sets theRowMapper
used for mapping the current row injava.sql.ResultSet
toRegisteredClient
. The default isJdbcRegisteredClientRepository.RegisteredClientRowMapper
.- Parameters:
registeredClientRowMapper
- theRowMapper
used for mapping the current row inResultSet
toRegisteredClient
-
setRegisteredClientParametersMapper
public final void setRegisteredClientParametersMapper(Function<RegisteredClient, List<org.springframework.jdbc.core.SqlParameterValue>> registeredClientParametersMapper) Sets theFunction
used for mappingRegisteredClient
to aList
ofSqlParameterValue
. The default isJdbcRegisteredClientRepository.RegisteredClientParametersMapper
.- Parameters:
registeredClientParametersMapper
- theFunction
used for mappingRegisteredClient
to aList
ofSqlParameterValue
-
getJdbcOperations
protected final org.springframework.jdbc.core.JdbcOperations getJdbcOperations() -
getRegisteredClientRowMapper
protected final org.springframework.jdbc.core.RowMapper<RegisteredClient> getRegisteredClientRowMapper() -
getRegisteredClientParametersMapper
protected final Function<RegisteredClient,List<org.springframework.jdbc.core.SqlParameterValue>> getRegisteredClientParametersMapper()
-