Class JdbcOAuth2AuthorizationConsentService
java.lang.Object
org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationConsentService
- All Implemented Interfaces:
OAuth2AuthorizationConsentService
@ImportRuntimeHints(org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationConsentService.JdbcOAuth2AuthorizationConsentServiceRuntimeHintsRegistrar.class)
public class JdbcOAuth2AuthorizationConsentService
extends Object
implements OAuth2AuthorizationConsentService
A JDBC implementation of an
OAuth2AuthorizationConsentService
that uses a
JdbcOperations
for OAuth2AuthorizationConsent
persistence.
IMPORTANT: This OAuth2AuthorizationConsentService
depends on the table
definition described in
"classpath:org/springframework/security/oauth2/server/authorization/oauth2-authorization-consent-schema.sql"
and therefore MUST be defined in the database schema.
NOTE: This OAuth2AuthorizationConsentService
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 OAuth2AuthorizationConsentService
that meets the performance
requirements for its deployment environment.
- Since:
- 0.1.2
- See Also:
-
OAuth2AuthorizationConsentService
OAuth2AuthorizationConsent
JdbcOperations
RowMapper
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
ConstructorDescriptionJdbcOAuth2AuthorizationConsentService
(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository) Constructs aJdbcOAuth2AuthorizationConsentService
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns theOAuth2AuthorizationConsent
identified by the providedregisteredClientId
andprincipalName
, ornull
if not found.protected final Function<OAuth2AuthorizationConsent,
List<org.springframework.jdbc.core.SqlParameterValue>> protected final org.springframework.jdbc.core.RowMapper<OAuth2AuthorizationConsent>
protected final org.springframework.jdbc.core.JdbcOperations
void
remove
(OAuth2AuthorizationConsent authorizationConsent) Removes theOAuth2AuthorizationConsent
.void
save
(OAuth2AuthorizationConsent authorizationConsent) Saves theOAuth2AuthorizationConsent
.final void
setAuthorizationConsentParametersMapper
(Function<OAuth2AuthorizationConsent, List<org.springframework.jdbc.core.SqlParameterValue>> authorizationConsentParametersMapper) final void
setAuthorizationConsentRowMapper
(org.springframework.jdbc.core.RowMapper<OAuth2AuthorizationConsent> authorizationConsentRowMapper) Sets theRowMapper
used for mapping the current row injava.sql.ResultSet
toOAuth2AuthorizationConsent
.
-
Constructor Details
-
JdbcOAuth2AuthorizationConsentService
public JdbcOAuth2AuthorizationConsentService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository) Constructs aJdbcOAuth2AuthorizationConsentService
using the provided parameters.- Parameters:
jdbcOperations
- the JDBC operationsregisteredClientRepository
- the registered client repository
-
-
Method Details
-
save
Description copied from interface:OAuth2AuthorizationConsentService
Saves theOAuth2AuthorizationConsent
.- Specified by:
save
in interfaceOAuth2AuthorizationConsentService
- Parameters:
authorizationConsent
- theOAuth2AuthorizationConsent
-
remove
Description copied from interface:OAuth2AuthorizationConsentService
Removes theOAuth2AuthorizationConsent
.- Specified by:
remove
in interfaceOAuth2AuthorizationConsentService
- Parameters:
authorizationConsent
- theOAuth2AuthorizationConsent
-
findById
@Nullable public OAuth2AuthorizationConsent findById(String registeredClientId, String principalName) Description copied from interface:OAuth2AuthorizationConsentService
Returns theOAuth2AuthorizationConsent
identified by the providedregisteredClientId
andprincipalName
, ornull
if not found.- Specified by:
findById
in interfaceOAuth2AuthorizationConsentService
- Parameters:
registeredClientId
- the identifier for theRegisteredClient
principalName
- the name of thePrincipal
- Returns:
- the
OAuth2AuthorizationConsent
if found, otherwisenull
-
setAuthorizationConsentRowMapper
public final void setAuthorizationConsentRowMapper(org.springframework.jdbc.core.RowMapper<OAuth2AuthorizationConsent> authorizationConsentRowMapper) Sets theRowMapper
used for mapping the current row injava.sql.ResultSet
toOAuth2AuthorizationConsent
. The default isJdbcOAuth2AuthorizationConsentService.OAuth2AuthorizationConsentRowMapper
.- Parameters:
authorizationConsentRowMapper
- theRowMapper
used for mapping the current row inResultSet
toOAuth2AuthorizationConsent
-
setAuthorizationConsentParametersMapper
public final void setAuthorizationConsentParametersMapper(Function<OAuth2AuthorizationConsent, List<org.springframework.jdbc.core.SqlParameterValue>> authorizationConsentParametersMapper) Sets theFunction
used for mappingOAuth2AuthorizationConsent
to aList
ofSqlParameterValue
. The default isJdbcOAuth2AuthorizationConsentService.OAuth2AuthorizationConsentParametersMapper
.- Parameters:
authorizationConsentParametersMapper
- theFunction
used for mappingOAuth2AuthorizationConsent
to aList
ofSqlParameterValue
-
getJdbcOperations
protected final org.springframework.jdbc.core.JdbcOperations getJdbcOperations() -
getAuthorizationConsentRowMapper
protected final org.springframework.jdbc.core.RowMapper<OAuth2AuthorizationConsent> getAuthorizationConsentRowMapper() -
getAuthorizationConsentParametersMapper
protected final Function<OAuth2AuthorizationConsent,List<org.springframework.jdbc.core.SqlParameterValue>> getAuthorizationConsentParametersMapper()
-