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:
-
OAuth2AuthorizationConsentServiceOAuth2AuthorizationConsentJdbcOperationsRowMapper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
ConstructorsConstructorDescriptionJdbcOAuth2AuthorizationConsentService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository) Constructs aJdbcOAuth2AuthorizationConsentServiceusing the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns theOAuth2AuthorizationConsentidentified by the providedregisteredClientIdandprincipalName, ornullif 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.JdbcOperationsvoidremove(OAuth2AuthorizationConsent authorizationConsent) Removes theOAuth2AuthorizationConsent.voidsave(OAuth2AuthorizationConsent authorizationConsent) Saves theOAuth2AuthorizationConsent.final voidsetAuthorizationConsentParametersMapper(Function<OAuth2AuthorizationConsent, List<org.springframework.jdbc.core.SqlParameterValue>> authorizationConsentParametersMapper) final voidsetAuthorizationConsentRowMapper(org.springframework.jdbc.core.RowMapper<OAuth2AuthorizationConsent> authorizationConsentRowMapper) Sets theRowMapperused for mapping the current row injava.sql.ResultSettoOAuth2AuthorizationConsent.
-
Constructor Details
-
JdbcOAuth2AuthorizationConsentService
public JdbcOAuth2AuthorizationConsentService(org.springframework.jdbc.core.JdbcOperations jdbcOperations, RegisteredClientRepository registeredClientRepository) Constructs aJdbcOAuth2AuthorizationConsentServiceusing the provided parameters.- Parameters:
jdbcOperations- the JDBC operationsregisteredClientRepository- the registered client repository
-
-
Method Details
-
save
Description copied from interface:OAuth2AuthorizationConsentServiceSaves theOAuth2AuthorizationConsent.- Specified by:
savein interfaceOAuth2AuthorizationConsentService- Parameters:
authorizationConsent- theOAuth2AuthorizationConsent
-
remove
Description copied from interface:OAuth2AuthorizationConsentServiceRemoves theOAuth2AuthorizationConsent.- Specified by:
removein interfaceOAuth2AuthorizationConsentService- Parameters:
authorizationConsent- theOAuth2AuthorizationConsent
-
findById
@Nullable public OAuth2AuthorizationConsent findById(String registeredClientId, String principalName) Description copied from interface:OAuth2AuthorizationConsentServiceReturns theOAuth2AuthorizationConsentidentified by the providedregisteredClientIdandprincipalName, ornullif not found.- Specified by:
findByIdin interfaceOAuth2AuthorizationConsentService- Parameters:
registeredClientId- the identifier for theRegisteredClientprincipalName- the name of thePrincipal- Returns:
- the
OAuth2AuthorizationConsentif found, otherwisenull
-
setAuthorizationConsentRowMapper
public final void setAuthorizationConsentRowMapper(org.springframework.jdbc.core.RowMapper<OAuth2AuthorizationConsent> authorizationConsentRowMapper) Sets theRowMapperused for mapping the current row injava.sql.ResultSettoOAuth2AuthorizationConsent. The default isJdbcOAuth2AuthorizationConsentService.OAuth2AuthorizationConsentRowMapper.- Parameters:
authorizationConsentRowMapper- theRowMapperused for mapping the current row inResultSettoOAuth2AuthorizationConsent
-
setAuthorizationConsentParametersMapper
public final void setAuthorizationConsentParametersMapper(Function<OAuth2AuthorizationConsent, List<org.springframework.jdbc.core.SqlParameterValue>> authorizationConsentParametersMapper) Sets theFunctionused for mappingOAuth2AuthorizationConsentto aListofSqlParameterValue. The default isJdbcOAuth2AuthorizationConsentService.OAuth2AuthorizationConsentParametersMapper.- Parameters:
authorizationConsentParametersMapper- theFunctionused for mappingOAuth2AuthorizationConsentto aListofSqlParameterValue
-
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()
-