From 42a787d1f6f76d670f0d43797a4321e4563443d4 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 30 Sep 2020 16:58:30 -0400 Subject: [PATCH] Add Postgres sql for JDBC implementation of OAuth2AuthorizedClientService Postgres doesn't have a BLOB type, but it does have an equivalent BYTEA type. This approach and naming convention follows the convention established in Spring Session JDBC which has sql for each RDBMS with files names in the pattern *-{dbname}.sql, for example: schema-db2.sql schema-derby.sql schema-h2.sql schema-mysql.sql schema-postgresql.sql See https://github.com/spring-projects/spring-session/tree/2.3.1.RELEASE/spring-session-jdbc/src/main/resources/org/springframework/session/jdbc Issue gh-9070 --- .../oauth2/client/oauth2-client-schema-postgres.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 oauth2/oauth2-client/src/main/resources/org/springframework/security/oauth2/client/oauth2-client-schema-postgres.sql diff --git a/oauth2/oauth2-client/src/main/resources/org/springframework/security/oauth2/client/oauth2-client-schema-postgres.sql b/oauth2/oauth2-client/src/main/resources/org/springframework/security/oauth2/client/oauth2-client-schema-postgres.sql new file mode 100644 index 0000000000..ff23882247 --- /dev/null +++ b/oauth2/oauth2-client/src/main/resources/org/springframework/security/oauth2/client/oauth2-client-schema-postgres.sql @@ -0,0 +1,13 @@ +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 bytea 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 bytea DEFAULT NULL, + refresh_token_issued_at timestamp DEFAULT NULL, + created_at timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, + PRIMARY KEY (client_registration_id, principal_name) +);