diff --git a/openid-connect-server/pom.xml b/openid-connect-server/pom.xml index 658ac4f13..e3eb8e815 100644 --- a/openid-connect-server/pom.xml +++ b/openid-connect-server/pom.xml @@ -24,6 +24,11 @@ openid-connect-common 0.1-SNAPSHOT + + org.hsqldb + hsqldb + 2.2.9 + Reference implementation of OpenID Connect spec (http://openid.net/connect/). diff --git a/openid-connect-server/src/main/resources/db/tables/database_tables.sql b/openid-connect-server/src/main/resources/db/tables/database_tables.sql new file mode 100644 index 000000000..e2f5f08c7 --- /dev/null +++ b/openid-connect-server/src/main/resources/db/tables/database_tables.sql @@ -0,0 +1,181 @@ +CREATE TABLE access_token ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + token_value VARCHAR(4096), + expiration TIMESTAMP, + token_type VARCHAR(256), + refresh_token_id BIGINT, + client_id VARCHAR(256), + auth_holder_id BIGINT, + id_token_string VARCHAR(4096) +); + +CREATE TABLE address ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + formatted VARCHAR(256), + street_address VARCHAR(256), + locality VARCHAR(256), + region VARCHAR(256), + postal_code VARCHAR(256), + country VARCHAR(256) +); + +CREATE TABLE approved_site ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + user_id VARCHAR(4096), + client_id VARCHAR(4096), + creation_date TIMESTAMP, + access_date TIMESTAMP, + timeout_date TIMESTAMP, + whitelisted_site_id VARCHAR(256) +); + +CREATE TABLE approved_site_scope ( + owner_id BIGINT, + scope VARCHAR(256) +); + +CREATE TABLE authentication_holder ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + owner_id BIGINT, + authentication LONGVARBINARY +); + +CREATE TABLE authority ( + owner_id BIGINT, + authority LONGVARBINARY +); + +CREATE TABLE authorization_code ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + code VARCHAR(256), + authorization_request_holder LONGVARBINARY +); + +CREATE TABLE authorized_grant_type ( + owner_id BIGINT, + authorized_grant_type VARCHAR(2000) +); + +CREATE TABLE client_details ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + client_description VARCHAR(256), + allow_refresh TINYINT, + allow_multiple_access_tokens TINYINT, + reuse_refresh_tokens TINYINT, + dynamically_registered TINYINT, + id_token_validity_seconds BIGINT, + + client_id VARCHAR(256), + client_secret VARCHAR(2048), + access_token_validity_seconds BIGINT, + refresh_token_validity_seconds BIGINT, + + application_type VARCHAR(256), + application_name VARCHAR(256), + token_endpoint_auth_type VARCHAR(256), + user_id_type VARCHAR(256), + + logo_url VARCHAR(2048), + policy_url VARCHAR(2048), + jwk_url VARCHAR(2048), + jwk_encryption_url VARCHAR(2048), + x509_url VARCHAR(2048), + x509_encryption_url VARCHAR(2048), + sector_identifier_url VARCHAR(2048), + + requre_signed_request_object VARCHAR(256), + + user_info_signed_response_alg VARCHAR(256), + user_info_encrypted_response_alg VARCHAR(256), + user_info_encrypted_response_enc VARCHAR(256), + user_info_encrypted_response_int VARCHAR(256), + + id_token_signed_response_alg VARCHAR(256), + id_token_encrypted_response_alg VARCHAR(256), + id_token_encrypted_response_enc VARCHAR(256), + id_token_encrypted_response_int VARCHAR(256), + + default_max_age BIGINT, + require_auth_time TINYINT, + default_acr VARCHAR(256) +); + +CREATE TABLE contact ( + owner_id BIGINT, + contact VARCHAR(256) +); + +CREATE TABLE event ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + type INT, + timestamp DATE +); + +CREATE TABLE idtoken ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY +); + +CREATE TABLE idtokenclaims ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY +); + +CREATE TABLE redirect_uri ( + owner_id BIGINT, + redirect_uri VARCHAR(2048) +); + +CREATE TABLE refresh_token ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + token_value VARCHAR(4096), + expiration TIMESTAMP, + auth_holder_id BIGINT, + client_id VARCHAR(256) +); + +CREATE TABLE resource_id ( + owner_id VARCHAR(256), + resource_id VARCHAR(256) +); + +CREATE TABLE client_scope ( + owner_id VARCHAR(4096), + scope VARCHAR(2048) +); + +CREATE TABLE token_scope ( + owner_id VARCHAR(4096), + scope VARCHAR(2048) +); + +CREATE TABLE user_info ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + user_id VARCHAR(256), + 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) +); + +CREATE TABLE whitelisted_site ( + id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, + creator_user_id VARCHAR(256), + client_id VARCHAR(256) +); + +CREATE TABLE whitelisted_site_scope ( + owner_id BIGINT, + scope VARCHAR(256) +); diff --git a/openid-connect-server/db/tables/database_tables.sql b/openid-connect-server/src/main/resources/db/tables/mysql_database_tables.sql similarity index 100% rename from openid-connect-server/db/tables/database_tables.sql rename to openid-connect-server/src/main/resources/db/tables/mysql_database_tables.sql diff --git a/openid-connect-server/src/main/resources/db/tables/security-schema.sql b/openid-connect-server/src/main/resources/db/tables/security-schema.sql new file mode 100644 index 000000000..c5da5ddae --- /dev/null +++ b/openid-connect-server/src/main/resources/db/tables/security-schema.sql @@ -0,0 +1,10 @@ + create table users( + username varchar_ignorecase(50) not null primary key, + password varchar_ignorecase(50) not null, + enabled boolean not null); + + create table authorities ( + username varchar_ignorecase(50) not null, + authority varchar_ignorecase(50) not null, + constraint fk_authorities_users foreign key(username) references users(username)); + create unique index ix_auth_username on authorities (username,authority); \ No newline at end of file diff --git a/openid-connect-server/src/main/resources/db/users.sql b/openid-connect-server/src/main/resources/db/users.sql new file mode 100644 index 000000000..ef2f8efc3 --- /dev/null +++ b/openid-connect-server/src/main/resources/db/users.sql @@ -0,0 +1,23 @@ +INSERT INTO users(username, password, enabled) values ('jricher','password',true); +INSERT INTO authorities(username,authority) values ('jricher','ROLE_USER'); +INSERT INTO authorities(username,authority) values ('jricher','ROLE_ADMIN'); + +INSERT INTO users(username, password, enabled) values ('mfranklin','password',true); +INSERT INTO authorities(username,authority) values ('mfranklin','ROLE_USER'); +INSERT INTO authorities(username,authority) values ('mfranklin','ROLE_ADMIN'); + +INSERT INTO users(username, password, enabled) values ('dcuomo','password',true); +INSERT INTO authorities(username,authority) values ('dcuomo','ROLE_USER'); +INSERT INTO authorities(username,authority) values ('dcuomo','ROLE_ADMIN'); + +INSERT INTO users(username, password, enabled) values ('aanganes','password',true); +INSERT INTO authorities(username,authority) values ('aanganes','ROLE_USER'); +INSERT INTO authorities(username,authority) values ('aanganes','ROLE_ADMIN'); + +INSERT INTO users(username, password, enabled) values ('mjwalsh','password',true); +INSERT INTO authorities(username,authority) values ('mjwalsh','ROLE_USER'); +INSERT INTO authorities(username,authority) values ('mjwalsh','ROLE_ADMIN'); + +INSERT INTO users(username, password, enabled) values ('srmoore','password',true); +INSERT INTO authorities(username,authority) values ('srmoore','ROLE_USER'); +INSERT INTO authorities(username,authority) values ('srmoore','ROLE_ADMIN'); \ No newline at end of file diff --git a/openid-connect-server/src/main/webapp/WEB-INF/application-context.xml b/openid-connect-server/src/main/webapp/WEB-INF/application-context.xml index 46fb946c2..60012472c 100644 --- a/openid-connect-server/src/main/webapp/WEB-INF/application-context.xml +++ b/openid-connect-server/src/main/webapp/WEB-INF/application-context.xml @@ -134,7 +134,8 @@ - + + diff --git a/openid-connect-server/src/main/webapp/WEB-INF/data-context.xml b/openid-connect-server/src/main/webapp/WEB-INF/data-context.xml index 474403320..059f5178d 100644 --- a/openid-connect-server/src/main/webapp/WEB-INF/data-context.xml +++ b/openid-connect-server/src/main/webapp/WEB-INF/data-context.xml @@ -1,13 +1,35 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd"> + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/openid-connect-server/src/main/webapp/WEB-INF/user-context.xml b/openid-connect-server/src/main/webapp/WEB-INF/user-context.xml index 601f3846f..1232861c8 100644 --- a/openid-connect-server/src/main/webapp/WEB-INF/user-context.xml +++ b/openid-connect-server/src/main/webapp/WEB-INF/user-context.xml @@ -16,6 +16,8 @@ + +