Class JdbcOAuth2AuthorizedClientService
java.lang.Object
org.springframework.security.oauth2.client.JdbcOAuth2AuthorizedClientService
- All Implemented Interfaces:
- OAuth2AuthorizedClientService
public class JdbcOAuth2AuthorizedClientService
extends Object
implements OAuth2AuthorizedClientService
A JDBC implementation of an 
OAuth2AuthorizedClientService that uses a
 JdbcOperations for OAuth2AuthorizedClient persistence.
 
 NOTE: This OAuth2AuthorizedClientService depends on the table definition
 described in
 "classpath:org/springframework/security/oauth2/client/oauth2-client-schema.sql" and
 therefore MUST be defined in the database schema.
- Since:
- 5.3
- See Also:
- 
- OAuth2AuthorizedClientService
- OAuth2AuthorizedClient
- JdbcOperations
- RowMapper
 
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classA holder for anOAuth2AuthorizedClientand End-UserAuthentication(Resource Owner).static classThe defaultFunctionthat mapsJdbcOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderto aListofSqlParameterValue.static class
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Function<JdbcOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,List<org.springframework.jdbc.core.SqlParameterValue>> protected org.springframework.jdbc.core.RowMapper<OAuth2AuthorizedClient>protected final org.springframework.jdbc.core.JdbcOperationsprotected final org.springframework.jdbc.support.lob.LobHandler
- 
Constructor SummaryConstructorsConstructorDescriptionJdbcOAuth2AuthorizedClientService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, ClientRegistrationRepository clientRegistrationRepository) Constructs aJdbcOAuth2AuthorizedClientServiceusing the provided parameters.JdbcOAuth2AuthorizedClientService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, ClientRegistrationRepository clientRegistrationRepository, org.springframework.jdbc.support.lob.LobHandler lobHandler) Constructs aJdbcOAuth2AuthorizedClientServiceusing the provided parameters.
- 
Method SummaryModifier and TypeMethodDescription<T extends OAuth2AuthorizedClient>
 TloadAuthorizedClient(String clientRegistrationId, String principalName) Returns theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname ornullif not available.voidremoveAuthorizedClient(String clientRegistrationId, String principalName) Removes theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname.voidsaveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, Authentication principal) Saves theOAuth2AuthorizedClientassociating it to the provided End-UserAuthentication(Resource Owner).final voidsetAuthorizedClientParametersMapper(Function<JdbcOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder, List<org.springframework.jdbc.core.SqlParameterValue>> authorizedClientParametersMapper) Sets theFunctionused for mappingJdbcOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderto aListofSqlParameterValue.final voidsetAuthorizedClientRowMapper(org.springframework.jdbc.core.RowMapper<OAuth2AuthorizedClient> authorizedClientRowMapper) Sets theRowMapperused for mapping the current row injava.sql.ResultSettoOAuth2AuthorizedClient.
- 
Field Details- 
jdbcOperationsprotected final org.springframework.jdbc.core.JdbcOperations jdbcOperations
- 
authorizedClientRowMapper
- 
authorizedClientParametersMapperprotected Function<JdbcOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,List<org.springframework.jdbc.core.SqlParameterValue>> authorizedClientParametersMapper
- 
lobHandlerprotected final org.springframework.jdbc.support.lob.LobHandler lobHandler
 
- 
- 
Constructor Details- 
JdbcOAuth2AuthorizedClientServicepublic JdbcOAuth2AuthorizedClientService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, ClientRegistrationRepository clientRegistrationRepository) Constructs aJdbcOAuth2AuthorizedClientServiceusing the provided parameters.- Parameters:
- jdbcOperations- the JDBC operations
- clientRegistrationRepository- the repository of client registrations
 
- 
JdbcOAuth2AuthorizedClientServicepublic JdbcOAuth2AuthorizedClientService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, ClientRegistrationRepository clientRegistrationRepository, org.springframework.jdbc.support.lob.LobHandler lobHandler) Constructs aJdbcOAuth2AuthorizedClientServiceusing the provided parameters.- Parameters:
- jdbcOperations- the JDBC operations
- clientRegistrationRepository- the repository of client registrations
- lobHandler- the handler for large binary fields and large text fields
- Since:
- 5.5
 
 
- 
- 
Method Details- 
loadAuthorizedClientpublic <T extends OAuth2AuthorizedClient> T loadAuthorizedClient(String clientRegistrationId, String principalName) Description copied from interface:OAuth2AuthorizedClientServiceReturns theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname ornullif not available.- Specified by:
- loadAuthorizedClientin interface- OAuth2AuthorizedClientService
- Type Parameters:
- T- a type of OAuth2AuthorizedClient
- Parameters:
- clientRegistrationId- the identifier for the client's registration
- principalName- the name of the End-User- Principal(Resource Owner)
- Returns:
- the OAuth2AuthorizedClientornullif not available
 
- 
saveAuthorizedClientDescription copied from interface:OAuth2AuthorizedClientServiceSaves theOAuth2AuthorizedClientassociating it to the provided End-UserAuthentication(Resource Owner).- Specified by:
- saveAuthorizedClientin interface- OAuth2AuthorizedClientService
- Parameters:
- authorizedClient- the authorized client
- principal- the End-User- Authentication(Resource Owner)
 
- 
removeAuthorizedClientDescription copied from interface:OAuth2AuthorizedClientServiceRemoves theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname.- Specified by:
- removeAuthorizedClientin interface- OAuth2AuthorizedClientService
- Parameters:
- clientRegistrationId- the identifier for the client's registration
- principalName- the name of the End-User- Principal(Resource Owner)
 
- 
setAuthorizedClientRowMapperpublic final void setAuthorizedClientRowMapper(org.springframework.jdbc.core.RowMapper<OAuth2AuthorizedClient> authorizedClientRowMapper) Sets theRowMapperused for mapping the current row injava.sql.ResultSettoOAuth2AuthorizedClient. The default isJdbcOAuth2AuthorizedClientService.OAuth2AuthorizedClientRowMapper.- Parameters:
- authorizedClientRowMapper- the- RowMapperused for mapping the current row in- java.sql.ResultSetto- OAuth2AuthorizedClient
 
- 
setAuthorizedClientParametersMapperpublic final void setAuthorizedClientParametersMapper(Function<JdbcOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder, List<org.springframework.jdbc.core.SqlParameterValue>> authorizedClientParametersMapper) Sets theFunctionused for mappingJdbcOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderto aListofSqlParameterValue. The default isJdbcOAuth2AuthorizedClientService.OAuth2AuthorizedClientParametersMapper.- Parameters:
- authorizedClientParametersMapper- the- Functionused for mapping- JdbcOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderto a- Listof- SqlParameterValue
 
 
-