inject claims redirect URIs into clients

multiparty
Justin Richer 2015-12-10 16:22:45 -05:00
parent fe6d19352e
commit c4e734b1a8
2 changed files with 90 additions and 0 deletions

View File

@ -28,6 +28,10 @@ INSERT INTO client_redirect_uri_TEMP (owner_id, redirect_uri) VALUES
('client', 'http://localhost/'),
('client', 'http://localhost:8080/');
INSERT INTO client_claims_redirect_uri_TEMP (owner_id, redirect_uri) VALUES
('c', 'http://localhost/'),
('c', 'http://localhost:8080/');
INSERT INTO client_grant_type_TEMP (owner_id, grant_type) VALUES
('client', 'authorization_code'),
('client', 'urn:ietf:params:oauth:grant_type:redelegate'),
@ -59,6 +63,12 @@ MERGE INTO client_redirect_uri
WHEN NOT MATCHED THEN
INSERT (owner_id, redirect_uri) values (vals.id, vals.redirect_uri);
MERGE INTO client_claims_redirect_uri
USING (SELECT id, redirect_uri FROM client_claims_redirect_uri_TEMP, client_details WHERE client_details.client_id = client_claims_redirect_uri_TEMP.owner_id) AS vals(id, redirect_uri)
ON vals.id = client_claims_redirect_uri.owner_id AND vals.redirect_uri = client_claims_redirect_uri.redirect_uri
WHEN NOT MATCHED THEN
INSERT (owner_id, redirect_uri) values (vals.id, vals.redirect_uri);
MERGE INTO client_grant_type
USING (SELECT id, grant_type FROM client_grant_type_TEMP, client_details WHERE client_details.client_id = client_grant_type_TEMP.owner_id) AS vals(id, grant_type)
ON vals.id = client_grant_type.owner_id AND vals.grant_type = client_grant_type.grant_type

View File

@ -0,0 +1,80 @@
--
-- Temporary tables used during the bootstrapping process to safely load users and clients.
-- These are not needed if you're not using the users.sql/clients.sql files to bootstrap the database.
--
CREATE TEMPORARY TABLE IF NOT EXISTS authorities_TEMP (
username varchar(50) not null,
authority varchar(50) not null,
constraint ix_authority_TEMP unique (username,authority));
CREATE TEMPORARY TABLE IF NOT EXISTS users_TEMP (
username varchar(50) not null primary key,
password varchar(50) not null,
enabled boolean not null);
CREATE TEMPORARY TABLE IF NOT EXISTS user_info_TEMP (
sub VARCHAR(256) not null primary key,
preferred_username VARCHAR(256),
name VARCHAR(256),
given_name VARCHAR(256),
family_name VARCHAR(256),
middle_name VARCHAR(256),
nickname VARCHAR(256),
profile VARCHAR(256),
picture VARCHAR(256),
website VARCHAR(256),
email VARCHAR(256),
email_verified BOOLEAN,
gender VARCHAR(256),
zone_info VARCHAR(256),
locale VARCHAR(256),
phone_number VARCHAR(256),
address_id VARCHAR(256),
updated_time VARCHAR(256),
birthdate VARCHAR(256)
);
CREATE TEMPORARY TABLE IF NOT EXISTS client_details_TEMP (
client_description VARCHAR(256),
dynamically_registered BOOLEAN,
id_token_validity_seconds BIGINT,
client_id VARCHAR(256),
client_secret VARCHAR(2048),
access_token_validity_seconds BIGINT,
refresh_token_validity_seconds BIGINT,
allow_introspection BOOLEAN,
client_name VARCHAR(256)
);
CREATE TEMPORARY TABLE IF NOT EXISTS client_scope_TEMP (
owner_id VARCHAR(256),
scope VARCHAR(2048)
);
CREATE TEMPORARY TABLE IF NOT EXISTS client_redirect_uri_TEMP (
owner_id VARCHAR(256),
redirect_uri VARCHAR(2048)
);
CREATE TEMPORARY TABLE IF NOT EXISTS client_claims_redirect_uri_TEMP (
owner_id VARCHAR(256),
redirect_uri VARCHAR(2048)
);
CREATE TEMPORARY TABLE IF NOT EXISTS client_grant_type_TEMP (
owner_id VARCHAR(256),
grant_type VARCHAR(2000)
);
CREATE TEMPORARY TABLE IF NOT EXISTS system_scope_TEMP (
scope VARCHAR(256),
description VARCHAR(4096),
icon VARCHAR(256),
restricted BOOLEAN,
default_scope BOOLEAN,
structured BOOLEAN,
structured_param_description VARCHAR(256)
);