Class JdbcOAuth2AuthorizationService
java.lang.Object
org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationService
- All Implemented Interfaces:
OAuth2AuthorizationService
A JDBC implementation of an
OAuth2AuthorizationService
that uses a
JdbcOperations
for OAuth2Authorization
persistence.
NOTE: 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.
- Since:
- 0.1.2
- See Also:
-
OAuth2AuthorizationService
OAuth2Authorization
JdbcOperations
RowMapper
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
ConstructorDescriptionJdbcOAuth2AuthorizationService
(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository) Constructs aJdbcOAuth2AuthorizationService
using the provided parameters.JdbcOAuth2AuthorizationService
(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository, org.springframework.jdbc.support.lob.LobHandler lobHandler) Constructs aJdbcOAuth2AuthorizationService
using 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.JdbcOperations
protected final org.springframework.jdbc.support.lob.LobHandler
void
remove
(OAuth2Authorization authorization) Removes theOAuth2Authorization
.void
save
(OAuth2Authorization authorization) Saves theOAuth2Authorization
.final void
setAuthorizationParametersMapper
(Function<OAuth2Authorization, List<org.springframework.jdbc.core.SqlParameterValue>> authorizationParametersMapper) final void
setAuthorizationRowMapper
(org.springframework.jdbc.core.RowMapper<OAuth2Authorization> authorizationRowMapper)
-
Constructor Details
-
JdbcOAuth2AuthorizationService
public JdbcOAuth2AuthorizationService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository) Constructs aJdbcOAuth2AuthorizationService
using 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 aJdbcOAuth2AuthorizationService
using 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:OAuth2AuthorizationService
Saves theOAuth2Authorization
.- Specified by:
save
in interfaceOAuth2AuthorizationService
- Parameters:
authorization
- theOAuth2Authorization
-
remove
Description copied from interface:OAuth2AuthorizationService
Removes theOAuth2Authorization
.- Specified by:
remove
in interfaceOAuth2AuthorizationService
- Parameters:
authorization
- theOAuth2Authorization
-
findById
Description copied from interface:OAuth2AuthorizationService
- Specified by:
findById
in interfaceOAuth2AuthorizationService
- Parameters:
id
- the authorization identifier- Returns:
- the
OAuth2Authorization
if found, otherwisenull
-
findByToken
Description copied from interface:OAuth2AuthorizationService
- Specified by:
findByToken
in interfaceOAuth2AuthorizationService
- Parameters:
token
- the token credentialtokenType
- thetoken type
- Returns:
- the
OAuth2Authorization
if found, otherwisenull
-
setAuthorizationRowMapper
public final void setAuthorizationRowMapper(org.springframework.jdbc.core.RowMapper<OAuth2Authorization> authorizationRowMapper) Sets theRowMapper
used for mapping the current row injava.sql.ResultSet
toOAuth2Authorization
. The default isJdbcOAuth2AuthorizationService.OAuth2AuthorizationRowMapper
.- Parameters:
authorizationRowMapper
- theRowMapper
used for mapping the current row inResultSet
toOAuth2Authorization
-
setAuthorizationParametersMapper
public final void setAuthorizationParametersMapper(Function<OAuth2Authorization, List<org.springframework.jdbc.core.SqlParameterValue>> authorizationParametersMapper) Sets theFunction
used for mappingOAuth2Authorization
to aList
ofSqlParameterValue
. The default isJdbcOAuth2AuthorizationService.OAuth2AuthorizationParametersMapper
.- Parameters:
authorizationParametersMapper
- theFunction
used for mappingOAuth2Authorization
to aList
ofSqlParameterValue
-
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()
-