From b42f0f50ab57186c15c57cead4ebbda75be3cdc9 Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Wed, 4 Mar 2020 10:14:16 -0500 Subject: [PATCH] Document JdbcOAuth2AuthorizedClientService Fixes gh-8061 --- .../servlet/appendix/database-schema.adoc | 23 +++++++++++++++++++ .../servlet/oauth2/oauth2-client.adoc | 7 ++++++ 2 files changed, 30 insertions(+) diff --git a/docs/manual/src/docs/asciidoc/_includes/servlet/appendix/database-schema.adoc b/docs/manual/src/docs/asciidoc/_includes/servlet/appendix/database-schema.adoc index 5cceee61bc..ab840e131f 100644 --- a/docs/manual/src/docs/asciidoc/_includes/servlet/appendix/database-schema.adoc +++ b/docs/manual/src/docs/asciidoc/_includes/servlet/appendix/database-schema.adoc @@ -363,3 +363,26 @@ BEGIN SELECT ACL_ENTRY_SQ.NEXTVAL INTO :NEW.ID FROM DUAL; END; ---- + + +[[dbschema-oauth2-client]] +== OAuth 2.0 Client Schema +The JDBC implementation of <> (`JdbcOAuth2AuthorizedClientService`) requires a table for persisting `OAuth2AuthorizedClient`(s). +You will need to adjust this schema to match the database dialect you are using. + +[source,ddl] +---- +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) +); +---- diff --git a/docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-client.adoc b/docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-client.adoc index 0c358cee0c..d122839a89 100644 --- a/docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-client.adoc +++ b/docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-client.adoc @@ -277,6 +277,13 @@ public class OAuth2ClientController { Spring Boot 2.x auto-configuration registers an `OAuth2AuthorizedClientRepository` and/or `OAuth2AuthorizedClientService` `@Bean` in the `ApplicationContext`. However, the application may choose to override and register a custom `OAuth2AuthorizedClientRepository` or `OAuth2AuthorizedClientService` `@Bean`. +The default implementation of `OAuth2AuthorizedClientService` is `InMemoryOAuth2AuthorizedClientService`, which stores `OAuth2AuthorizedClient`(s) in-memory. + +Alternatively, the JDBC implementation `JdbcOAuth2AuthorizedClientService` may be configured for persisting `OAuth2AuthorizedClient`(s) in a database. + +[NOTE] +`JdbcOAuth2AuthorizedClientService` depends on the table definition described in <>. + [[oauth2Client-authorized-manager-provider]] ==== OAuth2AuthorizedClientManager / OAuth2AuthorizedClientProvider