Skip to content

Provide JDBC implementation of OAuth2AuthorizedClientService #7655

Closed
@jgrandja

Description

@jgrandja

We should provide a JDBC implementation of OAuth2AuthorizedClientService.

Related #7889

JdbcOAuth2AuthorizedClientService may be configured as follows:

@Bean
public OAuth2AuthorizedClientService authorizedClientService(
		JdbcOperations jdbcOperations,
		ClientRegistrationRepository clientRegistrationRepository) {
	return new JdbcOAuth2AuthorizedClientService(jdbcOperations, clientRegistrationRepository);
}

NOTE: JdbcOperations must be provided by the application and configured with a database schema that has the following table definition:

CREATE TABLE oauth2_authorized_client (
  client_registration_id varchar(100) NOT NULL,
  principal_name varchar(200) NOT NULL,
  access_token_type varchar(100) NOT NULL,
  access_token_value blob NOT NULL,
  access_token_issued_at timestamp NOT NULL,
  access_token_expires_at timestamp NOT NULL,
  access_token_scopes varchar(1000) DEFAULT NULL,
  refresh_token_value blob DEFAULT NULL,
  refresh_token_issued_at timestamp DEFAULT NULL,
  created_at timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
  PRIMARY KEY (client_registration_id, principal_name)
);

See classpath:org/springframework/security/oauth2/client/oauth2-client-schema.sql.

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions