Class JdbcOAuth2AuthorizationService
java.lang.Object
org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationService
- All Implemented Interfaces:
OAuth2AuthorizationService
@ImportRuntimeHints(org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationService.JdbcOAuth2AuthorizationServiceRuntimeHintsRegistrar.class)
public class JdbcOAuth2AuthorizationService
extends Object
implements OAuth2AuthorizationService
A JDBC implementation of an
OAuth2AuthorizationService that uses a
JdbcOperations for OAuth2Authorization persistence.
IMPORTANT: This OAuth2AuthorizationService depends on the table
definition described in
"classpath:org/springframework/security/oauth2/server/authorization/oauth2-authorization-schema.sql"
and therefore MUST be defined in the database schema.
NOTE: This OAuth2AuthorizationService 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 OAuth2AuthorizationService that meets the performance
requirements for its deployment environment.
- Since:
- 0.1.2
- See Also:
-
OAuth2AuthorizationServiceOAuth2AuthorizationJdbcOperationsRowMapper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
ConstructorsConstructorDescriptionJdbcOAuth2AuthorizationService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository) Constructs aJdbcOAuth2AuthorizationServiceusing the provided parameters.JdbcOAuth2AuthorizationService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository, org.springframework.jdbc.support.lob.LobHandler lobHandler) Constructs aJdbcOAuth2AuthorizationServiceusing the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionfindByToken(String token, OAuth2TokenType tokenType) protected final Function<OAuth2Authorization,List<org.springframework.jdbc.core.SqlParameterValue>> protected final org.springframework.jdbc.core.RowMapper<OAuth2Authorization>protected final org.springframework.jdbc.core.JdbcOperationsprotected final org.springframework.jdbc.support.lob.LobHandlervoidremove(OAuth2Authorization authorization) Removes theOAuth2Authorization.voidsave(OAuth2Authorization authorization) Saves theOAuth2Authorization.final voidsetAuthorizationParametersMapper(Function<OAuth2Authorization, List<org.springframework.jdbc.core.SqlParameterValue>> authorizationParametersMapper) final voidsetAuthorizationRowMapper(org.springframework.jdbc.core.RowMapper<OAuth2Authorization> authorizationRowMapper)
-
Constructor Details
-
JdbcOAuth2AuthorizationService
public JdbcOAuth2AuthorizationService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository) Constructs aJdbcOAuth2AuthorizationServiceusing the provided parameters.- Parameters:
jdbcOperations- the JDBC operationsregisteredClientRepository- the registered client repository
-
JdbcOAuth2AuthorizationService
public JdbcOAuth2AuthorizationService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository, org.springframework.jdbc.support.lob.LobHandler lobHandler) Constructs aJdbcOAuth2AuthorizationServiceusing the provided parameters.- Parameters:
jdbcOperations- the JDBC operationsregisteredClientRepository- the registered client repositorylobHandler- the handler for large binary fields and large text fields
-
-
Method Details
-
save
Description copied from interface:OAuth2AuthorizationServiceSaves theOAuth2Authorization.- Specified by:
savein interfaceOAuth2AuthorizationService- Parameters:
authorization- theOAuth2Authorization
-
remove
Description copied from interface:OAuth2AuthorizationServiceRemoves theOAuth2Authorization.- Specified by:
removein interfaceOAuth2AuthorizationService- Parameters:
authorization- theOAuth2Authorization
-
findById
Description copied from interface:OAuth2AuthorizationService- Specified by:
findByIdin interfaceOAuth2AuthorizationService- Parameters:
id- the authorization identifier- Returns:
- the
OAuth2Authorizationif found, otherwisenull
-
findByToken
Description copied from interface:OAuth2AuthorizationService- Specified by:
findByTokenin interfaceOAuth2AuthorizationService- Parameters:
token- the token credentialtokenType- thetoken type- Returns:
- the
OAuth2Authorizationif found, otherwisenull
-
setAuthorizationRowMapper
public final void setAuthorizationRowMapper(org.springframework.jdbc.core.RowMapper<OAuth2Authorization> authorizationRowMapper) Sets theRowMapperused for mapping the current row injava.sql.ResultSettoOAuth2Authorization. The default isJdbcOAuth2AuthorizationService.OAuth2AuthorizationRowMapper.- Parameters:
authorizationRowMapper- theRowMapperused for mapping the current row inResultSettoOAuth2Authorization
-
setAuthorizationParametersMapper
public final void setAuthorizationParametersMapper(Function<OAuth2Authorization, List<org.springframework.jdbc.core.SqlParameterValue>> authorizationParametersMapper) Sets theFunctionused for mappingOAuth2Authorizationto aListofSqlParameterValue. The default isJdbcOAuth2AuthorizationService.OAuth2AuthorizationParametersMapper.- Parameters:
authorizationParametersMapper- theFunctionused for mappingOAuth2Authorizationto aListofSqlParameterValue
-
getJdbcOperations
protected final org.springframework.jdbc.core.JdbcOperations getJdbcOperations() -
getLobHandler
protected final org.springframework.jdbc.support.lob.LobHandler getLobHandler() -
getAuthorizationRowMapper
protected final org.springframework.jdbc.core.RowMapper<OAuth2Authorization> getAuthorizationRowMapper() -
getAuthorizationParametersMapper
protected final Function<OAuth2Authorization,List<org.springframework.jdbc.core.SqlParameterValue>> getAuthorizationParametersMapper()
-