Skip to content

Commit b42f0f5

Browse files
committed
Document JdbcOAuth2AuthorizedClientService
Fixes gh-8061
1 parent 62d01d2 commit b42f0f5

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

docs/manual/src/docs/asciidoc/_includes/servlet/appendix/database-schema.adoc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,3 +363,26 @@ BEGIN
363363
SELECT ACL_ENTRY_SQ.NEXTVAL INTO :NEW.ID FROM DUAL;
364364
END;
365365
----
366+
367+
368+
[[dbschema-oauth2-client]]
369+
== OAuth 2.0 Client Schema
370+
The JDBC implementation of <<oauth2Client-authorized-repo-service, OAuth2AuthorizedClientService>> (`JdbcOAuth2AuthorizedClientService`) requires a table for persisting `OAuth2AuthorizedClient`(s).
371+
You will need to adjust this schema to match the database dialect you are using.
372+
373+
[source,ddl]
374+
----
375+
CREATE TABLE oauth2_authorized_client (
376+
client_registration_id varchar(100) NOT NULL,
377+
principal_name varchar(200) NOT NULL,
378+
access_token_type varchar(100) NOT NULL,
379+
access_token_value blob NOT NULL,
380+
access_token_issued_at timestamp NOT NULL,
381+
access_token_expires_at timestamp NOT NULL,
382+
access_token_scopes varchar(1000) DEFAULT NULL,
383+
refresh_token_value blob DEFAULT NULL,
384+
refresh_token_issued_at timestamp DEFAULT NULL,
385+
created_at timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
386+
PRIMARY KEY (client_registration_id, principal_name)
387+
);
388+
----

docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-client.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ public class OAuth2ClientController {
277277
Spring Boot 2.x auto-configuration registers an `OAuth2AuthorizedClientRepository` and/or `OAuth2AuthorizedClientService` `@Bean` in the `ApplicationContext`.
278278
However, the application may choose to override and register a custom `OAuth2AuthorizedClientRepository` or `OAuth2AuthorizedClientService` `@Bean`.
279279

280+
The default implementation of `OAuth2AuthorizedClientService` is `InMemoryOAuth2AuthorizedClientService`, which stores `OAuth2AuthorizedClient`(s) in-memory.
281+
282+
Alternatively, the JDBC implementation `JdbcOAuth2AuthorizedClientService` may be configured for persisting `OAuth2AuthorizedClient`(s) in a database.
283+
284+
[NOTE]
285+
`JdbcOAuth2AuthorizedClientService` depends on the table definition described in <<dbschema-oauth2-client, OAuth 2.0 Client Schema>>.
286+
280287

281288
[[oauth2Client-authorized-manager-provider]]
282289
==== OAuth2AuthorizedClientManager / OAuth2AuthorizedClientProvider

0 commit comments

Comments
 (0)