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:
-
RegisteredClientRepositoryRegisteredClientJdbcOperationsRowMapper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
ConstructorsConstructorDescriptionJdbcRegisteredClientRepository(org.springframework.jdbc.core.JdbcOperations jdbcOperations) Constructs aJdbcRegisteredClientRepositoryusing the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionfindByClientId(String clientId) Returns the registered client identified by the providedclientId, ornullif not found.Returns the registered client identified by the providedid, ornullif not found.protected final org.springframework.jdbc.core.JdbcOperationsprotected final Function<RegisteredClient,List<org.springframework.jdbc.core.SqlParameterValue>> protected final org.springframework.jdbc.core.RowMapper<RegisteredClient>voidsave(RegisteredClient registeredClient) Saves the registered client.final voidsetRegisteredClientParametersMapper(Function<RegisteredClient, List<org.springframework.jdbc.core.SqlParameterValue>> registeredClientParametersMapper) final voidsetRegisteredClientRowMapper(org.springframework.jdbc.core.RowMapper<RegisteredClient> registeredClientRowMapper)
-
Constructor Details
-
JdbcRegisteredClientRepository
public JdbcRegisteredClientRepository(org.springframework.jdbc.core.JdbcOperations jdbcOperations) Constructs aJdbcRegisteredClientRepositoryusing the provided parameters.- Parameters:
jdbcOperations- the JDBC operations
-
-
Method Details
-
save
Description copied from interface:RegisteredClientRepositorySaves the registered client.IMPORTANT: Sensitive information should be encoded externally from the implementation, e.g.
RegisteredClient.getClientSecret()- Specified by:
savein interfaceRegisteredClientRepository- Parameters:
registeredClient- theRegisteredClient
-
findById
Description copied from interface:RegisteredClientRepositoryReturns the registered client identified by the providedid, ornullif not found.- Specified by:
findByIdin interfaceRegisteredClientRepository- Parameters:
id- the registration identifier- Returns:
- the
RegisteredClientif found, otherwisenull
-
findByClientId
Description copied from interface:RegisteredClientRepositoryReturns the registered client identified by the providedclientId, ornullif not found.- Specified by:
findByClientIdin interfaceRegisteredClientRepository- Parameters:
clientId- the client identifier- Returns:
- the
RegisteredClientif found, otherwisenull
-
setRegisteredClientRowMapper
public final void setRegisteredClientRowMapper(org.springframework.jdbc.core.RowMapper<RegisteredClient> registeredClientRowMapper) Sets theRowMapperused for mapping the current row injava.sql.ResultSettoRegisteredClient. The default isJdbcRegisteredClientRepository.RegisteredClientRowMapper.- Parameters:
registeredClientRowMapper- theRowMapperused for mapping the current row inResultSettoRegisteredClient
-
setRegisteredClientParametersMapper
public final void setRegisteredClientParametersMapper(Function<RegisteredClient, List<org.springframework.jdbc.core.SqlParameterValue>> registeredClientParametersMapper) Sets theFunctionused for mappingRegisteredClientto aListofSqlParameterValue. The default isJdbcRegisteredClientRepository.RegisteredClientParametersMapper.- Parameters:
registeredClientParametersMapper- theFunctionused for mappingRegisteredClientto aListofSqlParameterValue
-
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()
-