From ca11c630ad123d620c6a0b8b69ed028dff7d738d Mon Sep 17 00:00:00 2001 From: ayyoob Date: Thu, 1 Oct 2015 16:10:10 +0530 Subject: [PATCH] APIM, Store, DAS features merged to one pack --- .../distribution/identity_config_change.xml | 12 + modules/distribution/pom.xml | 425 +++--- .../customsequences/fault/json_fault.xml | 0 .../in/json_to_xml_in_message.xml | 0 .../customsequences/in/log_in_message.xml | 0 .../in/preserve_accept_header.xml | 0 .../in/xml_to_json_in_message.xml | 0 .../out/apply_accept_header.xml | 0 .../out/json_to_xml_out_message.xml | 0 .../customsequences/out/log_out_message.xml | 0 .../out/xml_to_json_out_message.xml | 0 .../src/api-resource/sql/h2-sample-data.sql | 67 + .../distribution/src/api-resource/sql/h2.sql | 735 ++++++++++ .../src/api-resource/sql/mssql.sql | 815 ++++++++++++ .../src/api-resource/sql/mysql.sql | 752 +++++++++++ .../src/api-resource/sql/mysql_cluster.sql | 752 +++++++++++ .../src/api-resource/sql/oracle.sql | 1181 +++++++++++++++++ .../src/api-resource/sql/oracle_rac.sql | 1180 ++++++++++++++++ .../src/api-resource/sql/postgresql.sql | 859 ++++++++++++ modules/distribution/src/assembly/bin.xml | 418 +++--- .../src/repository/conf/axis2/axis2.xml | 1045 +++++++++------ .../identity/identity-providers/default.xml | 24 - .../identity/service-providers/default.xml | 49 - .../identity/service-providers/sp_cdm.xml | 49 - .../service-providers/sp_dashboard.xml | 49 - .../identity/service-providers/sp_mdm.xml | 49 - .../src/repository/conf/synapse.properties | 42 + modules/p2-profile-gen/pom.xml | 387 +++--- pom.xml | 241 ++-- 29 files changed, 7674 insertions(+), 1457 deletions(-) create mode 100644 modules/distribution/identity_config_change.xml rename modules/distribution/src/{repository/conf/resources => api-resource}/customsequences/fault/json_fault.xml (100%) rename modules/distribution/src/{repository/conf/resources => api-resource}/customsequences/in/json_to_xml_in_message.xml (100%) rename modules/distribution/src/{repository/conf/resources => api-resource}/customsequences/in/log_in_message.xml (100%) rename modules/distribution/src/{repository/conf/resources => api-resource}/customsequences/in/preserve_accept_header.xml (100%) rename modules/distribution/src/{repository/conf/resources => api-resource}/customsequences/in/xml_to_json_in_message.xml (100%) rename modules/distribution/src/{repository/conf/resources => api-resource}/customsequences/out/apply_accept_header.xml (100%) rename modules/distribution/src/{repository/conf/resources => api-resource}/customsequences/out/json_to_xml_out_message.xml (100%) rename modules/distribution/src/{repository/conf/resources => api-resource}/customsequences/out/log_out_message.xml (100%) rename modules/distribution/src/{repository/conf/resources => api-resource}/customsequences/out/xml_to_json_out_message.xml (100%) create mode 100644 modules/distribution/src/api-resource/sql/h2-sample-data.sql create mode 100644 modules/distribution/src/api-resource/sql/h2.sql create mode 100644 modules/distribution/src/api-resource/sql/mssql.sql create mode 100644 modules/distribution/src/api-resource/sql/mysql.sql create mode 100644 modules/distribution/src/api-resource/sql/mysql_cluster.sql create mode 100644 modules/distribution/src/api-resource/sql/oracle.sql create mode 100644 modules/distribution/src/api-resource/sql/oracle_rac.sql create mode 100644 modules/distribution/src/api-resource/sql/postgresql.sql delete mode 100644 modules/distribution/src/repository/conf/identity/identity-providers/default.xml delete mode 100644 modules/distribution/src/repository/conf/identity/service-providers/default.xml delete mode 100644 modules/distribution/src/repository/conf/identity/service-providers/sp_cdm.xml delete mode 100644 modules/distribution/src/repository/conf/identity/service-providers/sp_dashboard.xml delete mode 100644 modules/distribution/src/repository/conf/identity/service-providers/sp_mdm.xml create mode 100644 modules/distribution/src/repository/conf/synapse.properties diff --git a/modules/distribution/identity_config_change.xml b/modules/distribution/identity_config_change.xml new file mode 100644 index 00000000..c0c0c6ee --- /dev/null +++ b/modules/distribution/identity_config_change.xml @@ -0,0 +1,12 @@ + + + + //s:Server/s:OAuth/s:OAuthScopeValidator + + + + //s:Server/s:OAuth/s:OAuthCallbackHandlers + ]]> + + diff --git a/modules/distribution/pom.xml b/modules/distribution/pom.xml index 31a17cc7..48fe1c6f 100644 --- a/modules/distribution/pom.xml +++ b/modules/distribution/pom.xml @@ -93,58 +93,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + org.apache.maven.plugins maven-antrun-plugin - - 1-replace-datasource-property-thrift-authentication - package - - run - - - - - - - - - @@ -227,179 +182,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3-extract-apps-from-components package @@ -525,65 +307,75 @@ - - install_samples - package - - - - - - - - - - - - - - - - - - - - - - - - run - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + clean_target install + + + + + + + + + + + + + + + + - - - - + - - - @@ -635,6 +427,105 @@ + + com.google.code.maven-replacer-plugin + replacer + 1.5.2 + + + + replace-for-identity + prepare-package + + replace + + + ${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.platform.version}/repository/conf/identity/identity.xml + + + /Server/JDBCPersistenceManager/DataSource/Name + (jdbc/WSO2CarbonDB) + jdbc/WSO2AM_DB + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + replace-for-thrift + prepare-package + + replace + + + ${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.platform.version}/repository/conf/identity/thrift-authentication.xml + + + /Server/JDBCPersistenceManager/DataSource/Name + (jdbc/WSO2CarbonDB) + jdbc/WSO2AM_DB + + + + + + + + + + com.google.code.maven-config-processor-plugin + config-processor-maven-plugin + 2.6 + + + add-scope-validator + prepare-package + + process + + + false + + + ${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.platform.version}/repository/conf/identity/identity.xml + ../../p2-profile-gen/target/wso2carbon-core-${carbon.platform.version}/repository/conf/identity/identity.xml + identity_config_change.xml + + + + http://wso2.org/projects/carbon/carbon.xml + + + + + + org.apache.maven.plugins maven-clean-plugin diff --git a/modules/distribution/src/repository/conf/resources/customsequences/fault/json_fault.xml b/modules/distribution/src/api-resource/customsequences/fault/json_fault.xml similarity index 100% rename from modules/distribution/src/repository/conf/resources/customsequences/fault/json_fault.xml rename to modules/distribution/src/api-resource/customsequences/fault/json_fault.xml diff --git a/modules/distribution/src/repository/conf/resources/customsequences/in/json_to_xml_in_message.xml b/modules/distribution/src/api-resource/customsequences/in/json_to_xml_in_message.xml similarity index 100% rename from modules/distribution/src/repository/conf/resources/customsequences/in/json_to_xml_in_message.xml rename to modules/distribution/src/api-resource/customsequences/in/json_to_xml_in_message.xml diff --git a/modules/distribution/src/repository/conf/resources/customsequences/in/log_in_message.xml b/modules/distribution/src/api-resource/customsequences/in/log_in_message.xml similarity index 100% rename from modules/distribution/src/repository/conf/resources/customsequences/in/log_in_message.xml rename to modules/distribution/src/api-resource/customsequences/in/log_in_message.xml diff --git a/modules/distribution/src/repository/conf/resources/customsequences/in/preserve_accept_header.xml b/modules/distribution/src/api-resource/customsequences/in/preserve_accept_header.xml similarity index 100% rename from modules/distribution/src/repository/conf/resources/customsequences/in/preserve_accept_header.xml rename to modules/distribution/src/api-resource/customsequences/in/preserve_accept_header.xml diff --git a/modules/distribution/src/repository/conf/resources/customsequences/in/xml_to_json_in_message.xml b/modules/distribution/src/api-resource/customsequences/in/xml_to_json_in_message.xml similarity index 100% rename from modules/distribution/src/repository/conf/resources/customsequences/in/xml_to_json_in_message.xml rename to modules/distribution/src/api-resource/customsequences/in/xml_to_json_in_message.xml diff --git a/modules/distribution/src/repository/conf/resources/customsequences/out/apply_accept_header.xml b/modules/distribution/src/api-resource/customsequences/out/apply_accept_header.xml similarity index 100% rename from modules/distribution/src/repository/conf/resources/customsequences/out/apply_accept_header.xml rename to modules/distribution/src/api-resource/customsequences/out/apply_accept_header.xml diff --git a/modules/distribution/src/repository/conf/resources/customsequences/out/json_to_xml_out_message.xml b/modules/distribution/src/api-resource/customsequences/out/json_to_xml_out_message.xml similarity index 100% rename from modules/distribution/src/repository/conf/resources/customsequences/out/json_to_xml_out_message.xml rename to modules/distribution/src/api-resource/customsequences/out/json_to_xml_out_message.xml diff --git a/modules/distribution/src/repository/conf/resources/customsequences/out/log_out_message.xml b/modules/distribution/src/api-resource/customsequences/out/log_out_message.xml similarity index 100% rename from modules/distribution/src/repository/conf/resources/customsequences/out/log_out_message.xml rename to modules/distribution/src/api-resource/customsequences/out/log_out_message.xml diff --git a/modules/distribution/src/repository/conf/resources/customsequences/out/xml_to_json_out_message.xml b/modules/distribution/src/api-resource/customsequences/out/xml_to_json_out_message.xml similarity index 100% rename from modules/distribution/src/repository/conf/resources/customsequences/out/xml_to_json_out_message.xml rename to modules/distribution/src/api-resource/customsequences/out/xml_to_json_out_message.xml diff --git a/modules/distribution/src/api-resource/sql/h2-sample-data.sql b/modules/distribution/src/api-resource/sql/h2-sample-data.sql new file mode 100644 index 00000000..2f7f2792 --- /dev/null +++ b/modules/distribution/src/api-resource/sql/h2-sample-data.sql @@ -0,0 +1,67 @@ +DELETE FROM AM_SUBSCRIPTION_KEY_MAPPING; +DELETE FROM AM_APPLICATION_KEY_MAPPING; +DELETE FROM AM_SUBSCRIPTION ; +DELETE FROM AM_APPLICATION ; +DELETE FROM AM_SUBSCRIBER; +DELETE FROM AM_API; +DELETE FROM IDN_OAUTH2_ACCESS_TOKEN ; +DELETE FROM IDN_OAUTH_CONSUMER_APPS; + +ALTER TABLE AM_SUBSCRIBER ALTER COLUMN SUBSCRIBER_ID RESTART WITH 1; +ALTER TABLE AM_APPLICATION ALTER COLUMN APPLICATION_ID RESTART WITH 100; +ALTER TABLE AM_API ALTER COLUMN API_ID RESTART WITH 500; +ALTER TABLE AM_SUBSCRIPTION ALTER COLUMN SUBSCRIPTION_ID RESTART WITH 1000; + +INSERT INTO AM_SUBSCRIBER ( USER_ID , TENANT_ID , EMAIL_ADDRESS , DATE_SUBSCRIBED ) VALUES ('SUMEDHA',-1234,'SUMEDHA@WSO2.COM','2012-03-05 12:10:11'); +INSERT INTO AM_SUBSCRIBER ( USER_ID , TENANT_ID , EMAIL_ADDRESS , DATE_SUBSCRIBED ) VALUES ('PRABATH',-1234,'PRABATH@WSO2.COM','2012-03-05 12:10:11'); +INSERT INTO AM_SUBSCRIBER ( USER_ID , TENANT_ID , EMAIL_ADDRESS , DATE_SUBSCRIBED ) VALUES ('THILINA',-1234,'THILINA@WSO2.COM','2012-03-05 12:10:11'); +INSERT INTO AM_SUBSCRIBER ( USER_ID , TENANT_ID , EMAIL_ADDRESS , DATE_SUBSCRIBED ) VALUES ('UDAYANGA',-1234,'UDAYANGA@WSO2.COM','2012-03-05 12:10:11'); + + +INSERT INTO AM_APPLICATION (NAME,SUBSCRIBER_ID ) VALUES ('APPLICATION1',1); +INSERT INTO AM_APPLICATION (NAME,SUBSCRIBER_ID ) VALUES ('APPLICATION2',1); +INSERT INTO AM_APPLICATION (NAME,SUBSCRIBER_ID ) VALUES ('APPLICATION3',2); +INSERT INTO AM_APPLICATION (NAME,SUBSCRIBER_ID ) VALUES ('APPLICATION4',2); +INSERT INTO AM_APPLICATION (NAME,SUBSCRIBER_ID ) VALUES ('APPLICATION5',3); +INSERT INTO AM_APPLICATION (NAME,SUBSCRIBER_ID ) VALUES ('DeliciousApp',4); + +INSERT INTO AM_API (API_PROVIDER,API_NAME,API_VERSION,CONTEXT) VALUES ('SUMEDHA', 'API1', 'V1.0.0','/context1'); +INSERT INTO AM_API (API_PROVIDER,API_NAME,API_VERSION,CONTEXT) VALUES ('PRABATH', 'API2', 'V1.0.0','/deli2'); +INSERT INTO AM_API (API_PROVIDER,API_NAME,API_VERSION,CONTEXT) VALUES ('ADMIN', 'API3', 'V1.0.0','/test'); +INSERT INTO AM_API (API_PROVIDER,API_NAME,API_VERSION,CONTEXT) VALUES ('DEL', 'Delicious', '1.0.0','/deli'); + +INSERT INTO AM_SUBSCRIPTION ( TIER_ID , API_ID , APPLICATION_ID , LAST_ACCESSED ) VALUES ('T1',500,100,'2012-03-05 12:10:11'); +INSERT INTO AM_SUBSCRIPTION ( TIER_ID , API_ID , APPLICATION_ID , LAST_ACCESSED ) VALUES ('T1',501,101,'2012-03-05 12:10:11'); +INSERT INTO AM_SUBSCRIPTION ( TIER_ID , API_ID , APPLICATION_ID , LAST_ACCESSED ) VALUES ('T1',500,102,'2012-03-05 12:10:11'); +INSERT INTO AM_SUBSCRIPTION ( TIER_ID , API_ID , APPLICATION_ID , LAST_ACCESSED ) VALUES ('T1',502,103,'2012-03-05 12:10:11'); +INSERT INTO AM_SUBSCRIPTION ( TIER_ID , API_ID , APPLICATION_ID , LAST_ACCESSED ) VALUES ('T1',501,104,'2012-03-05 12:10:11'); +INSERT INTO AM_SUBSCRIPTION ( TIER_ID , API_ID , APPLICATION_ID , LAST_ACCESSED ) VALUES ('T1',503,105,'2012-03-05 12:10:11'); +INSERT INTO AM_SUBSCRIPTION ( TIER_ID , API_ID , APPLICATION_ID , LAST_ACCESSED ) VALUES ('T1',501,102,'2012-03-05 12:10:11'); + +INSERT INTO AM_SUBSCRIPTION_KEY_MAPPING (SUBSCRIPTION_ID, ACCESS_TOKEN, KEY_TYPE) VALUES (1000, 'SSDCHEJJ-AWUIS-232', 'PRODUCTION'); +INSERT INTO AM_SUBSCRIPTION_KEY_MAPPING (SUBSCRIPTION_ID, ACCESS_TOKEN, KEY_TYPE) VALUES (1001, 'a1b2c3d4', 'SANDBOX'); +INSERT INTO AM_SUBSCRIPTION_KEY_MAPPING (SUBSCRIPTION_ID, ACCESS_TOKEN, KEY_TYPE) VALUES (1002, 'p1q2r3s4', 'PRODUCTION'); + +INSERT INTO AM_APPLICATION_KEY_MAPPING (APPLICATION_ID, CONSUMER_KEY, KEY_TYPE) VALUES (100, 'CON1', 'PRODUCTION'); +INSERT INTO AM_APPLICATION_KEY_MAPPING (APPLICATION_ID, CONSUMER_KEY, KEY_TYPE) VALUES (100, 'CON2', 'SANDBOX'); +INSERT INTO AM_APPLICATION_KEY_MAPPING (APPLICATION_ID, CONSUMER_KEY, KEY_TYPE) VALUES (101, 'CON3', 'PRODUCTION'); + +INSERT INTO IDN_OAUTH_CONSUMER_APPS ( APP_NAME , CALLBACK_URL , CONSUMER_KEY , CONSUMER_SECRET ,OAUTH_VERSION , TENANT_ID , USERNAME ) VALUES (NULL,NULL,'CON1','MY PEN','2.0',0,'PRABATH'); +INSERT INTO IDN_OAUTH_CONSUMER_APPS ( APP_NAME , CALLBACK_URL , CONSUMER_KEY , CONSUMER_SECRET ,OAUTH_VERSION , TENANT_ID , USERNAME ) VALUES (NULL,NULL,'CON2','MY PEN','2.0',0,'PRABATH'); +INSERT INTO IDN_OAUTH_CONSUMER_APPS ( APP_NAME , CALLBACK_URL , CONSUMER_KEY , CONSUMER_SECRET ,OAUTH_VERSION , TENANT_ID , USERNAME ) VALUES (NULL,NULL,'CON3','MY PEN','2.0',0,'admin'); + +INSERT INTO IDN_OAUTH2_ACCESS_TOKEN ( TOKEN_ID, ACCESS_TOKEN ,AUTHZ_USER , USER_TYPE , CONSUMER_KEY , REFRESH_TOKEN ,TIME_CREATED , TOKEN_SCOPE_HASH , TOKEN_STATE ,VALIDITY_PERIOD ) VALUES ('TI1','a1b2c3d4','UDAYANGA','DEVELOPER','CON1',NULL,'2012-01-01','SANDBOXHASH','ACTIVE',1343714931875); +INSERT INTO IDN_OAUTH2_ACCESS_TOKEN ( TOKEN_ID, ACCESS_TOKEN ,AUTHZ_USER , USER_TYPE , CONSUMER_KEY , REFRESH_TOKEN ,TIME_CREATED , TOKEN_SCOPE_HASH , TOKEN_STATE ,VALIDITY_PERIOD ) VALUES ('TI2','p1q2r3s4','UDAYANGA','DEVELOPER','CON1',NULL,'2012-01-01','PRODUCTIONHASH','ACTIVE',1343714931875); +INSERT INTO IDN_OAUTH2_ACCESS_TOKEN ( TOKEN_ID, ACCESS_TOKEN ,AUTHZ_USER , USER_TYPE , CONSUMER_KEY , REFRESH_TOKEN ,TIME_CREATED , TOKEN_SCOPE_HASH , TOKEN_STATE ,VALIDITY_PERIOD ) VALUES ('TI3','test1','UDAYANGA','DEVELOPER','CON1',NULL,'2012-01-01','PRODUCTIONHASH','ACTIVE',1343714931875); +INSERT INTO IDN_OAUTH2_ACCESS_TOKEN ( TOKEN_ID, ACCESS_TOKEN ,AUTHZ_USER , USER_TYPE , CONSUMER_KEY , REFRESH_TOKEN ,TIME_CREATED , TOKEN_SCOPE_HASH , TOKEN_STATE ,VALIDITY_PERIOD ) VALUES ('TI4','test2','UDAYANGA','DEVELOPER','CON2',NULL,'2012-01-01','SANDBOXHASH','ACTIVE',1343714931875); +INSERT INTO IDN_OAUTH2_ACCESS_TOKEN ( TOKEN_ID, ACCESS_TOKEN ,AUTHZ_USER , USER_TYPE , CONSUMER_KEY , REFRESH_TOKEN ,TIME_CREATED , TOKEN_SCOPE_HASH , TOKEN_STATE ,VALIDITY_PERIOD ) VALUES ('TI5','test3','UDAYANGA','DEVELOPER','CON3',NULL,'2012-01-01','PRODUCTIONHASH','ACTIVE',3600); + +INSERT INTO IDN_OAUTH2_SCOPE_ASSOCIATION (TOKEN_ID, TOKEN_SCOPE ) VALUES ('TI1','SANDBOX') +INSERT INTO IDN_OAUTH2_SCOPE_ASSOCIATION (TOKEN_ID, TOKEN_SCOPE ) VALUES ('TI2','PRODUCTION') +INSERT INTO IDN_OAUTH2_SCOPE_ASSOCIATION (TOKEN_ID, TOKEN_SCOPE ) VALUES ('TI3','PRODUCTION') +INSERT INTO IDN_OAUTH2_SCOPE_ASSOCIATION (TOKEN_ID, TOKEN_SCOPE ) VALUES ('TI4','SANDBOX') +INSERT INTO IDN_OAUTH2_SCOPE_ASSOCIATION (TOKEN_ID, TOKEN_SCOPE ) VALUES ('TI5','PRODUCTION') + +SELECT * FROM AM_SUBSCRIBER; +SELECT * FROM AM_APPLICATION; +SELECT * FROM AM_SUBSCRIPTION; diff --git a/modules/distribution/src/api-resource/sql/h2.sql b/modules/distribution/src/api-resource/sql/h2.sql new file mode 100644 index 00000000..43ad387d --- /dev/null +++ b/modules/distribution/src/api-resource/sql/h2.sql @@ -0,0 +1,735 @@ +-- Start of IDN Tables -- +CREATE TABLE IF NOT EXISTS IDN_BASE_TABLE ( + PRODUCT_NAME VARCHAR (20), + PRIMARY KEY (PRODUCT_NAME) +); + +INSERT INTO IDN_BASE_TABLE values ('WSO2 Identity Server'); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH_CONSUMER_APPS ( + ID INTEGER NOT NULL AUTO_INCREMENT, + CONSUMER_KEY VARCHAR (255), + CONSUMER_SECRET VARCHAR (512), + USERNAME VARCHAR (255), + TENANT_ID INTEGER DEFAULT 0, + APP_NAME VARCHAR (255), + OAUTH_VERSION VARCHAR (128), + CALLBACK_URL VARCHAR (1024), + GRANT_TYPES VARCHAR (1024), + CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY), + PRIMARY KEY (ID) +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_REQUEST_TOKEN ( + REQUEST_TOKEN VARCHAR (512), + REQUEST_TOKEN_SECRET VARCHAR (512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR (1024), + SCOPE VARCHAR(2048), + AUTHORIZED VARCHAR (128), + OAUTH_VERIFIER VARCHAR (512), + AUTHZ_USER VARCHAR (512), + PRIMARY KEY (REQUEST_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_ACCESS_TOKEN ( + ACCESS_TOKEN VARCHAR (512), + ACCESS_TOKEN_SECRET VARCHAR (512), + CONSUMER_KEY_ID INTEGER, + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR (512), + PRIMARY KEY (ACCESS_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN ( + TOKEN_ID VARCHAR (255), + ACCESS_TOKEN VARCHAR (255), + REFRESH_TOKEN VARCHAR (255), + CONSUMER_KEY_ID INTEGER, + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + USER_TYPE VARCHAR (25), + TIME_CREATED TIMESTAMP DEFAULT 0, + REFRESH_TOKEN_TIME_CREATED TIMESTAMP DEFAULT 0, + VALIDITY_PERIOD BIGINT, + REFRESH_TOKEN_VALIDITY_PERIOD BIGINT, + TOKEN_SCOPE_HASH VARCHAR (32), + TOKEN_STATE VARCHAR (25) DEFAULT 'ACTIVE', + TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE', + PRIMARY KEY (TOKEN_ID), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE, + CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TENANT_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH, + TOKEN_STATE,TOKEN_STATE_ID) +); + +CREATE INDEX IDX_AT_CK_AU ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TOKEN_STATE, USER_TYPE); + +CREATE INDEX IDX_TC ON IDN_OAUTH2_ACCESS_TOKEN(TIME_CREATED); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHORIZATION_CODE ( + AUTHORIZATION_CODE VARCHAR (512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR (1024), + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + TIME_CREATED TIMESTAMP, + VALIDITY_PERIOD BIGINT, + STATE VARCHAR (25) DEFAULT 'ACTIVE', + TOKEN_ID VARCHAR(255), + PRIMARY KEY (AUTHORIZATION_CODE), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE_ASSOCIATION ( + TOKEN_ID VARCHAR (255), + TOKEN_SCOPE VARCHAR (60), + PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), + FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE ( + SCOPE_ID INTEGER NOT NULL AUTO_INCREMENT, + SCOPE_KEY VARCHAR(100) NOT NULL, + NAME VARCHAR(255) NULL, + DESCRIPTION VARCHAR(512) NULL, + TENANT_ID INTEGER NOT NULL DEFAULT 0, + ROLES VARCHAR (500) NULL, + PRIMARY KEY (SCOPE_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_RESOURCE_SCOPE ( + RESOURCE_PATH VARCHAR(255) NOT NULL, + SCOPE_ID INTEGER (11) NOT NULL, + PRIMARY KEY (RESOURCE_PATH), + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_SCIM_GROUP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + ROLE_NAME VARCHAR(255) NOT NULL, + ATTR_NAME VARCHAR(1024) NOT NULL, + ATTR_VALUE VARCHAR(1024), + PRIMARY KEY (ID) +); + +CREATE TABLE IF NOT EXISTS IDN_OPENID_REMEMBER_ME ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID + + + + INTEGER DEFAULT 0, + COOKIE_VALUE VARCHAR(1024), + CREATED_TIME TIMESTAMP, + PRIMARY KEY (USER_NAME, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_OPENID_USER_RPS ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + RP_URL VARCHAR(255) NOT NULL, + TRUSTED_ALWAYS VARCHAR(128) DEFAULT 'FALSE', + LAST_VISIT DATE NOT NULL, + VISIT_COUNT INTEGER DEFAULT 0, + DEFAULT_PROFILE_NAME VARCHAR(255) DEFAULT 'DEFAULT', + PRIMARY KEY (USER_NAME, TENANT_ID, RP_URL) +); + +CREATE TABLE IF NOT EXISTS IDN_OPENID_ASSOCIATIONS ( + HANDLE VARCHAR(255) NOT NULL, + ASSOC_TYPE VARCHAR(255) NOT NULL, + EXPIRE_IN TIMESTAMP NOT NULL, + MAC_KEY VARCHAR(255) NOT NULL, + ASSOC_STORE VARCHAR(128) DEFAULT 'SHARED', + PRIMARY KEY (HANDLE) +); + +CREATE TABLE IDN_STS_STORE ( + ID INTEGER AUTO_INCREMENT, + TOKEN_ID VARCHAR(255) NOT NULL, + TOKEN_CONTENT BLOB NOT NULL, + CREATE_DATE TIMESTAMP NOT NULL, + EXPIRE_DATE TIMESTAMP NOT NULL, + STATE INTEGER DEFAULT 0, + PRIMARY KEY (ID) +); + +CREATE TABLE IDN_IDENTITY_USER_DATA ( + TENANT_ID INTEGER DEFAULT -1234, + USER_NAME VARCHAR(255) NOT NULL, + DATA_KEY VARCHAR(255) NOT NULL, + DATA_VALUE VARCHAR(255), + PRIMARY KEY (TENANT_ID, USER_NAME, DATA_KEY) +); + +CREATE TABLE IDN_IDENTITY_META_DATA ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + METADATA_TYPE VARCHAR(255) NOT NULL, + METADATA VARCHAR(255) NOT NULL, + VALID VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, USER_NAME, METADATA_TYPE,METADATA) +); + +CREATE TABLE IF NOT EXISTS IDN_THRIFT_SESSION ( + SESSION_ID VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + CREATED_TIME VARCHAR(255) NOT NULL, + LAST_MODIFIED_TIME VARCHAR(255) NOT NULL, + PRIMARY KEY (SESSION_ID) +); + +CREATE TABLE IDN_AUTH_SESSION_STORE ( + SESSION_ID VARCHAR (100) NOT NULL, + SESSION_TYPE VARCHAR(100) NOT NULL, + SESSION_OBJECT BLOB, + TIME_CREATED TIMESTAMP, + PRIMARY KEY (SESSION_ID, SESSION_TYPE) +); +CREATE TABLE IF NOT EXISTS SP_APP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + APP_NAME VARCHAR (255) NOT NULL , + USER_STORE VARCHAR (255) NOT NULL, + USERNAME VARCHAR (255) NOT NULL , + DESCRIPTION VARCHAR (1024), + ROLE_CLAIM VARCHAR (512), + AUTH_TYPE VARCHAR (255) NOT NULL, + PROVISIONING_USERSTORE_DOMAIN VARCHAR (512), + IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '1', + IS_SEND_LOCAL_SUBJECT_ID CHAR(1) DEFAULT '0', + IS_SEND_AUTH_LIST_OF_IDPS CHAR(1) DEFAULT '0', + IS_USE_TENANT_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + IS_USE_USER_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + SUBJECT_CLAIM_URI VARCHAR (512), + IS_SAAS_APP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID); + +CREATE TABLE IF NOT EXISTS SP_INBOUND_AUTH ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + INBOUND_AUTH_KEY VARCHAR (255) NOT NULL, + INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL, + PROP_NAME VARCHAR (255), + PROP_VALUE VARCHAR (1024) , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_AUTH_STEP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + STEP_ORDER INTEGER DEFAULT 1, + APP_ID INTEGER NOT NULL , + IS_SUBJECT_STEP CHAR(1) DEFAULT '0', + IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_FEDERATED_IDP ( + ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_ID INTEGER NOT NULL, + PRIMARY KEY (ID, AUTHENTICATOR_ID)); + +ALTER TABLE SP_FEDERATED_IDP ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_CLAIM_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_CLAIM VARCHAR (512) NOT NULL , + SP_CLAIM VARCHAR (512) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_REQUESTED VARCHAR(128) DEFAULT '0', + DEFAULT_VALUE VARCHAR(255), + PRIMARY KEY (ID)); + +ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_ROLE_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_ROLE VARCHAR (255) NOT NULL , + SP_ROLE VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_REQ_PATH_AUTHENTICATOR ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_PROVISIONING_CONNECTOR ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_NAME VARCHAR (255) NOT NULL , + CONNECTOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_JIT_ENABLED CHAR(1) NOT NULL DEFAULT '0', + BLOCKING CHAR(1) NOT NULL DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS IDP ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + NAME VARCHAR(254) NOT NULL, + IS_ENABLED CHAR(1) NOT NULL DEFAULT '1', + IS_PRIMARY CHAR(1) NOT NULL DEFAULT '0', + HOME_REALM_ID VARCHAR(254), + IMAGE MEDIUMBLOB, + CERTIFICATE BLOB, + ALIAS VARCHAR(254), + INBOUND_PROV_ENABLED CHAR (1) NOT NULL DEFAULT '0', + INBOUND_PROV_USER_STORE_ID VARCHAR(254), + USER_CLAIM_URI VARCHAR(254), + ROLE_CLAIM_URI VARCHAR(254), + DESCRIPTION VARCHAR (1024), + DEFAULT_AUTHENTICATOR_NAME VARCHAR(254), + DEFAULT_PRO_CONNECTOR_NAME VARCHAR(254), + PROVISIONING_ROLE VARCHAR(128), + IS_FEDERATION_HUB CHAR(1) NOT NULL DEFAULT '0', + IS_LOCAL_CLAIM_DIALECT CHAR(1) NOT NULL DEFAULT '0', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, NAME)); + +INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost'); + +CREATE TABLE IF NOT EXISTS IDP_ROLE ( + ID INTEGER AUTO_INCREMENT, + IDP_ID INTEGER, + TENANT_ID INTEGER, + ROLE VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, ROLE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_ROLE_MAPPING ( + ID INTEGER AUTO_INCREMENT, + IDP_ROLE_ID INTEGER, + TENANT_ID INTEGER, + USER_STORE_ID VARCHAR (253), + LOCAL_ROLE VARCHAR(253), + PRIMARY KEY (ID), + UNIQUE (IDP_ROLE_ID, TENANT_ID, USER_STORE_ID, LOCAL_ROLE), + FOREIGN KEY (IDP_ROLE_ID) REFERENCES IDP_ROLE(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_CLAIM ( + ID INTEGER AUTO_INCREMENT, + IDP_ID INTEGER, + TENANT_ID INTEGER, + CLAIM VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, CLAIM), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_CLAIM_MAPPING ( + ID INTEGER AUTO_INCREMENT, + IDP_CLAIM_ID INTEGER, + TENANT_ID INTEGER, + LOCAL_CLAIM VARCHAR(253), + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (IDP_CLAIM_ID, TENANT_ID, LOCAL_CLAIM), + FOREIGN KEY (IDP_CLAIM_ID) REFERENCES IDP_CLAIM(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + NAME VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '1', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, NAME), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'samlsso'); +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'IDPProperties'); + +CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR_PROPERTY ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + AUTHENTICATOR_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2047), + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY), + FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE); + +INSERT INTO IDP_AUTHENTICATOR_PROPERTY (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY,PROPERTY_VALUE, IS_SECRET ) VALUES (-1234, 1 , 'IdPEntityId', 'localhost', '0'); + +CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_CONFIG ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + PROVISIONING_CONNECTOR_TYPE VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '0', + IS_BLOCKING CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, PROVISIONING_CONNECTOR_TYPE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_PROV_CONFIG_PROPERTY ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + PROVISIONING_CONFIG_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2048), + PROPERTY_BLOB_VALUE BLOB, + PROPERTY_TYPE CHAR(32) NOT NULL, + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, PROVISIONING_CONFIG_ID, PROPERTY_KEY), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_ENTITY ( + ID INTEGER AUTO_INCREMENT, + PROVISIONING_CONFIG_ID INTEGER, + ENTITY_TYPE VARCHAR(255) NOT NULL, + ENTITY_LOCAL_USERSTORE VARCHAR(255) NOT NULL, + ENTITY_NAME VARCHAR(255) NOT NULL, + ENTITY_VALUE VARCHAR(255), + TENANT_ID INTEGER, + PRIMARY KEY (ID), + UNIQUE (ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID), + UNIQUE (PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_LOCAL_CLAIM ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + CLAIM_URI VARCHAR(255) NOT NULL, + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, CLAIM_URI), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDN_ASSOCIATED_ID ( + ID INTEGER AUTO_INCREMENT, + IDP_USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + IDP_ID INTEGER NOT NULL, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (ID), + UNIQUE(IDP_USER_ID, TENANT_ID, IDP_ID), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_USER_ACCOUNT_ASSOCIATION ( + ASSOCIATION_KEY VARCHAR(255) NOT NULL, + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME)); + +CREATE TABLE IF NOT EXISTS FIDO_DEVICE_STORE ( + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(45) NOT NULL, + TIME_REGISTERED TIMESTAMP, + KEY_HANDLE VARCHAR(200) NOT NULL, + DEVICE_DATA LONGVARCHAR NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE)); + +CREATE TABLE IF NOT EXISTS WF_REQUEST ( + UUID VARCHAR (45), + CREATED_BY VARCHAR (255), + TENANT_ID INTEGER DEFAULT -1, + OPERATION_TYPE VARCHAR (50), + CREATED_AT TIMESTAMP, + UPDATED_AT TIMESTAMP, + STATUS VARCHAR (30), + REQUEST BLOB, + PRIMARY KEY (UUID) +); + +CREATE TABLE IF NOT EXISTS WF_BPS_PROFILE ( + PROFILE_NAME VARCHAR(45), + HOST_URL VARCHAR(45), + USERNAME VARCHAR(45), + PASSWORD VARCHAR(255), + CALLBACK_HOST VARCHAR (45), + CALLBACK_USERNAME VARCHAR (45), + CALLBACK_PASSWORD VARCHAR (255), + TENANT_ID VARCHAR (45), + PRIMARY KEY (PROFILE_NAME, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS WF_WORKFLOW( + ID VARCHAR (45), + WF_NAME VARCHAR (45), + DESCRIPTION VARCHAR (255), + TEMPLATE_ID VARCHAR (45), + IMPL_ID VARCHAR (45), + TENANT_ID VARCHAR (45), + PRIMARY KEY (ID) +); + +CREATE TABLE IF NOT EXISTS WF_WORKFLOW_ASSOCIATION( + ID INTEGER NOT NULL AUTO_INCREMENT, + ASSOC_NAME VARCHAR (45), + EVENT_ID VARCHAR(45), + ASSOC_CONDITION VARCHAR (2000), + WORKFLOW_ID VARCHAR (45), + IS_ENABLED CHAR (1) DEFAULT '1', + PRIMARY KEY(ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS WF_WORKFLOW_CONFIG_PARAM( + WORKFLOW_ID VARCHAR (45), + PARAM_NAME VARCHAR (45), + PARAM_VALUE VARCHAR (1000), + PRIMARY KEY (WORKFLOW_ID, PARAM_NAME), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS WF_REQUEST_ENTITY_RELATIONSHIP( + REQUEST_ID VARCHAR (45), + ENTITY_NAME VARCHAR (255), + ENTITY_TYPE VARCHAR (50), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY(REQUEST_ID, ENTITY_NAME, ENTITY_TYPE, TENANT_ID), + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS WORKFLOW_REQUEST_RELATION( + RELATIONSHIP_ID VARCHAR (45), + WORKFLOW_ID VARCHAR (45), + REQUEST_ID VARCHAR (45), + UPDATED_AT TIMESTAMP, + STATUS VARCHAR (30), + PRIMARY KEY (RELATIONSHIP_ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE, + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE +); + +-- Start of API-MGT Tables -- + +CREATE TABLE IF NOT EXISTS AM_SUBSCRIBER ( + SUBSCRIBER_ID INTEGER AUTO_INCREMENT, + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EMAIL_ADDRESS VARCHAR(256) NULL, + DATE_SUBSCRIBED TIMESTAMP NOT NULL, + PRIMARY KEY (SUBSCRIBER_ID), + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + UNIQUE (TENANT_ID,USER_ID) +); + +CREATE TABLE IF NOT EXISTS AM_APPLICATION ( + APPLICATION_ID INTEGER AUTO_INCREMENT, + NAME VARCHAR(100), + SUBSCRIBER_ID INTEGER, + APPLICATION_TIER VARCHAR(50) DEFAULT 'Unlimited', + CALLBACK_URL VARCHAR(512), + DESCRIPTION VARCHAR(512), + APPLICATION_STATUS VARCHAR(50) DEFAULT 'APPROVED', + GROUP_ID VARCHAR(100), + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY(APPLICATION_ID), + UNIQUE (NAME,SUBSCRIBER_ID) +); + +CREATE TABLE IF NOT EXISTS AM_API ( + API_ID INTEGER AUTO_INCREMENT, + API_PROVIDER VARCHAR(256), + API_NAME VARCHAR(256), + API_VERSION VARCHAR(30), + CONTEXT VARCHAR(256), + CONTEXT_TEMPLATE VARCHAR(256), + PRIMARY KEY(API_ID), + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + UNIQUE (API_PROVIDER,API_NAME,API_VERSION) +); + +CREATE TABLE IF NOT EXISTS AM_API_URL_MAPPING ( + URL_MAPPING_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER NOT NULL, + HTTP_METHOD VARCHAR(20) NULL, + AUTH_SCHEME VARCHAR(50) NULL, + URL_PATTERN VARCHAR(512) NULL, + THROTTLING_TIER varchar(512) DEFAULT NULL, + MEDIATION_SCRIPT BLOB DEFAULT NULL, + PRIMARY KEY(URL_MAPPING_ID) +); + + +CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION ( + SUBSCRIPTION_ID INTEGER AUTO_INCREMENT, + TIER_ID VARCHAR(50), + API_ID INTEGER, + LAST_ACCESSED TIMESTAMP NULL, + APPLICATION_ID INTEGER, + SUB_STATUS VARCHAR(50), + SUBS_CREATE_STATE VARCHAR(50) DEFAULT 'SUBSCRIBE', + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (SUBSCRIPTION_ID) +); + +CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION_KEY_MAPPING ( + SUBSCRIPTION_ID INTEGER, + ACCESS_TOKEN VARCHAR(512), + KEY_TYPE VARCHAR(512) NOT NULL, + FOREIGN KEY(SUBSCRIPTION_ID) REFERENCES AM_SUBSCRIPTION(SUBSCRIPTION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY(SUBSCRIPTION_ID,ACCESS_TOKEN) +); + +CREATE TABLE IF NOT EXISTS AM_APPLICATION_KEY_MAPPING ( + APPLICATION_ID INTEGER, + CONSUMER_KEY VARCHAR(512), + KEY_TYPE VARCHAR(512) NOT NULL, + STATE VARCHAR(30) NOT NULL, + CREATE_MODE VARCHAR(30) DEFAULT 'CREATED', + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY(APPLICATION_ID,KEY_TYPE) +); + +CREATE TABLE IF NOT EXISTS AM_API_LC_EVENT ( + EVENT_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER NOT NULL, + PREVIOUS_STATE VARCHAR(50), + NEW_STATE VARCHAR(50) NOT NULL, + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EVENT_DATE TIMESTAMP NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (EVENT_ID) +); + +CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING ( + CONSUMER_KEY VARCHAR(255), + AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL', + PRIMARY KEY (CONSUMER_KEY,AUTHZ_DOMAIN) +); + +CREATE TABLE IF NOT EXISTS AM_API_COMMENTS ( + COMMENT_ID INTEGER AUTO_INCREMENT, + COMMENT_TEXT VARCHAR(512), + COMMENTED_USER VARCHAR(255), + DATE_COMMENTED TIMESTAMP NOT NULL, + API_ID INTEGER NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (COMMENT_ID) +); + +CREATE TABLE IF NOT EXISTS AM_API_RATINGS( + RATING_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER, + RATING INTEGER, + SUBSCRIBER_ID INTEGER, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (RATING_ID) +); + +CREATE TABLE IF NOT EXISTS AM_TIER_PERMISSIONS ( + TIER_PERMISSIONS_ID INTEGER AUTO_INCREMENT, + TIER VARCHAR(50) NOT NULL, + PERMISSIONS_TYPE VARCHAR(50) NOT NULL, + ROLES VARCHAR(512) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(TIER_PERMISSIONS_ID) +); + +CREATE TABLE IF NOT EXISTS AM_EXTERNAL_STORES( + APISTORE_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER, + STORE_ID VARCHAR(255) NOT NULL, + STORE_DISPLAY_NAME VARCHAR(255) NOT NULL, + STORE_ENDPOINT VARCHAR(255) NOT NULL, + STORE_TYPE VARCHAR(255) NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (APISTORE_ID) +); + +CREATE TABLE IF NOT EXISTS AM_WORKFLOWS( + WF_ID INTEGER AUTO_INCREMENT, + WF_REFERENCE VARCHAR(255) NOT NULL, + WF_TYPE VARCHAR(255) NOT NULL, + WF_STATUS VARCHAR(255) NOT NULL, + WF_CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + WF_UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP , + WF_STATUS_DESC VARCHAR(1000), + TENANT_ID INTEGER, + TENANT_DOMAIN VARCHAR(255), + WF_EXTERNAL_REFERENCE VARCHAR(255) NOT NULL, + PRIMARY KEY (WF_ID), + UNIQUE (WF_EXTERNAL_REFERENCE) +); + +CREATE TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION ( + REG_ID INT AUTO_INCREMENT, + SUBSCRIBER_ID INT, + WF_REF VARCHAR(255) NOT NULL, + APP_ID INT, + TOKEN_TYPE VARCHAR(30), + TOKEN_SCOPE VARCHAR(256) DEFAULT 'default', + INPUTS VARCHAR(1000), + ALLOWED_DOMAINS VARCHAR(256), + VALIDITY_PERIOD BIGINT, + UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE), + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (REG_ID) +); + +CREATE TABLE IF NOT EXISTS AM_API_SCOPES ( + API_ID INTEGER NOT NULL, + SCOPE_ID INTEGER NOT NULL, + FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE ON UPDATE CASCADE +); + +CREATE TABLE IF NOT EXISTS AM_API_DEFAULT_VERSION ( + DEFAULT_VERSION_ID INT AUTO_INCREMENT, + API_NAME VARCHAR(256) NOT NULL , + API_PROVIDER VARCHAR(256) NOT NULL , + DEFAULT_API_VERSION VARCHAR(30) , + PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) , + PRIMARY KEY (DEFAULT_VERSION_ID) +); + + +CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID); + +-- End of API-MGT Tables -- diff --git a/modules/distribution/src/api-resource/sql/mssql.sql b/modules/distribution/src/api-resource/sql/mssql.sql new file mode 100644 index 00000000..1f2ed3b6 --- /dev/null +++ b/modules/distribution/src/api-resource/sql/mssql.sql @@ -0,0 +1,815 @@ +-- Start of IDENTITY Tables -- +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_BASE_TABLE]') AND TYPE IN (N'U')) +CREATE TABLE IDN_BASE_TABLE ( + PRODUCT_NAME VARCHAR(20), + PRIMARY KEY (PRODUCT_NAME) +); + +INSERT INTO IDN_BASE_TABLE values ('WSO2 Identity Server'); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH_CONSUMER_APPS]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OAUTH_CONSUMER_APPS ( + ID INTEGER IDENTITY, + CONSUMER_KEY VARCHAR(255), + CONSUMER_SECRET VARCHAR(512), + USERNAME VARCHAR(255), + TENANT_ID INTEGER DEFAULT 0, + APP_NAME VARCHAR(255), + OAUTH_VERSION VARCHAR(128), + CALLBACK_URL VARCHAR(1024), + GRANT_TYPES VARCHAR(1024), + CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY), + PRIMARY KEY (ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH1A_REQUEST_TOKEN]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OAUTH1A_REQUEST_TOKEN ( + REQUEST_TOKEN VARCHAR(512), + REQUEST_TOKEN_SECRET VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR(1024), + SCOPE VARCHAR(2048), + AUTHORIZED VARCHAR(128), + OAUTH_VERIFIER VARCHAR(512), + AUTHZ_USER VARCHAR(512), + PRIMARY KEY (REQUEST_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH1A_ACCESS_TOKEN]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OAUTH1A_ACCESS_TOKEN ( + ACCESS_TOKEN VARCHAR(512), + ACCESS_TOKEN_SECRET VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR(512), + PRIMARY KEY (ACCESS_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH2_ACCESS_TOKEN]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OAUTH2_ACCESS_TOKEN ( + TOKEN_ID VARCHAR (255), + ACCESS_TOKEN VARCHAR(255), + REFRESH_TOKEN VARCHAR(255), + CONSUMER_KEY_ID INTEGER, + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + USER_TYPE VARCHAR (25), + TIME_CREATED DATETIME, + REFRESH_TOKEN_TIME_CREATED DATETIME, + VALIDITY_PERIOD BIGINT, + REFRESH_TOKEN_VALIDITY_PERIOD BIGINT, + TOKEN_SCOPE_HASH VARCHAR(32), + TOKEN_STATE VARCHAR(25) DEFAULT 'ACTIVE', + TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE', + PRIMARY KEY (TOKEN_ID), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE, + CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TENANT_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH, + TOKEN_STATE,TOKEN_STATE_ID) +); + +CREATE INDEX IDX_AT_CK_AU ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TOKEN_STATE, USER_TYPE); + +CREATE INDEX IDX_TC ON IDN_OAUTH2_ACCESS_TOKEN(TIME_CREATED); + +IF EXISTS (SELECT NAME FROM SYSINDEXES WHERE NAME = 'IDX_AT_CK_AU') +DROP INDEX IDN_OAUTH2_ACCESS_TOKEN.IDX_AT_CK_AU + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH2_AUTHORIZATION_CODE]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OAUTH2_AUTHORIZATION_CODE ( + AUTHORIZATION_CODE VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR(1024), + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + TIME_CREATED DATETIME, + VALIDITY_PERIOD BIGINT, + STATE VARCHAR (25) DEFAULT 'ACTIVE', + TOKEN_ID VARCHAR(255), + PRIMARY KEY (AUTHORIZATION_CODE), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH2_SCOPE_ASSOCIATION]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OAUTH2_SCOPE_ASSOCIATION ( + TOKEN_ID VARCHAR (255), + TOKEN_SCOPE VARCHAR (60), + PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), + FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH2_SCOPE]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OAUTH2_SCOPE ( + SCOPE_ID INTEGER IDENTITY, + SCOPE_KEY VARCHAR(100) NOT NULL, + NAME VARCHAR(255) NULL, + DESCRIPTION VARCHAR(512) NULL, + TENANT_ID INTEGER NOT NULL DEFAULT 0, + ROLES VARCHAR (500) NULL, + PRIMARY KEY (SCOPE_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH2_RESOURCE_SCOPE]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OAUTH2_RESOURCE_SCOPE ( + RESOURCE_PATH VARCHAR(255) NOT NULL, + SCOPE_ID INTEGER NOT NULL, + PRIMARY KEY (RESOURCE_PATH), + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_SCIM_GROUP]') AND TYPE IN (N'U')) +CREATE TABLE IDN_SCIM_GROUP ( + ID INTEGER IDENTITY, + TENANT_ID INTEGER NOT NULL, + ROLE_NAME VARCHAR(255) NOT NULL, + ATTR_NAME VARCHAR(1024) NOT NULL, + ATTR_VALUE VARCHAR(1024), + PRIMARY KEY (ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OPENID_REMEMBER_ME]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OPENID_REMEMBER_ME ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + COOKIE_VALUE VARCHAR(1024), + CREATED_TIME DATETIME, + PRIMARY KEY (USER_NAME, TENANT_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OPENID_USER_RPS]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OPENID_USER_RPS ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + RP_URL VARCHAR(255) NOT NULL, + TRUSTED_ALWAYS VARCHAR(128) DEFAULT 'FALSE', + LAST_VISIT DATE NOT NULL, + VISIT_COUNT INTEGER DEFAULT 0, + DEFAULT_PROFILE_NAME VARCHAR(255) DEFAULT 'DEFAULT', + PRIMARY KEY (USER_NAME, TENANT_ID, RP_URL) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OPENID_ASSOCIATIONS]') AND TYPE IN (N'U')) +CREATE TABLE IDN_OPENID_ASSOCIATIONS ( + HANDLE VARCHAR(255) NOT NULL, + ASSOC_TYPE VARCHAR(255) NOT NULL, + EXPIRE_IN DATETIME NOT NULL, + MAC_KEY VARCHAR(255) NOT NULL, + ASSOC_STORE VARCHAR(128) DEFAULT 'SHARED', + PRIMARY KEY (HANDLE) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_STS_STORE]') AND TYPE IN (N'U')) +CREATE TABLE IDN_STS_STORE ( + ID INTEGER IDENTITY, + TOKEN_ID VARCHAR(255) NOT NULL, + TOKEN_CONTENT VARBINARY(MAX) NOT NULL, + CREATE_DATE DATETIME NOT NULL, + EXPIRE_DATE DATETIME NOT NULL, + STATE INTEGER DEFAULT 0, + PRIMARY KEY (ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_IDENTITY_USER_DATA]') AND TYPE IN (N'U')) +CREATE TABLE IDN_IDENTITY_USER_DATA ( + TENANT_ID INTEGER DEFAULT -1234, + USER_NAME VARCHAR(255) NOT NULL, + DATA_KEY VARCHAR(255) NOT NULL, + DATA_VALUE VARCHAR(255), + PRIMARY KEY (TENANT_ID, USER_NAME, DATA_KEY) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_IDENTITY_META_DATA]') AND TYPE IN (N'U')) +CREATE TABLE IDN_IDENTITY_META_DATA ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + METADATA_TYPE VARCHAR(255) NOT NULL, + METADATA VARCHAR(255) NOT NULL, + VALID VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, USER_NAME, METADATA_TYPE,METADATA) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_THRIFT_SESSION]') AND TYPE IN (N'U')) +CREATE TABLE IDN_THRIFT_SESSION ( + SESSION_ID VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + CREATED_TIME VARCHAR(255) NOT NULL, + LAST_MODIFIED_TIME VARCHAR(255) NOT NULL, + PRIMARY KEY (SESSION_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_AUTH_SESSION_STORE]') AND TYPE IN (N'U')) +CREATE TABLE IDN_AUTH_SESSION_STORE ( + SESSION_ID VARCHAR (100) NOT NULL, + SESSION_TYPE VARCHAR(100) NOT NULL, + SESSION_OBJECT VARBINARY(MAX), + TIME_CREATED DATETIME, + PRIMARY KEY (SESSION_ID, SESSION_TYPE) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_APP]') AND TYPE IN (N'U')) +CREATE TABLE SP_APP ( + ID INTEGER NOT NULL IDENTITY, + TENANT_ID INTEGER NOT NULL, + APP_NAME VARCHAR (255) NOT NULL , + USER_STORE VARCHAR (255) NOT NULL, + USERNAME VARCHAR (255) NOT NULL , + DESCRIPTION VARCHAR (1024), + ROLE_CLAIM VARCHAR (512), + AUTH_TYPE VARCHAR (255) NOT NULL, + PROVISIONING_USERSTORE_DOMAIN VARCHAR (512), + IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '1', + IS_SEND_LOCAL_SUBJECT_ID CHAR(1) DEFAULT '0', + IS_SEND_AUTH_LIST_OF_IDPS CHAR(1) DEFAULT '0', + IS_USE_TENANT_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + IS_USE_USER_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + SUBJECT_CLAIM_URI VARCHAR (512), + IS_SAAS_APP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_INBOUND_AUTH]') AND TYPE IN (N'U')) +CREATE TABLE SP_INBOUND_AUTH ( + ID INTEGER NOT NULL IDENTITY, + TENANT_ID INTEGER NOT NULL, + INBOUND_AUTH_KEY VARCHAR (255) NOT NULL, + INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL, + PROP_NAME VARCHAR (255), + PROP_VALUE VARCHAR (1024) , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_AUTH_STEP]') AND TYPE IN (N'U')) +CREATE TABLE SP_AUTH_STEP ( + ID INTEGER NOT NULL IDENTITY, + TENANT_ID INTEGER NOT NULL, + STEP_ORDER INTEGER DEFAULT 1, + APP_ID INTEGER NOT NULL, + IS_SUBJECT_STEP CHAR(1) DEFAULT '0', + IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_FEDERATED_IDP]') AND TYPE IN (N'U')) +CREATE TABLE SP_FEDERATED_IDP ( + ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_ID INTEGER NOT NULL, + PRIMARY KEY (ID, AUTHENTICATOR_ID)); + +ALTER TABLE SP_FEDERATED_IDP ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE; + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_CLAIM_MAPPING]') AND TYPE IN (N'U')) +CREATE TABLE SP_CLAIM_MAPPING ( + ID INTEGER NOT NULL IDENTITY, + TENANT_ID INTEGER NOT NULL, + IDP_CLAIM VARCHAR (512) NOT NULL , + SP_CLAIM VARCHAR (512) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_REQUESTED VARCHAR(128) DEFAULT '0', + DEFAULT_VALUE VARCHAR(255), + PRIMARY KEY (ID)); + +ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_ROLE_MAPPING]') AND TYPE IN (N'U')) +CREATE TABLE SP_ROLE_MAPPING ( + ID INTEGER NOT NULL IDENTITY, + TENANT_ID INTEGER NOT NULL, + IDP_ROLE VARCHAR (255) NOT NULL , + SP_ROLE VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_REQ_PATH_AUTHENTICATOR]') AND TYPE IN (N'U')) +CREATE TABLE SP_REQ_PATH_AUTHENTICATOR ( + ID INTEGER NOT NULL IDENTITY, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SP_PROVISIONING_CONNECTOR]') AND TYPE IN (N'U')) +CREATE TABLE SP_PROVISIONING_CONNECTOR ( + ID INTEGER NOT NULL IDENTITY, + TENANT_ID INTEGER NOT NULL, + IDP_NAME VARCHAR (255) NOT NULL , + CONNECTOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_JIT_ENABLED CHAR(1) NOT NULL DEFAULT '0', + BLOCKING CHAR(1) NOT NULL DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP]') AND TYPE IN (N'U')) +CREATE TABLE IDP ( + ID INTEGER IDENTITY, + TENANT_ID INTEGER, + NAME VARCHAR(254) NOT NULL, + IS_ENABLED CHAR(1) NOT NULL DEFAULT '1', + IS_PRIMARY CHAR(1) NOT NULL DEFAULT '0', + HOME_REALM_ID VARCHAR(254), + IMAGE VARBINARY(MAX), + CERTIFICATE VARBINARY(MAX), + ALIAS VARCHAR(254), + INBOUND_PROV_ENABLED CHAR (1) NOT NULL DEFAULT '0', + INBOUND_PROV_USER_STORE_ID VARCHAR(254), + USER_CLAIM_URI VARCHAR(254), + ROLE_CLAIM_URI VARCHAR(254), + DESCRIPTION VARCHAR (1024), + DEFAULT_AUTHENTICATOR_NAME VARCHAR(254), + DEFAULT_PRO_CONNECTOR_NAME VARCHAR(254), + PROVISIONING_ROLE VARCHAR(128), + IS_FEDERATION_HUB CHAR(1) NOT NULL DEFAULT '0', + IS_LOCAL_CLAIM_DIALECT CHAR(1) NOT NULL DEFAULT '0', + PRIMARY KEY (ID), + DISPLAY_NAME VARCHAR(255), + UNIQUE (TENANT_ID, NAME)); + +INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost'); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP_ROLE]') AND TYPE IN (N'U')) +CREATE TABLE IDP_ROLE ( + ID INTEGER IDENTITY, + IDP_ID INTEGER, + TENANT_ID INTEGER, + ROLE VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, ROLE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP_ROLE_MAPPING]') AND TYPE IN (N'U')) +CREATE TABLE IDP_ROLE_MAPPING ( + ID INTEGER IDENTITY, + IDP_ROLE_ID INTEGER, + TENANT_ID INTEGER, + USER_STORE_ID VARCHAR (253), + LOCAL_ROLE VARCHAR(253), + PRIMARY KEY (ID), + UNIQUE (IDP_ROLE_ID, TENANT_ID, USER_STORE_ID, LOCAL_ROLE), + FOREIGN KEY (IDP_ROLE_ID) REFERENCES IDP_ROLE(ID) ON DELETE CASCADE); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP_CLAIM]') AND TYPE IN (N'U')) +CREATE TABLE IDP_CLAIM ( + ID INTEGER IDENTITY, + IDP_ID INTEGER, + TENANT_ID INTEGER, + CLAIM VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, CLAIM), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP_CLAIM_MAPPING]') AND TYPE IN (N'U')) +CREATE TABLE IDP_CLAIM_MAPPING ( + ID INTEGER IDENTITY, + IDP_CLAIM_ID INTEGER, + TENANT_ID INTEGER, + LOCAL_CLAIM VARCHAR(253), + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (IDP_CLAIM_ID, TENANT_ID, LOCAL_CLAIM), + FOREIGN KEY (IDP_CLAIM_ID) REFERENCES IDP_CLAIM(ID) ON DELETE CASCADE); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP_AUTHENTICATOR]') AND TYPE IN (N'U')) +CREATE TABLE IDP_AUTHENTICATOR ( + ID INTEGER IDENTITY, + TENANT_ID INTEGER, + IDP_ID INTEGER, + NAME VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '1', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, NAME), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'samlsso'); +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'IDPProperties'); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP_AUTHENTICATOR_PROPERTY]') AND TYPE IN (N'U')) +CREATE TABLE IDP_AUTHENTICATOR_PROPERTY ( + ID INTEGER IDENTITY, + TENANT_ID INTEGER, + AUTHENTICATOR_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2047), + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY), + FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE); + +INSERT INTO IDP_AUTHENTICATOR_PROPERTY (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY,PROPERTY_VALUE, IS_SECRET ) VALUES (-1234, 1 , 'IdPEntityId', 'localhost', '0'); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP_PROVISIONING_CONFIG]') AND TYPE IN (N'U')) +CREATE TABLE IDP_PROVISIONING_CONFIG ( + ID INTEGER IDENTITY, + TENANT_ID INTEGER, + IDP_ID INTEGER, + PROVISIONING_CONNECTOR_TYPE VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '0', + IS_BLOCKING CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, PROVISIONING_CONNECTOR_TYPE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP_PROV_CONFIG_PROPERTY]') AND TYPE IN (N'U')) +CREATE TABLE IDP_PROV_CONFIG_PROPERTY ( + ID INTEGER IDENTITY, + TENANT_ID INTEGER, + PROVISIONING_CONFIG_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2048), + PROPERTY_BLOB_VALUE VARBINARY(MAX), + PROPERTY_TYPE CHAR(32) NOT NULL, + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, PROVISIONING_CONFIG_ID, PROPERTY_KEY), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP_PROVISIONING_ENTITY]') AND TYPE IN (N'U')) +CREATE TABLE IDP_PROVISIONING_ENTITY ( + ID INTEGER IDENTITY, + PROVISIONING_CONFIG_ID INTEGER, + ENTITY_TYPE VARCHAR(255) NOT NULL, + ENTITY_LOCAL_USERSTORE VARCHAR(255) NOT NULL, + ENTITY_NAME VARCHAR(255) NOT NULL, + ENTITY_VALUE VARCHAR(255), + TENANT_ID INTEGER, + PRIMARY KEY (ID), + UNIQUE (ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID), + UNIQUE (PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDP_LOCAL_CLAIM]') AND TYPE IN (N'U')) +CREATE TABLE IDP_LOCAL_CLAIM ( + ID INTEGER IDENTITY, + TENANT_ID INTEGER, + IDP_ID INTEGER, + CLAIM_URI VARCHAR(255) NOT NULL, + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, CLAIM_URI), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_ASSOCIATED_ID]') AND TYPE IN (N'U')) +CREATE TABLE IDN_ASSOCIATED_ID ( + ID INTEGER IDENTITY, + IDP_USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + IDP_ID INTEGER NOT NULL, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (ID), + UNIQUE(IDP_USER_ID, TENANT_ID, IDP_ID), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_USER_ACCOUNT_ASSOCIATION]') AND TYPE IN (N'U')) +CREATE TABLE IDN_USER_ACCOUNT_ASSOCIATION ( + ASSOCIATION_KEY VARCHAR(255) NOT NULL, + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME)); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[FIDO_DEVICE_STORE]') AND TYPE IN (N'U')) +CREATE TABLE FIDO_DEVICE_STORE ( + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(45) NOT NULL, + TIME_REGISTERED DATETIME, + KEY_HANDLE VARCHAR(200) NOT NULL, + DEVICE_DATA VARCHAR(2048) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE)); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WF_REQUEST]') AND TYPE IN (N'U')) +CREATE TABLE WF_REQUEST ( + UUID VARCHAR (45), + CREATED_BY VARCHAR (255), + TENANT_ID INTEGER DEFAULT -1, + OPERATION_TYPE VARCHAR (50), + CREATED_AT DATETIME, + UPDATED_AT DATETIME, + STATUS VARCHAR (30), + REQUEST VARBINARY(MAX), + PRIMARY KEY (UUID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WF_BPS_PROFILE]') AND TYPE IN (N'U')) +CREATE TABLE WF_BPS_PROFILE ( + PROFILE_NAME VARCHAR(45), + HOST_URL VARCHAR(45), + USERNAME VARCHAR(45), + PASSWORD VARCHAR(255), + CALLBACK_HOST VARCHAR (45), + CALLBACK_USERNAME VARCHAR (45), + CALLBACK_PASSWORD VARCHAR (255), + TENANT_ID VARCHAR (45), + PRIMARY KEY (PROFILE_NAME, TENANT_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WF_WORKFLOW]') AND TYPE IN (N'U')) +CREATE TABLE WF_WORKFLOW( + ID VARCHAR (45), + WF_NAME VARCHAR (45), + DESCRIPTION VARCHAR (255), + TEMPLATE_ID VARCHAR (45), + IMPL_ID VARCHAR (45), + TENANT_ID VARCHAR (45), + PRIMARY KEY (ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WF_WORKFLOW_ASSOCIATION]') AND TYPE IN (N'U')) +CREATE TABLE WF_WORKFLOW_ASSOCIATION( + ID INTEGER NOT NULL IDENTITY , + ASSOC_NAME VARCHAR (45), + EVENT_ID VARCHAR(45), + ASSOC_CONDITION VARCHAR (2000), + WORKFLOW_ID VARCHAR (45), + IS_ENABLED CHAR (1) DEFAULT '1', + PRIMARY KEY(ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WF_WORKFLOW_CONFIG_PARAM]') AND TYPE IN (N'U')) +CREATE TABLE WF_WORKFLOW_CONFIG_PARAM( + WORKFLOW_ID VARCHAR (45), + PARAM_NAME VARCHAR (45), + PARAM_VALUE VARCHAR (1000), + PRIMARY KEY (WORKFLOW_ID, PARAM_NAME), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WF_REQUEST_ENTITY_RELATIONSHIP]') AND TYPE IN (N'U')) +CREATE TABLE WF_REQUEST_ENTITY_RELATIONSHIP( + REQUEST_ID VARCHAR (45), + ENTITY_NAME VARCHAR (255), + ENTITY_TYPE VARCHAR (50), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY(REQUEST_ID, ENTITY_NAME, ENTITY_TYPE, TENANT_ID), + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WORKFLOW_REQUEST_RELATION]') AND TYPE IN (N'U')) +CREATE TABLE WORKFLOW_REQUEST_RELATION( + RELATIONSHIP_ID VARCHAR (45), + WORKFLOW_ID VARCHAR (45), + REQUEST_ID VARCHAR (45), + UPDATED_AT DATETIME, + STATUS VARCHAR (30), + PRIMARY KEY (RELATIONSHIP_ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE, + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE +); + +-- End of IDENTITY Tables-- + +-- Start of API-Mgt Tables -- + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_SUBSCRIBER]') AND TYPE IN (N'U')) + +CREATE TABLE AM_SUBSCRIBER ( + SUBSCRIBER_ID INTEGER IDENTITY(1,1), + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EMAIL_ADDRESS VARCHAR(256) NULL, + DATE_SUBSCRIBED DATETIME NOT NULL, + CREATED_BY VARCHAR(100), + CREATED_TIME DATETIME, + UPDATED_BY VARCHAR(100), + UPDATED_TIME DATETIME, + PRIMARY KEY (SUBSCRIBER_ID), + UNIQUE (TENANT_ID,USER_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_APPLICATION]') AND TYPE IN (N'U')) + +CREATE TABLE AM_APPLICATION ( + APPLICATION_ID INTEGER IDENTITY(1,1), + NAME VARCHAR(100), + SUBSCRIBER_ID INTEGER, + APPLICATION_TIER VARCHAR(50) DEFAULT 'Unlimited', + CALLBACK_URL VARCHAR(512), + DESCRIPTION VARCHAR(512), + GROUP_ID VARCHAR(100), + APPLICATION_STATUS VARCHAR(50) DEFAULT 'APPROVED', + CREATED_BY VARCHAR(100), + CREATED_TIME DATETIME, + UPDATED_BY VARCHAR(100), + UPDATED_TIME DATETIME, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE, + PRIMARY KEY(APPLICATION_ID), + UNIQUE (NAME,SUBSCRIBER_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_API]') AND TYPE IN (N'U')) + +CREATE TABLE AM_API ( + API_ID INTEGER IDENTITY(1,1), + API_PROVIDER VARCHAR(200), + API_NAME VARCHAR(200), + API_VERSION VARCHAR(30), + CONTEXT VARCHAR(256), + CONTEXT_TEMPLATE VARCHAR(256), + CREATED_BY VARCHAR(100), + CREATED_TIME DATETIME, + UPDATED_BY VARCHAR(100), + UPDATED_TIME DATETIME, + PRIMARY KEY(API_ID), + UNIQUE (API_PROVIDER,API_NAME,API_VERSION) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_API_URL_MAPPING]') AND TYPE IN (N'U')) + +CREATE TABLE AM_API_URL_MAPPING ( + URL_MAPPING_ID INTEGER IDENTITY(1,1), + API_ID INTEGER NOT NULL, + HTTP_METHOD VARCHAR(20) NULL, + AUTH_SCHEME VARCHAR(50) NULL, + URL_PATTERN VARCHAR(512) NULL, + THROTTLING_TIER varchar(512) DEFAULT NULL, + MEDIATION_SCRIPT VARBINARY(MAX), + PRIMARY KEY (URL_MAPPING_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_SUBSCRIPTION]') AND TYPE IN (N'U')) + +CREATE TABLE AM_SUBSCRIPTION ( + SUBSCRIPTION_ID INTEGER IDENTITY(1,1), + TIER_ID VARCHAR(50), + API_ID INTEGER, + LAST_ACCESSED DATETIME NULL, + APPLICATION_ID INTEGER, + SUB_STATUS VARCHAR(50), + SUBS_CREATE_STATE VARCHAR(50) DEFAULT 'SUBSCRIBE', + CREATED_BY VARCHAR(100), + CREATED_TIME DATETIME, + UPDATED_BY VARCHAR(100), + UPDATED_TIME DATETIME, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE, + PRIMARY KEY (SUBSCRIPTION_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_SUBSCRIPTION_KEY_MAPPING]') AND TYPE IN (N'U')) + +CREATE TABLE AM_SUBSCRIPTION_KEY_MAPPING ( + SUBSCRIPTION_ID INTEGER, + ACCESS_TOKEN VARCHAR(255), + KEY_TYPE VARCHAR(512) NOT NULL, + FOREIGN KEY(SUBSCRIPTION_ID) REFERENCES AM_SUBSCRIPTION(SUBSCRIPTION_ID) ON UPDATE CASCADE, + PRIMARY KEY(SUBSCRIPTION_ID,ACCESS_TOKEN) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_APPLICATION_KEY_MAPPING]') AND TYPE IN (N'U')) + +CREATE TABLE AM_APPLICATION_KEY_MAPPING ( + APPLICATION_ID INTEGER, + CONSUMER_KEY VARCHAR(512), + KEY_TYPE VARCHAR(512) NOT NULL, + STATE VARCHAR(30) NOT NULL, + CREATE_MODE VARCHAR(30) DEFAULT 'CREATED', + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE, + PRIMARY KEY(APPLICATION_ID,KEY_TYPE) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_APPLICATION_REGISTRATION]') AND TYPE IN (N'U')) + +CREATE TABLE AM_APPLICATION_REGISTRATION ( + REG_ID INTEGER IDENTITY(1,1), + SUBSCRIBER_ID INTEGER, + WF_REF VARCHAR(255) NOT NULL, + APP_ID INTEGER, + TOKEN_TYPE VARCHAR(30), + TOKEN_SCOPE VARCHAR(256) DEFAULT 'default', + INPUTS VARCHAR(1000), + ALLOWED_DOMAINS VARCHAR(256), + VALIDITY_PERIOD BIGINT, + UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE), + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON DELETE NO ACTION, + FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE NO ACTION, + PRIMARY KEY (REG_ID) +); + + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_API_LC_EVENT]') AND TYPE IN (N'U')) + +CREATE TABLE AM_API_LC_EVENT ( + EVENT_ID INTEGER IDENTITY(1,1), + API_ID INTEGER NOT NULL, + PREVIOUS_STATE VARCHAR(50), + NEW_STATE VARCHAR(50) NOT NULL, + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EVENT_DATE DATETIME NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE, + PRIMARY KEY (EVENT_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_APP_KEY_DOMAIN_MAPPING]') AND TYPE IN (N'U')) + +CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING ( + CONSUMER_KEY VARCHAR(512), + AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL', + PRIMARY KEY (CONSUMER_KEY,AUTHZ_DOMAIN) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_API_COMMENTS]') AND TYPE IN (N'U')) + +CREATE TABLE AM_API_COMMENTS ( + COMMENT_ID INTEGER IDENTITY(1,1), + COMMENT_TEXT VARCHAR(512), + COMMENTED_USER VARCHAR(255), + DATE_COMMENTED DATETIME NOT NULL, + API_ID INTEGER NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE, + PRIMARY KEY (COMMENT_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_API_RATINGS]') AND TYPE IN (N'U')) + +CREATE TABLE AM_API_RATINGS ( + RATING_ID INTEGER IDENTITY(1,1), + API_ID INTEGER, + RATING INTEGER, + SUBSCRIBER_ID INTEGER, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE, + PRIMARY KEY (RATING_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_TIER_PERMISSIONS]') AND TYPE IN (N'U')) + +CREATE TABLE AM_TIER_PERMISSIONS ( + TIER_PERMISSIONS_ID INTEGER IDENTITY(1,1), + TIER VARCHAR(50) NOT NULL, + PERMISSIONS_TYPE VARCHAR(50) NOT NULL, + ROLES VARCHAR(512) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(TIER_PERMISSIONS_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_EXTERNAL_STORES]') AND TYPE IN (N'U')) + +CREATE TABLE AM_EXTERNAL_STORES ( + APISTORE_ID INTEGER IDENTITY(1,1), + API_ID INTEGER, + STORE_ID VARCHAR(255) NOT NULL, + STORE_DISPLAY_NAME VARCHAR(255) NOT NULL, + STORE_ENDPOINT VARCHAR(255) NOT NULL, + STORE_TYPE VARCHAR(255) NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE, + PRIMARY KEY (API_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_WORKFLOWS]') AND TYPE IN (N'U')) + +CREATE TABLE AM_WORKFLOWS( + WF_ID INTEGER IDENTITY(1,1), + WF_REFERENCE VARCHAR(255) NOT NULL, + WF_TYPE VARCHAR(255) NOT NULL, + WF_STATUS VARCHAR(255) NOT NULL, + WF_CREATED_TIME DATETIME DEFAULT GETDATE(), + WF_UPDATED_TIME DATETIME DEFAULT GETDATE(), + WF_STATUS_DESC VARCHAR(1000), + TENANT_ID INTEGER, + TENANT_DOMAIN VARCHAR(255), + WF_EXTERNAL_REFERENCE VARCHAR(255) NOT NULL UNIQUE, + PRIMARY KEY (WF_ID) +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_API_SCOPES]') AND TYPE IN (N'U')) + +CREATE TABLE AM_API_SCOPES ( + API_ID INTEGER NOT NULL, + SCOPE_ID INTEGER NOT NULL, + FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE ON UPDATE CASCADE +); + +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_API_DEFAULT_VERSION]') AND TYPE IN (N'U')) + +CREATE TABLE AM_API_DEFAULT_VERSION ( + DEFAULT_VERSION_ID INTEGER NOT NULL IDENTITY, + API_NAME VARCHAR(256) NOT NULL , + API_PROVIDER VARCHAR(256) NOT NULL , + DEFAULT_API_VERSION VARCHAR(30) , + PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) , + PRIMARY KEY (DEFAULT_VERSION_ID) +); + + +CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID); diff --git a/modules/distribution/src/api-resource/sql/mysql.sql b/modules/distribution/src/api-resource/sql/mysql.sql new file mode 100644 index 00000000..cc11e337 --- /dev/null +++ b/modules/distribution/src/api-resource/sql/mysql.sql @@ -0,0 +1,752 @@ +-- Start of IDENTITY -- +CREATE TABLE IF NOT EXISTS IDN_BASE_TABLE ( + PRODUCT_NAME VARCHAR(20), + PRIMARY KEY (PRODUCT_NAME) +)ENGINE INNODB; + +INSERT INTO IDN_BASE_TABLE values ('WSO2 Identity Server'); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH_CONSUMER_APPS ( + ID INTEGER NOT NULL AUTO_INCREMENT, + CONSUMER_KEY VARCHAR(255), + CONSUMER_SECRET VARCHAR(512), + USERNAME VARCHAR(255), + TENANT_ID INTEGER DEFAULT 0, + APP_NAME VARCHAR(255), + OAUTH_VERSION VARCHAR(128), + CALLBACK_URL VARCHAR(1024), + GRANT_TYPES VARCHAR (1024), + CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY), + PRIMARY KEY (ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_REQUEST_TOKEN ( + REQUEST_TOKEN VARCHAR(255), + REQUEST_TOKEN_SECRET VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR(1024), + SCOPE VARCHAR(2048), + AUTHORIZED VARCHAR(128), + OAUTH_VERIFIER VARCHAR(512), + AUTHZ_USER VARCHAR(512), + PRIMARY KEY (REQUEST_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_ACCESS_TOKEN ( + ACCESS_TOKEN VARCHAR(255), + ACCESS_TOKEN_SECRET VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR(512), + PRIMARY KEY (ACCESS_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN ( + TOKEN_ID VARCHAR (255), + ACCESS_TOKEN VARCHAR(255), + REFRESH_TOKEN VARCHAR(255), + CONSUMER_KEY_ID INTEGER, + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + USER_TYPE VARCHAR (25), + TIME_CREATED TIMESTAMP DEFAULT 0, + REFRESH_TOKEN_TIME_CREATED TIMESTAMP DEFAULT 0, + VALIDITY_PERIOD BIGINT, + REFRESH_TOKEN_VALIDITY_PERIOD BIGINT, + TOKEN_SCOPE_HASH VARCHAR(32), + TOKEN_STATE VARCHAR(25) DEFAULT 'ACTIVE', + TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE', + PRIMARY KEY (TOKEN_ID), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE, + CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TENANT_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH, + TOKEN_STATE,TOKEN_STATE_ID) +)ENGINE INNODB; + +CREATE INDEX IDX_AT_CK_AU ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TOKEN_STATE, USER_TYPE); + +CREATE INDEX IDX_TC ON IDN_OAUTH2_ACCESS_TOKEN(TIME_CREATED); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHORIZATION_CODE ( + AUTHORIZATION_CODE VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR(1024), + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + TIME_CREATED TIMESTAMP, + VALIDITY_PERIOD BIGINT, + STATE VARCHAR (25) DEFAULT 'ACTIVE', + TOKEN_ID VARCHAR(255), + PRIMARY KEY (AUTHORIZATION_CODE), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE_ASSOCIATION ( + TOKEN_ID VARCHAR (255), + TOKEN_SCOPE VARCHAR (60), + PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), + FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE ( + SCOPE_ID INT(11) NOT NULL AUTO_INCREMENT, + SCOPE_KEY VARCHAR(100) NOT NULL, + NAME VARCHAR(255) NULL, + DESCRIPTION VARCHAR(512) NULL, + TENANT_ID INT(11) NOT NULL DEFAULT 0, + ROLES VARCHAR (500) NULL, + PRIMARY KEY (SCOPE_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_RESOURCE_SCOPE ( + RESOURCE_PATH VARCHAR(255) NOT NULL, + SCOPE_ID INTEGER (11) NOT NULL, + PRIMARY KEY (RESOURCE_PATH), + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_SCIM_GROUP ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + ROLE_NAME VARCHAR(255) NOT NULL, + ATTR_NAME VARCHAR(1024) NOT NULL, + ATTR_VALUE VARCHAR(1024), + PRIMARY KEY (ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OPENID_REMEMBER_ME ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + COOKIE_VALUE VARCHAR(1024), + CREATED_TIME TIMESTAMP, + PRIMARY KEY (USER_NAME, TENANT_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OPENID_USER_RPS ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + RP_URL VARCHAR(255) NOT NULL, + TRUSTED_ALWAYS VARCHAR(128) DEFAULT 'FALSE', + LAST_VISIT DATE NOT NULL, + VISIT_COUNT INTEGER DEFAULT 0, + DEFAULT_PROFILE_NAME VARCHAR(255) DEFAULT 'DEFAULT', + PRIMARY KEY (USER_NAME, TENANT_ID, RP_URL) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OPENID_ASSOCIATIONS ( + HANDLE VARCHAR(255) NOT NULL, + ASSOC_TYPE VARCHAR(255) NOT NULL, + EXPIRE_IN TIMESTAMP NOT NULL, + MAC_KEY VARCHAR(255) NOT NULL, + ASSOC_STORE VARCHAR(128) DEFAULT 'SHARED', + PRIMARY KEY (HANDLE) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_STS_STORE ( + ID INTEGER AUTO_INCREMENT, + TOKEN_ID VARCHAR(255) NOT NULL, + TOKEN_CONTENT BLOB(1024) NOT NULL, + CREATE_DATE TIMESTAMP NOT NULL, + EXPIRE_DATE TIMESTAMP NOT NULL, + STATE INTEGER DEFAULT 0, + PRIMARY KEY (ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_IDENTITY_USER_DATA ( + TENANT_ID INTEGER DEFAULT -1234, + USER_NAME VARCHAR(255) NOT NULL, + DATA_KEY VARCHAR(255) NOT NULL, + DATA_VALUE VARCHAR(255), + PRIMARY KEY (TENANT_ID, USER_NAME, DATA_KEY) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_IDENTITY_META_DATA ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + METADATA_TYPE VARCHAR(255) NOT NULL, + METADATA VARCHAR(255) NOT NULL, + VALID VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, USER_NAME, METADATA_TYPE,METADATA) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_THRIFT_SESSION ( + SESSION_ID VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + CREATED_TIME VARCHAR(255) NOT NULL, + LAST_MODIFIED_TIME VARCHAR(255) NOT NULL, + PRIMARY KEY (SESSION_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_STORE ( + SESSION_ID VARCHAR (100) NOT NULL, + SESSION_TYPE VARCHAR(100) NOT NULL, + SESSION_OBJECT BLOB, + TIME_CREATED TIMESTAMP, + PRIMARY KEY (SESSION_ID, SESSION_TYPE) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS SP_APP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + APP_NAME VARCHAR (255) NOT NULL , + USER_STORE VARCHAR (255) NOT NULL, + USERNAME VARCHAR (255) NOT NULL , + DESCRIPTION VARCHAR (1024), + ROLE_CLAIM VARCHAR (512), + AUTH_TYPE VARCHAR (255) NOT NULL, + PROVISIONING_USERSTORE_DOMAIN VARCHAR (512), + IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '1', + IS_SEND_LOCAL_SUBJECT_ID CHAR(1) DEFAULT '0', + IS_SEND_AUTH_LIST_OF_IDPS CHAR(1) DEFAULT '0', + IS_USE_TENANT_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + IS_USE_USER_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + SUBJECT_CLAIM_URI VARCHAR (512), + IS_SAAS_APP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID); + +CREATE TABLE IF NOT EXISTS SP_INBOUND_AUTH ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + INBOUND_AUTH_KEY VARCHAR (255) NOT NULL, + INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL, + PROP_NAME VARCHAR (255), + PROP_VALUE VARCHAR (1024) , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_AUTH_STEP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + STEP_ORDER INTEGER DEFAULT 1, + APP_ID INTEGER NOT NULL , + IS_SUBJECT_STEP CHAR(1) DEFAULT '0', + IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_FEDERATED_IDP ( + ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_ID INTEGER NOT NULL, + PRIMARY KEY (ID, AUTHENTICATOR_ID) +)ENGINE INNODB; + +ALTER TABLE SP_FEDERATED_IDP ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_CLAIM_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_CLAIM VARCHAR (512) NOT NULL , + SP_CLAIM VARCHAR (512) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_REQUESTED VARCHAR(128) DEFAULT '0', + DEFAULT_VALUE VARCHAR(255), + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_ROLE_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_ROLE VARCHAR (255) NOT NULL , + SP_ROLE VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_REQ_PATH_AUTHENTICATOR ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_PROVISIONING_CONNECTOR ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_NAME VARCHAR (255) NOT NULL , + CONNECTOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_JIT_ENABLED CHAR(1) NOT NULL DEFAULT '0', + BLOCKING CHAR(1) NOT NULL DEFAULT '0', + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS IDP ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + NAME VARCHAR(254) NOT NULL, + IS_ENABLED CHAR(1) NOT NULL DEFAULT '1', + IS_PRIMARY CHAR(1) NOT NULL DEFAULT '0', + HOME_REALM_ID VARCHAR(254), + IMAGE MEDIUMBLOB, + CERTIFICATE BLOB, + ALIAS VARCHAR(254), + INBOUND_PROV_ENABLED CHAR (1) NOT NULL DEFAULT '0', + INBOUND_PROV_USER_STORE_ID VARCHAR(254), + USER_CLAIM_URI VARCHAR(254), + ROLE_CLAIM_URI VARCHAR(254), + DESCRIPTION VARCHAR (1024), + DEFAULT_AUTHENTICATOR_NAME VARCHAR(254), + DEFAULT_PRO_CONNECTOR_NAME VARCHAR(254), + PROVISIONING_ROLE VARCHAR(128), + IS_FEDERATION_HUB CHAR(1) NOT NULL DEFAULT '0', + IS_LOCAL_CLAIM_DIALECT CHAR(1) NOT NULL DEFAULT '0', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, NAME) +)ENGINE INNODB; + +INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost'); + +CREATE TABLE IF NOT EXISTS IDP_ROLE ( + ID INTEGER AUTO_INCREMENT, + IDP_ID INTEGER, + TENANT_ID INTEGER, + ROLE VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, ROLE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_ROLE_MAPPING ( + ID INTEGER AUTO_INCREMENT, + IDP_ROLE_ID INTEGER, + TENANT_ID INTEGER, + USER_STORE_ID VARCHAR (253), + LOCAL_ROLE VARCHAR(253), + PRIMARY KEY (ID), + UNIQUE (IDP_ROLE_ID, TENANT_ID, USER_STORE_ID, LOCAL_ROLE), + FOREIGN KEY (IDP_ROLE_ID) REFERENCES IDP_ROLE(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_CLAIM ( + ID INTEGER AUTO_INCREMENT, + IDP_ID INTEGER, + TENANT_ID INTEGER, + CLAIM VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, CLAIM), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_CLAIM_MAPPING ( + ID INTEGER AUTO_INCREMENT, + IDP_CLAIM_ID INTEGER, + TENANT_ID INTEGER, + LOCAL_CLAIM VARCHAR(253), + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (IDP_CLAIM_ID, TENANT_ID, LOCAL_CLAIM), + FOREIGN KEY (IDP_CLAIM_ID) REFERENCES IDP_CLAIM(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + NAME VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '1', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, NAME), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'samlsso'); +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'IDPProperties'); + +CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR_PROPERTY ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + AUTHENTICATOR_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2047), + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY), + FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE +)ENGINE INNODB; + +INSERT INTO IDP_AUTHENTICATOR_PROPERTY (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY,PROPERTY_VALUE, IS_SECRET ) VALUES (-1234, 1 , 'IdPEntityId', 'localhost', '0'); + +CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_CONFIG ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + PROVISIONING_CONNECTOR_TYPE VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '0', + IS_BLOCKING CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, PROVISIONING_CONNECTOR_TYPE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_PROV_CONFIG_PROPERTY ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + PROVISIONING_CONFIG_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2048), + PROPERTY_BLOB_VALUE BLOB, + PROPERTY_TYPE CHAR(32) NOT NULL, + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, PROVISIONING_CONFIG_ID, PROPERTY_KEY), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_ENTITY ( + ID INTEGER AUTO_INCREMENT, + PROVISIONING_CONFIG_ID INTEGER, + ENTITY_TYPE VARCHAR(255) NOT NULL, + ENTITY_LOCAL_USERSTORE VARCHAR(255) NOT NULL, + ENTITY_NAME VARCHAR(255) NOT NULL, + ENTITY_VALUE VARCHAR(255), + TENANT_ID INTEGER, + PRIMARY KEY (ID), + UNIQUE (ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID), + UNIQUE (PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_LOCAL_CLAIM ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + CLAIM_URI VARCHAR(255) NOT NULL, + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, CLAIM_URI), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_ASSOCIATED_ID ( + ID INTEGER AUTO_INCREMENT, + IDP_USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + IDP_ID INTEGER NOT NULL, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (ID), + UNIQUE(IDP_USER_ID, TENANT_ID, IDP_ID), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_USER_ACCOUNT_ASSOCIATION ( + ASSOCIATION_KEY VARCHAR(255) NOT NULL, + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS FIDO_DEVICE_STORE ( + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(45) NOT NULL, + TIME_REGISTERED TIMESTAMP, + KEY_HANDLE VARCHAR(200) NOT NULL, + DEVICE_DATA VARCHAR(2048) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE) + )ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WF_REQUEST ( + UUID VARCHAR (45), + CREATED_BY VARCHAR (255), + TENANT_ID INTEGER DEFAULT -1, + OPERATION_TYPE VARCHAR (50), + CREATED_AT TIMESTAMP, + UPDATED_AT TIMESTAMP, + STATUS VARCHAR (30), + REQUEST BLOB, + PRIMARY KEY (UUID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WF_BPS_PROFILE ( + PROFILE_NAME VARCHAR(45), + HOST_URL VARCHAR(45), + USERNAME VARCHAR(45), + PASSWORD VARCHAR(255), + CALLBACK_HOST VARCHAR (45), + CALLBACK_USERNAME VARCHAR (45), + CALLBACK_PASSWORD VARCHAR (255), + TENANT_ID VARCHAR (45), + PRIMARY KEY (PROFILE_NAME, TENANT_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WF_WORKFLOW( + ID VARCHAR (45), + WF_NAME VARCHAR (45), + DESCRIPTION VARCHAR (255), + TEMPLATE_ID VARCHAR (45), + IMPL_ID VARCHAR (45), + TENANT_ID VARCHAR (45), + PRIMARY KEY (ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WF_WORKFLOW_ASSOCIATION( + ID INTEGER NOT NULL AUTO_INCREMENT, + ASSOC_NAME VARCHAR (45), + EVENT_ID VARCHAR(45), + ASSOC_CONDITION VARCHAR (2000), + WORKFLOW_ID VARCHAR (45), + IS_ENABLED CHAR (1) DEFAULT '1', + PRIMARY KEY(ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WF_WORKFLOW_CONFIG_PARAM( + WORKFLOW_ID VARCHAR (45), + PARAM_NAME VARCHAR (45), + PARAM_VALUE VARCHAR (1000), + PRIMARY KEY (WORKFLOW_ID, PARAM_NAME), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE +)ENGINE INNODB; + + + +CREATE TABLE IF NOT EXISTS WF_REQUEST_ENTITY_RELATIONSHIP( + REQUEST_ID VARCHAR (45), + ENTITY_NAME VARCHAR (255), + ENTITY_TYPE VARCHAR (50), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY(REQUEST_ID, ENTITY_NAME, ENTITY_TYPE, TENANT_ID), + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WORKFLOW_REQUEST_RELATION( + RELATIONSHIP_ID VARCHAR (45), + WORKFLOW_ID VARCHAR (45), + REQUEST_ID VARCHAR (45), + UPDATED_AT TIMESTAMP, + STATUS VARCHAR (30), + PRIMARY KEY (RELATIONSHIP_ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE, + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE +)ENGINE INNODB; + +-- End of IDENTITY Tables-- + +-- Start of API-MGT Tables -- +CREATE TABLE IF NOT EXISTS AM_SUBSCRIBER ( + SUBSCRIBER_ID INTEGER AUTO_INCREMENT, + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EMAIL_ADDRESS VARCHAR(256) NULL, + DATE_SUBSCRIBED TIMESTAMP NOT NULL, + PRIMARY KEY (SUBSCRIBER_ID), + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + UNIQUE (TENANT_ID,USER_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_APPLICATION ( + APPLICATION_ID INTEGER AUTO_INCREMENT, + NAME VARCHAR(100), + SUBSCRIBER_ID INTEGER, + APPLICATION_TIER VARCHAR(50) DEFAULT 'Unlimited', + CALLBACK_URL VARCHAR(512), + DESCRIPTION VARCHAR(512), + APPLICATION_STATUS VARCHAR(50) DEFAULT 'APPROVED', + GROUP_ID VARCHAR(100), + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY(APPLICATION_ID), + UNIQUE (NAME,SUBSCRIBER_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API ( + API_ID INTEGER AUTO_INCREMENT, + API_PROVIDER VARCHAR(200), + API_NAME VARCHAR(200), + API_VERSION VARCHAR(30), + CONTEXT VARCHAR(256), + CONTEXT_TEMPLATE VARCHAR(256), + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + PRIMARY KEY(API_ID), + UNIQUE (API_PROVIDER,API_NAME,API_VERSION) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_URL_MAPPING ( + URL_MAPPING_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER NOT NULL, + HTTP_METHOD VARCHAR(20) NULL, + AUTH_SCHEME VARCHAR(50) NULL, + URL_PATTERN VARCHAR(512) NULL, + THROTTLING_TIER varchar(512) DEFAULT NULL, + MEDIATION_SCRIPT BLOB, + PRIMARY KEY (URL_MAPPING_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION ( + SUBSCRIPTION_ID INTEGER AUTO_INCREMENT, + TIER_ID VARCHAR(50), + API_ID INTEGER, + LAST_ACCESSED TIMESTAMP NULL, + APPLICATION_ID INTEGER, + SUB_STATUS VARCHAR(50), + SUBS_CREATE_STATE VARCHAR(50) DEFAULT 'SUBSCRIBE', + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (SUBSCRIPTION_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION_KEY_MAPPING ( + SUBSCRIPTION_ID INTEGER, + ACCESS_TOKEN VARCHAR(255), + KEY_TYPE VARCHAR(512) NOT NULL, + FOREIGN KEY(SUBSCRIPTION_ID) REFERENCES AM_SUBSCRIPTION(SUBSCRIPTION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY(SUBSCRIPTION_ID,ACCESS_TOKEN) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_APPLICATION_KEY_MAPPING ( + APPLICATION_ID INTEGER, + CONSUMER_KEY VARCHAR(255), + KEY_TYPE VARCHAR(512) NOT NULL, + STATE VARCHAR(30) NOT NULL, + CREATE_MODE VARCHAR(30) DEFAULT 'CREATED', + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY(APPLICATION_ID,KEY_TYPE) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_LC_EVENT ( + EVENT_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER NOT NULL, + PREVIOUS_STATE VARCHAR(50), + NEW_STATE VARCHAR(50) NOT NULL, + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EVENT_DATE TIMESTAMP NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (EVENT_ID) +)ENGINE INNODB; + +CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING ( + CONSUMER_KEY VARCHAR(255), + AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL', + PRIMARY KEY (CONSUMER_KEY,AUTHZ_DOMAIN) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_COMMENTS ( + COMMENT_ID INTEGER AUTO_INCREMENT, + COMMENT_TEXT VARCHAR(512), + COMMENTED_USER VARCHAR(255), + DATE_COMMENTED TIMESTAMP NOT NULL, + API_ID INTEGER NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (COMMENT_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_RATINGS ( + RATING_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER, + RATING INTEGER, + SUBSCRIBER_ID INTEGER, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, +PRIMARY KEY (RATING_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_TIER_PERMISSIONS ( + TIER_PERMISSIONS_ID INTEGER AUTO_INCREMENT, + TIER VARCHAR(50) NOT NULL, + PERMISSIONS_TYPE VARCHAR(50) NOT NULL, + ROLES VARCHAR(512) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(TIER_PERMISSIONS_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_EXTERNAL_STORES ( + APISTORE_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER, + STORE_ID VARCHAR(255) NOT NULL, + STORE_DISPLAY_NAME VARCHAR(255) NOT NULL, + STORE_ENDPOINT VARCHAR(255) NOT NULL, + STORE_TYPE VARCHAR(255) NOT NULL, +FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, +PRIMARY KEY (APISTORE_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_WORKFLOWS( + WF_ID INTEGER AUTO_INCREMENT, + WF_REFERENCE VARCHAR(255) NOT NULL, + WF_TYPE VARCHAR(255) NOT NULL, + WF_STATUS VARCHAR(255) NOT NULL, + WF_CREATED_TIME TIMESTAMP DEFAULT 0, + WF_UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , + WF_STATUS_DESC VARCHAR(1000), + TENANT_ID INTEGER, + TENANT_DOMAIN VARCHAR(255), + WF_EXTERNAL_REFERENCE VARCHAR(255) NOT NULL, + PRIMARY KEY (WF_ID), + UNIQUE (WF_EXTERNAL_REFERENCE) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION ( + REG_ID INT AUTO_INCREMENT, + SUBSCRIBER_ID INT, + WF_REF VARCHAR(255) NOT NULL, + APP_ID INT, + TOKEN_TYPE VARCHAR(30), + TOKEN_SCOPE VARCHAR(256) DEFAULT 'default', + INPUTS VARCHAR(1000), + ALLOWED_DOMAINS VARCHAR(256), + VALIDITY_PERIOD BIGINT, + UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE), + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (REG_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_SCOPES ( + API_ID INTEGER NOT NULL, + SCOPE_ID INTEGER NOT NULL, + FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE ON UPDATE CASCADE +)ENGINE = INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_DEFAULT_VERSION ( + DEFAULT_VERSION_ID INT AUTO_INCREMENT, + API_NAME VARCHAR(256) NOT NULL , + API_PROVIDER VARCHAR(256) NOT NULL , + DEFAULT_API_VERSION VARCHAR(30) , + PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) , + PRIMARY KEY (DEFAULT_VERSION_ID) +); + +CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID); diff --git a/modules/distribution/src/api-resource/sql/mysql_cluster.sql b/modules/distribution/src/api-resource/sql/mysql_cluster.sql new file mode 100644 index 00000000..464950f1 --- /dev/null +++ b/modules/distribution/src/api-resource/sql/mysql_cluster.sql @@ -0,0 +1,752 @@ +-- Start of IDN Tables -- +CREATE TABLE IF NOT EXISTS IDN_BASE_TABLE ( + PRODUCT_NAME VARCHAR(20), + PRIMARY KEY (PRODUCT_NAME) +)ENGINE INNODB; + +INSERT INTO IDN_BASE_TABLE values ('WSO2 Identity Server'); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH_CONSUMER_APPS ( + ID INTEGER NOT NULL AUTO_INCREMENT, + CONSUMER_KEY VARCHAR(255), + CONSUMER_SECRET VARCHAR(512), + USERNAME VARCHAR(255), + TENANT_ID INTEGER DEFAULT 0, + APP_NAME VARCHAR(255), + OAUTH_VERSION VARCHAR(128), + CALLBACK_URL VARCHAR(1024), + GRANT_TYPES VARCHAR (1024), + CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY), + PRIMARY KEY (ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_REQUEST_TOKEN ( + REQUEST_TOKEN VARCHAR(255), + REQUEST_TOKEN_SECRET VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR(1024), + SCOPE VARCHAR(2048), + AUTHORIZED VARCHAR(128), + OAUTH_VERIFIER VARCHAR(512), + AUTHZ_USER VARCHAR(512), + PRIMARY KEY (REQUEST_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_ACCESS_TOKEN ( + ACCESS_TOKEN VARCHAR(255), + ACCESS_TOKEN_SECRET VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR(512), + PRIMARY KEY (ACCESS_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN ( + TOKEN_ID VARCHAR (255), + ACCESS_TOKEN VARCHAR(255), + REFRESH_TOKEN VARCHAR(255), + CONSUMER_KEY_ID INTEGER, + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + USER_TYPE VARCHAR (25), + TIME_CREATED TIMESTAMP DEFAULT 0, + REFRESH_TOKEN_TIME_CREATED TIMESTAMP DEFAULT 0, + VALIDITY_PERIOD BIGINT, + REFRESH_TOKEN_VALIDITY_PERIOD BIGINT, + TOKEN_SCOPE_HASH VARCHAR(32), + TOKEN_STATE VARCHAR(25) DEFAULT 'ACTIVE', + TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE', + PRIMARY KEY (TOKEN_ID), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE, + CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TENANT_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH, + TOKEN_STATE,TOKEN_STATE_ID) +)ENGINE INNODB; + +CREATE INDEX IDX_AT_CK_AU ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TOKEN_STATE, USER_TYPE); + +CREATE INDEX IDX_TC ON IDN_OAUTH2_ACCESS_TOKEN(TIME_CREATED); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHORIZATION_CODE ( + AUTHORIZATION_CODE VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR(1024), + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + TIME_CREATED TIMESTAMP, + VALIDITY_PERIOD BIGINT, + STATE VARCHAR (25) DEFAULT 'ACTIVE', + TOKEN_ID VARCHAR(255), + PRIMARY KEY (AUTHORIZATION_CODE), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE_ASSOCIATION ( + TOKEN_ID VARCHAR (255), + TOKEN_SCOPE VARCHAR (60), + PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), + FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE ( + SCOPE_ID INT(11) NOT NULL AUTO_INCREMENT, + SCOPE_KEY VARCHAR(100) NOT NULL, + NAME VARCHAR(255) NULL, + DESCRIPTION VARCHAR(512) NULL, + TENANT_ID INT(11) NOT NULL DEFAULT 0, + ROLES VARCHAR (500) NULL, + PRIMARY KEY (SCOPE_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_RESOURCE_SCOPE ( + RESOURCE_PATH VARCHAR(255) NOT NULL, + SCOPE_ID INTEGER (11) NOT NULL, + PRIMARY KEY (RESOURCE_PATH), + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_SCIM_GROUP ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + ROLE_NAME VARCHAR(255) NOT NULL, + ATTR_NAME VARCHAR(1024) NOT NULL, + ATTR_VALUE VARCHAR(1024), + PRIMARY KEY (ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OPENID_REMEMBER_ME ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + COOKIE_VALUE VARCHAR(1024), + CREATED_TIME TIMESTAMP, + PRIMARY KEY (USER_NAME, TENANT_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OPENID_USER_RPS ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + RP_URL VARCHAR(255) NOT NULL, + TRUSTED_ALWAYS VARCHAR(128) DEFAULT 'FALSE', + LAST_VISIT DATE NOT NULL, + VISIT_COUNT INTEGER DEFAULT 0, + DEFAULT_PROFILE_NAME VARCHAR(255) DEFAULT 'DEFAULT', + PRIMARY KEY (USER_NAME, TENANT_ID, RP_URL) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_OPENID_ASSOCIATIONS ( + HANDLE VARCHAR(255) NOT NULL, + ASSOC_TYPE VARCHAR(255) NOT NULL, + EXPIRE_IN TIMESTAMP NOT NULL, + MAC_KEY VARCHAR(255) NOT NULL, + ASSOC_STORE VARCHAR(128) DEFAULT 'SHARED', + PRIMARY KEY (HANDLE) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_STS_STORE ( + ID INTEGER AUTO_INCREMENT, + TOKEN_ID VARCHAR(255) NOT NULL, + TOKEN_CONTENT BLOB(1024) NOT NULL, + CREATE_DATE TIMESTAMP NOT NULL, + EXPIRE_DATE TIMESTAMP NOT NULL, + STATE INTEGER DEFAULT 0, + PRIMARY KEY (ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_IDENTITY_USER_DATA ( + TENANT_ID INTEGER DEFAULT -1234, + USER_NAME VARCHAR(255) NOT NULL, + DATA_KEY VARCHAR(255) NOT NULL, + DATA_VALUE VARCHAR(255), + PRIMARY KEY (TENANT_ID, USER_NAME, DATA_KEY) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_IDENTITY_META_DATA ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + METADATA_TYPE VARCHAR(255) NOT NULL, + METADATA VARCHAR(255) NOT NULL, + VALID VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, USER_NAME, METADATA_TYPE,METADATA) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_THRIFT_SESSION ( + SESSION_ID VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + CREATED_TIME VARCHAR(255) NOT NULL, + LAST_MODIFIED_TIME VARCHAR(255) NOT NULL, + PRIMARY KEY (SESSION_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_STORE ( + SESSION_ID VARCHAR (100) NOT NULL, + SESSION_TYPE VARCHAR(100) NOT NULL, + SESSION_OBJECT BLOB, + TIME_CREATED TIMESTAMP, + PRIMARY KEY (SESSION_ID, SESSION_TYPE) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS SP_APP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + APP_NAME VARCHAR (255) NOT NULL , + USER_STORE VARCHAR (255) NOT NULL, + USERNAME VARCHAR (255) NOT NULL , + DESCRIPTION VARCHAR (1024), + ROLE_CLAIM VARCHAR (512), + AUTH_TYPE VARCHAR (255) NOT NULL, + PROVISIONING_USERSTORE_DOMAIN VARCHAR (512), + IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '1', + IS_SEND_LOCAL_SUBJECT_ID CHAR(1) DEFAULT '0', + IS_SEND_AUTH_LIST_OF_IDPS CHAR(1) DEFAULT '0', + IS_USE_TENANT_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + IS_USE_USER_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + SUBJECT_CLAIM_URI VARCHAR (512), + IS_SAAS_APP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID); + +CREATE TABLE IF NOT EXISTS SP_INBOUND_AUTH ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + INBOUND_AUTH_KEY VARCHAR (255) NOT NULL, + INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL, + PROP_NAME VARCHAR (255), + PROP_VALUE VARCHAR (1024) , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_AUTH_STEP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + STEP_ORDER INTEGER DEFAULT 1, + APP_ID INTEGER NOT NULL , + IS_SUBJECT_STEP CHAR(1) DEFAULT '0', + IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_FEDERATED_IDP ( + ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_ID INTEGER NOT NULL, + PRIMARY KEY (ID, AUTHENTICATOR_ID) +)ENGINE INNODB; + +ALTER TABLE SP_FEDERATED_IDP ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_CLAIM_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_CLAIM VARCHAR (512) NOT NULL , + SP_CLAIM VARCHAR (512) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_REQUESTED VARCHAR(128) DEFAULT '0', + DEFAULT_VALUE VARCHAR(255), + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_ROLE_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_ROLE VARCHAR (255) NOT NULL , + SP_ROLE VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_REQ_PATH_AUTHENTICATOR ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_PROVISIONING_CONNECTOR ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_NAME VARCHAR (255) NOT NULL , + CONNECTOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_JIT_ENABLED CHAR(1) NOT NULL DEFAULT '0', + BLOCKING CHAR(1) NOT NULL DEFAULT '0', + PRIMARY KEY (ID) +)ENGINE INNODB; + +ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS IDP ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + NAME VARCHAR(254) NOT NULL, + IS_ENABLED CHAR(1) NOT NULL DEFAULT '1', + IS_PRIMARY CHAR(1) NOT NULL DEFAULT '0', + HOME_REALM_ID VARCHAR(254), + IMAGE MEDIUMBLOB, + CERTIFICATE BLOB, + ALIAS VARCHAR(254), + INBOUND_PROV_ENABLED CHAR (1) NOT NULL DEFAULT '0', + INBOUND_PROV_USER_STORE_ID VARCHAR(254), + USER_CLAIM_URI VARCHAR(254), + ROLE_CLAIM_URI VARCHAR(254), + DESCRIPTION VARCHAR (1024), + DEFAULT_AUTHENTICATOR_NAME VARCHAR(254), + DEFAULT_PRO_CONNECTOR_NAME VARCHAR(254), + PROVISIONING_ROLE VARCHAR(128), + IS_FEDERATION_HUB CHAR(1) NOT NULL DEFAULT '0', + IS_LOCAL_CLAIM_DIALECT CHAR(1) NOT NULL DEFAULT '0', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, NAME) +)ENGINE INNODB; + +INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost'); + +CREATE TABLE IF NOT EXISTS IDP_ROLE ( + ID INTEGER AUTO_INCREMENT, + IDP_ID INTEGER, + TENANT_ID INTEGER, + ROLE VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, ROLE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_ROLE_MAPPING ( + ID INTEGER AUTO_INCREMENT, + IDP_ROLE_ID INTEGER, + TENANT_ID INTEGER, + USER_STORE_ID VARCHAR (253), + LOCAL_ROLE VARCHAR(253), + PRIMARY KEY (ID), + UNIQUE (IDP_ROLE_ID, TENANT_ID, USER_STORE_ID, LOCAL_ROLE), + FOREIGN KEY (IDP_ROLE_ID) REFERENCES IDP_ROLE(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_CLAIM ( + ID INTEGER AUTO_INCREMENT, + IDP_ID INTEGER, + TENANT_ID INTEGER, + CLAIM VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, CLAIM), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_CLAIM_MAPPING ( + ID INTEGER AUTO_INCREMENT, + IDP_CLAIM_ID INTEGER, + TENANT_ID INTEGER, + LOCAL_CLAIM VARCHAR(253), + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (IDP_CLAIM_ID, TENANT_ID, LOCAL_CLAIM), + FOREIGN KEY (IDP_CLAIM_ID) REFERENCES IDP_CLAIM(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + NAME VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '1', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, NAME), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'samlsso'); +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'IDPProperties'); + +CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR_PROPERTY ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + AUTHENTICATOR_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2047), + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY), + FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE +)ENGINE INNODB; + +INSERT INTO IDP_AUTHENTICATOR_PROPERTY (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY,PROPERTY_VALUE, IS_SECRET ) VALUES (-1234, 1 , 'IdPEntityId', 'localhost', '0'); + +CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_CONFIG ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + PROVISIONING_CONNECTOR_TYPE VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '0', + IS_BLOCKING CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, PROVISIONING_CONNECTOR_TYPE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_PROV_CONFIG_PROPERTY ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + PROVISIONING_CONFIG_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2048), + PROPERTY_BLOB_VALUE BLOB, + PROPERTY_TYPE CHAR(32) NOT NULL, + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, PROVISIONING_CONFIG_ID, PROPERTY_KEY), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_ENTITY ( + ID INTEGER AUTO_INCREMENT, + PROVISIONING_CONFIG_ID INTEGER, + ENTITY_TYPE VARCHAR(255) NOT NULL, + ENTITY_LOCAL_USERSTORE VARCHAR(255) NOT NULL, + ENTITY_NAME VARCHAR(255) NOT NULL, + ENTITY_VALUE VARCHAR(255), + TENANT_ID INTEGER, + PRIMARY KEY (ID), + UNIQUE (ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID), + UNIQUE (PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDP_LOCAL_CLAIM ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + CLAIM_URI VARCHAR(255) NOT NULL, + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, CLAIM_URI), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_ASSOCIATED_ID ( + ID INTEGER AUTO_INCREMENT, + IDP_USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + IDP_ID INTEGER NOT NULL, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (ID), + UNIQUE(IDP_USER_ID, TENANT_ID, IDP_ID), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS IDN_USER_ACCOUNT_ASSOCIATION ( + ASSOCIATION_KEY VARCHAR(255) NOT NULL, + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS FIDO_DEVICE_STORE ( + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(45) NOT NULL, + TIME_REGISTERED TIMESTAMP, + KEY_HANDLE VARCHAR(200) NOT NULL, + DEVICE_DATA VARCHAR(2048) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE) + )ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WF_REQUEST ( + UUID VARCHAR (45), + CREATED_BY VARCHAR (255), + TENANT_ID INTEGER DEFAULT -1, + OPERATION_TYPE VARCHAR (50), + CREATED_AT TIMESTAMP, + UPDATED_AT TIMESTAMP, + STATUS VARCHAR (30), + REQUEST BLOB, + PRIMARY KEY (UUID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WF_BPS_PROFILE ( + PROFILE_NAME VARCHAR(45), + HOST_URL VARCHAR(45), + USERNAME VARCHAR(45), + PASSWORD VARCHAR(255), + CALLBACK_HOST VARCHAR (45), + CALLBACK_USERNAME VARCHAR (45), + CALLBACK_PASSWORD VARCHAR (255), + TENANT_ID VARCHAR (45), + PRIMARY KEY (PROFILE_NAME, TENANT_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WF_WORKFLOW( + ID VARCHAR (45), + WF_NAME VARCHAR (45), + DESCRIPTION VARCHAR (255), + TEMPLATE_ID VARCHAR (45), + IMPL_ID VARCHAR (45), + TENANT_ID VARCHAR (45), + PRIMARY KEY (ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WF_WORKFLOW_ASSOCIATION( + ID INTEGER NOT NULL AUTO_INCREMENT, + ASSOC_NAME VARCHAR (45), + EVENT_ID VARCHAR(45), + ASSOC_CONDITION VARCHAR (2000), + WORKFLOW_ID VARCHAR (45), + IS_ENABLED CHAR (1) DEFAULT '1', + PRIMARY KEY(ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WF_WORKFLOW_CONFIG_PARAM( + WORKFLOW_ID VARCHAR (45), + PARAM_NAME VARCHAR (45), + PARAM_VALUE VARCHAR (1000), + PRIMARY KEY (WORKFLOW_ID, PARAM_NAME), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE +)ENGINE INNODB; + + + +CREATE TABLE IF NOT EXISTS WF_REQUEST_ENTITY_RELATIONSHIP( + REQUEST_ID VARCHAR (45), + ENTITY_NAME VARCHAR (255), + ENTITY_TYPE VARCHAR (50), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY(REQUEST_ID, ENTITY_NAME, ENTITY_TYPE, TENANT_ID), + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS WORKFLOW_REQUEST_RELATION( + RELATIONSHIP_ID VARCHAR (45), + WORKFLOW_ID VARCHAR (45), + REQUEST_ID VARCHAR (45), + UPDATED_AT TIMESTAMP, + STATUS VARCHAR (30), + PRIMARY KEY (RELATIONSHIP_ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE, + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE +)ENGINE INNODB; + +-- End of IDN Tables-- + +-- Start of API-MGT Tables -- +CREATE TABLE IF NOT EXISTS AM_SUBSCRIBER ( + SUBSCRIBER_ID INTEGER AUTO_INCREMENT, + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EMAIL_ADDRESS VARCHAR(256) NULL, + DATE_SUBSCRIBED TIMESTAMP NOT NULL, + PRIMARY KEY (SUBSCRIBER_ID), + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + UNIQUE (TENANT_ID,USER_ID) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_APPLICATION ( + APPLICATION_ID INTEGER AUTO_INCREMENT, + NAME VARCHAR(100), + SUBSCRIBER_ID INTEGER, + APPLICATION_TIER VARCHAR(50) DEFAULT 'Unlimited', + CALLBACK_URL VARCHAR(512), + DESCRIPTION VARCHAR(512), + APPLICATION_STATUS VARCHAR(50) DEFAULT 'APPROVED', + GROUP_ID VARCHAR(100), + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON DELETE RESTRICT, + PRIMARY KEY(APPLICATION_ID), + UNIQUE (NAME,SUBSCRIBER_ID) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_API ( + API_ID INTEGER AUTO_INCREMENT, + API_PROVIDER VARCHAR(200), + API_NAME VARCHAR(200), + API_VERSION VARCHAR(30), + CONTEXT VARCHAR(256), + CONTEXT_TEMPLATE VARCHAR(256), + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + PRIMARY KEY(API_ID), + UNIQUE (API_PROVIDER,API_NAME,API_VERSION) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_API_URL_MAPPING ( + URL_MAPPING_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER NOT NULL, + HTTP_METHOD VARCHAR(20) NULL, + AUTH_SCHEME VARCHAR(50) NULL, + URL_PATTERN VARCHAR(512) NULL, + THROTTLING_TIER varchar(512) DEFAULT NULL, + MEDIATION_SCRIPT BLOB, + PRIMARY KEY (URL_MAPPING_ID) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION ( + SUBSCRIPTION_ID INTEGER AUTO_INCREMENT, + TIER_ID VARCHAR(50), + API_ID INTEGER, + LAST_ACCESSED TIMESTAMP NULL, + APPLICATION_ID INTEGER, + SUB_STATUS VARCHAR(50), + SUBS_CREATE_STATE VARCHAR(50) DEFAULT 'SUBSCRIBE', + CREATED_BY VARCHAR(100), + CREATED_TIME TIMESTAMP, + UPDATED_BY VARCHAR(100), + UPDATED_TIME TIMESTAMP, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON DELETE RESTRICT, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE RESTRICT, + PRIMARY KEY (SUBSCRIPTION_ID) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION_KEY_MAPPING ( + SUBSCRIPTION_ID INTEGER, + ACCESS_TOKEN VARCHAR(255), + KEY_TYPE VARCHAR(512) NOT NULL, + FOREIGN KEY(SUBSCRIPTION_ID) REFERENCES AM_SUBSCRIPTION(SUBSCRIPTION_ID) ON DELETE RESTRICT, + PRIMARY KEY(SUBSCRIPTION_ID,ACCESS_TOKEN) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_APPLICATION_KEY_MAPPING ( + APPLICATION_ID INTEGER, + CONSUMER_KEY VARCHAR(255), + KEY_TYPE VARCHAR(512) NOT NULL, + STATE VARCHAR(30) NOT NULL, + CREATE_MODE VARCHAR(30) DEFAULT 'CREATED', + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON DELETE RESTRICT, + PRIMARY KEY(APPLICATION_ID,KEY_TYPE) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_API_LC_EVENT ( + EVENT_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER NOT NULL, + PREVIOUS_STATE VARCHAR(50), + NEW_STATE VARCHAR(50) NOT NULL, + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EVENT_DATE TIMESTAMP NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE RESTRICT, + PRIMARY KEY (EVENT_ID) +)ENGINE NDB; + +CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING ( + CONSUMER_KEY VARCHAR(255), + AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL', + PRIMARY KEY (CONSUMER_KEY,AUTHZ_DOMAIN), + FOREIGN KEY (CONSUMER_KEY) REFERENCES IDN_OAUTH_CONSUMER_APPS(CONSUMER_KEY) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_API_COMMENTS ( + COMMENT_ID INTEGER AUTO_INCREMENT, + COMMENT_TEXT VARCHAR(512), + COMMENTED_USER VARCHAR(255), + DATE_COMMENTED TIMESTAMP NOT NULL, + API_ID INTEGER NOT NULL, + PRIMARY KEY (COMMENT_ID) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_API_RATINGS ( + RATING_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER, + RATING INTEGER, + SUBSCRIBER_ID INTEGER, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE RESTRICT, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON DELETE RESTRICT, +PRIMARY KEY (RATING_ID) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_TIER_PERMISSIONS ( + TIER_PERMISSIONS_ID INTEGER AUTO_INCREMENT, + TIER VARCHAR(50) NOT NULL, + PERMISSIONS_TYPE VARCHAR(50) NOT NULL, + ROLES VARCHAR(512) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(TIER_PERMISSIONS_ID) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_EXTERNAL_STORES ( + APISTORE_ID INTEGER AUTO_INCREMENT, + API_ID INTEGER, + STORE_ID VARCHAR(255) NOT NULL, + STORE_DISPLAY_NAME VARCHAR(255) NOT NULL, + STORE_ENDPOINT VARCHAR(255) NOT NULL, + STORE_TYPE VARCHAR(255) NOT NULL, +FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE RESTRICT, +PRIMARY KEY (APISTORE_ID) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_WORKFLOWS( + WF_ID INTEGER AUTO_INCREMENT, + WF_REFERENCE VARCHAR(255) NOT NULL, + WF_TYPE VARCHAR(255) NOT NULL, + WF_STATUS VARCHAR(255) NOT NULL, + WF_CREATED_TIME TIMESTAMP DEFAULT 0, + WF_UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , + WF_STATUS_DESC VARCHAR(1000), + TENANT_ID INTEGER, + TENANT_DOMAIN VARCHAR(255), + WF_EXTERNAL_REFERENCE VARCHAR(255) NOT NULL, + PRIMARY KEY (WF_ID), + UNIQUE (WF_EXTERNAL_REFERENCE) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION ( + REG_ID INT AUTO_INCREMENT, + SUBSCRIBER_ID INT, + WF_REF VARCHAR(255) NOT NULL, + APP_ID INT, + TOKEN_TYPE VARCHAR(30), + TOKEN_SCOPE VARCHAR(256) DEFAULT 'default', + INPUTS VARCHAR(1000), + ALLOWED_DOMAINS VARCHAR(256), + VALIDITY_PERIOD BIGINT, + UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE), + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON DELETE RESTRICT, + FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON DELETE RESTRICT, + PRIMARY KEY (REG_ID) +)ENGINE NDB; + +CREATE TABLE IF NOT EXISTS AM_API_SCOPES ( + API_ID INTEGER NOT NULL, + SCOPE_ID INTEGER NOT NULL, + FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE, + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE +)ENGINE = NDB; + +CREATE TABLE IF NOT EXISTS AM_API_DEFAULT_VERSION ( + DEFAULT_VERSION_ID INT AUTO_INCREMENT, + API_NAME VARCHAR(256) NOT NULL , + API_PROVIDER VARCHAR(256) NOT NULL , + DEFAULT_API_VERSION VARCHAR(30) , + PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) , + PRIMARY KEY (DEFAULT_VERSION_ID) +); + +CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID); diff --git a/modules/distribution/src/api-resource/sql/oracle.sql b/modules/distribution/src/api-resource/sql/oracle.sql new file mode 100644 index 00000000..d58ec683 --- /dev/null +++ b/modules/distribution/src/api-resource/sql/oracle.sql @@ -0,0 +1,1181 @@ + -- Create Oracle New User and Connect +-------------------------------------- +-- CREATE USER apimuser IDENTIFIED BY wso2; +-- GRANT CONNECT,RESOURCE to apimuser WITH ADMIN OPTION; +-- CONNECT apimuser/wso2 +-- + +-- Start of IDN Tables -- +CREATE TABLE IDN_BASE_TABLE ( + PRODUCT_NAME VARCHAR2 (20), + PRIMARY KEY (PRODUCT_NAME)) +/ +INSERT INTO IDN_BASE_TABLE values ('WSO2 Identity Server') +/ +CREATE TABLE IDN_OAUTH_CONSUMER_APPS ( + ID INTEGER, + CONSUMER_KEY VARCHAR2 (255), + CONSUMER_SECRET VARCHAR2 (512), + USERNAME VARCHAR2 (255), + TENANT_ID INTEGER DEFAULT 0, + APP_NAME VARCHAR2 (255), + OAUTH_VERSION VARCHAR2 (128), + CALLBACK_URL VARCHAR2 (1024), + GRANT_TYPES VARCHAR (1024), + CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY), + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE IDN_OAUTH_CONSUMER_APPS_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDN_OAUTH_CONSUMER_APPS_TRIG + BEFORE INSERT + ON IDN_OAUTH_CONSUMER_APPS + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDN_OAUTH_CONSUMER_APPS_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDN_OAUTH1A_REQUEST_TOKEN ( + REQUEST_TOKEN VARCHAR2 (512), + REQUEST_TOKEN_SECRET VARCHAR2 (512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR2 (1024), + SCOPE VARCHAR2(2048), + AUTHORIZED VARCHAR2 (128), + OAUTH_VERIFIER VARCHAR2 (512), + AUTHZ_USER VARCHAR2 (512), + PRIMARY KEY (REQUEST_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE) +/ +CREATE TABLE IDN_OAUTH1A_ACCESS_TOKEN ( + ACCESS_TOKEN VARCHAR2 (512), + ACCESS_TOKEN_SECRET VARCHAR2 (512), + CONSUMER_KEY_ID INTEGER, + SCOPE VARCHAR2(2048), + AUTHZ_USER VARCHAR2 (512), + PRIMARY KEY (ACCESS_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE) +/ +CREATE TABLE IDN_OAUTH2_ACCESS_TOKEN ( + TOKEN_ID VARCHAR (255), + ACCESS_TOKEN VARCHAR2 (255), + REFRESH_TOKEN VARCHAR2 (255), + CONSUMER_KEY_ID INTEGER, + AUTHZ_USER VARCHAR2 (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR2 (50), + USER_TYPE VARCHAR (25), + TIME_CREATED TIMESTAMP, + REFRESH_TOKEN_TIME_CREATED TIMESTAMP, + VALIDITY_PERIOD NUMBER(19), + REFRESH_TOKEN_VALIDITY_PERIOD NUMBER(19), + TOKEN_SCOPE_HASH VARCHAR2 (32), + TOKEN_STATE VARCHAR2 (25) DEFAULT 'ACTIVE', + TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE', + PRIMARY KEY (TOKEN_ID), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE, + CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TOKEN_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH, + TOKEN_STATE,TOKEN_STATE_ID)) +/ +CREATE INDEX IDX_TC ON IDN_OAUTH2_ACCESS_TOKEN(TIME_CREATED) +/ +CREATE INDEX IDX_AT_CK_AU ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TOKEN_STATE, USER_TYPE) +/ +CREATE TABLE IDN_OAUTH2_AUTHORIZATION_CODE ( + AUTHORIZATION_CODE VARCHAR2 (512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR2 (1024), + SCOPE VARCHAR2(2048), + AUTHZ_USER VARCHAR2 (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR2 (50), + TIME_CREATED TIMESTAMP, + VALIDITY_PERIOD NUMBER(19), + STATE VARCHAR (25) DEFAULT 'ACTIVE', + TOKEN_ID VARCHAR(255), + PRIMARY KEY (AUTHORIZATION_CODE), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE) +/ +CREATE TABLE IDN_OAUTH2_SCOPE_ASSOCIATION ( + TOKEN_ID VARCHAR2 (255), + TOKEN_SCOPE VARCHAR2 (60), + PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), + FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE) +/ +CREATE TABLE IDN_OAUTH2_SCOPE ( + SCOPE_ID INTEGER, + SCOPE_KEY VARCHAR2 (100) NOT NULL, + NAME VARCHAR2 (255) NULL, + DESCRIPTION VARCHAR2 (512) NULL, + TENANT_ID INTEGER DEFAULT 0, + ROLES VARCHAR2 (500) NULL, + PRIMARY KEY (SCOPE_ID)) +/ +CREATE SEQUENCE IDN_OAUTH2_SCOPE_SEQUENCE START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDN_OAUTH2_SCOPE_TRIGGER + BEFORE INSERT + ON IDN_OAUTH2_SCOPE + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDN_OAUTH2_SCOPE_SEQUENCE.nextval INTO :NEW.SCOPE_ID FROM dual; + END; +/ +CREATE TABLE IDN_OAUTH2_RESOURCE_SCOPE ( + RESOURCE_PATH VARCHAR2 (255) NOT NULL, + SCOPE_ID INTEGER NOT NULL, + PRIMARY KEY (RESOURCE_PATH), + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID)) +/ +CREATE TABLE IDN_SCIM_GROUP ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + ROLE_NAME VARCHAR2(255) NOT NULL, + ATTR_NAME VARCHAR2(1024) NOT NULL, + ATTR_VALUE VARCHAR2(1024), + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE IDN_SCIM_GROUP_SEQUENCE START WITH 1 INCREMENT BY 1 NOCACHE +/ + +CREATE OR REPLACE TRIGGER IDN_SCIM_GROUP_TRIGGER + BEFORE INSERT + ON IDN_SCIM_GROUP + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDN_SCIM_GROUP_SEQUENCE.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDN_OPENID_REMEMBER_ME ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + COOKIE_VALUE VARCHAR(1024), + CREATED_TIME TIMESTAMP, + PRIMARY KEY (USER_NAME, TENANT_ID)) +/ +CREATE TABLE IDN_OPENID_USER_RPS ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + RP_URL VARCHAR(255) NOT NULL, + TRUSTED_ALWAYS VARCHAR(128) DEFAULT 'FALSE', + LAST_VISIT DATE NOT NULL, + VISIT_COUNT INTEGER DEFAULT 0, + DEFAULT_PROFILE_NAME VARCHAR(255) DEFAULT 'DEFAULT', + PRIMARY KEY (USER_NAME, TENANT_ID, RP_URL)) +/ +CREATE TABLE IDN_OPENID_ASSOCIATIONS ( + HANDLE VARCHAR(255) NOT NULL, + ASSOC_TYPE VARCHAR(255) NOT NULL, + EXPIRE_IN TIMESTAMP NOT NULL, + MAC_KEY VARCHAR(255) NOT NULL, + ASSOC_STORE VARCHAR(128) DEFAULT 'SHARED', + PRIMARY KEY (HANDLE)) +/ +CREATE TABLE IDN_STS_STORE ( + ID INTEGER, + TOKEN_ID VARCHAR(255) NOT NULL, + TOKEN_CONTENT BLOB NOT NULL, + CREATE_DATE TIMESTAMP NOT NULL, + EXPIRE_DATE TIMESTAMP NOT NULL, + STATE INTEGER DEFAULT 0, + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE IDN_STS_STORE_SEQUENCE START WITH 1 INCREMENT BY 1 NOCACHE +/ + +CREATE OR REPLACE TRIGGER IDN_STS_STORE_TRIGGER + BEFORE INSERT + ON IDN_STS_STORE + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDN_STS_STORE_SEQUENCE.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDN_IDENTITY_USER_DATA ( + TENANT_ID INTEGER DEFAULT -1234, + USER_NAME VARCHAR(255) NOT NULL, + DATA_KEY VARCHAR(255) NOT NULL, + DATA_VALUE VARCHAR(255), + PRIMARY KEY (TENANT_ID, USER_NAME, DATA_KEY)) +/ +CREATE TABLE IDN_IDENTITY_META_DATA ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + METADATA_TYPE VARCHAR(255) NOT NULL, + METADATA VARCHAR(255) NOT NULL, + VALID VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, USER_NAME, METADATA_TYPE,METADATA)) +/ +CREATE TABLE IDN_THRIFT_SESSION ( + SESSION_ID VARCHAR2(255) NOT NULL, + USER_NAME VARCHAR2(255) NOT NULL, + CREATED_TIME VARCHAR2(255) NOT NULL, + LAST_MODIFIED_TIME VARCHAR2(255) NOT NULL, + PRIMARY KEY (SESSION_ID) +) +/ +CREATE TABLE IDN_AUTH_SESSION_STORE ( + SESSION_ID VARCHAR (100) NOT NULL, + SESSION_TYPE VARCHAR(100) NOT NULL, + SESSION_OBJECT BLOB, + TIME_CREATED TIMESTAMP, + PRIMARY KEY (SESSION_ID, SESSION_TYPE) +) +/ +CREATE TABLE SP_APP ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + APP_NAME VARCHAR (255) NOT NULL , + USER_STORE VARCHAR (255) NOT NULL, + USERNAME VARCHAR (255) NOT NULL , + DESCRIPTION VARCHAR (1024), + ROLE_CLAIM VARCHAR (512), + AUTH_TYPE VARCHAR (255) NOT NULL, + PROVISIONING_USERSTORE_DOMAIN VARCHAR (512), + IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '1', + IS_SEND_LOCAL_SUBJECT_ID CHAR(1) DEFAULT '0', + IS_SEND_AUTH_LIST_OF_IDPS CHAR(1) DEFAULT '0', + IS_USE_TENANT_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + IS_USE_USER_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + SUBJECT_CLAIM_URI VARCHAR (512), + IS_SAAS_APP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_APP_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER SP_APP_TRIG + BEFORE INSERT + ON SP_APP + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_APP_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID) +/ +CREATE TABLE SP_INBOUND_AUTH ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + INBOUND_AUTH_KEY VARCHAR (255) NOT NULL, + INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL, + PROP_NAME VARCHAR (255), + PROP_VALUE VARCHAR (1024) , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_INBOUND_AUTH_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER SP_INBOUND_AUTH_TRIG + BEFORE INSERT + ON SP_INBOUND_AUTH + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_INBOUND_AUTH_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_AUTH_STEP ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + STEP_ORDER INTEGER DEFAULT 1, + APP_ID INTEGER NOT NULL, + IS_SUBJECT_STEP CHAR(1) DEFAULT '0', + IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_AUTH_STEP_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER SP_AUTH_STEP_TRIG + BEFORE INSERT + ON SP_AUTH_STEP + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_AUTH_STEP_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_FEDERATED_IDP ( + ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_ID INTEGER NOT NULL, + PRIMARY KEY (ID, AUTHENTICATOR_ID)) +/ +ALTER TABLE SP_FEDERATED_IDP ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_CLAIM_MAPPING ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + IDP_CLAIM VARCHAR (512) NOT NULL , + SP_CLAIM VARCHAR (512) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_REQUESTED VARCHAR(128) DEFAULT '0', + DEFAULT_VALUE VARCHAR(255), + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_CLAIM_MAPPING_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER SP_CLAIM_MAPPING_TRIG + BEFORE INSERT + ON SP_CLAIM_MAPPING + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_CLAIM_MAPPING_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_ROLE_MAPPING ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + IDP_ROLE VARCHAR (255) NOT NULL , + SP_ROLE VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_ROLE_MAPPING_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER SP_ROLE_MAPPING_TRIG + BEFORE INSERT + ON SP_ROLE_MAPPING + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_ROLE_MAPPING_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_REQ_PATH_AUTHENTICATOR ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_REQ_PATH_AUTH_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER SP_REQ_PATH_AUTH_TRIG + BEFORE INSERT + ON SP_REQ_PATH_AUTHENTICATOR + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_REQ_PATH_AUTH_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_PROVISIONING_CONNECTOR ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + IDP_NAME VARCHAR (255) NOT NULL , + CONNECTOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_JIT_ENABLED CHAR(1) DEFAULT '0', + BLOCKING CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_PROV_CONNECTOR_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER SP_PROV_CONNECTOR_TRIG + BEFORE INSERT + ON SP_PROVISIONING_CONNECTOR + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_PROV_CONNECTOR_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE IDP ( + ID INTEGER, + TENANT_ID INTEGER, + NAME VARCHAR(254) NOT NULL, + IS_ENABLED CHAR(1) DEFAULT '1', + IS_PRIMARY CHAR(1) DEFAULT '0', + HOME_REALM_ID VARCHAR(254), + IMAGE BLOB, + CERTIFICATE BLOB, + ALIAS VARCHAR(254), + INBOUND_PROV_ENABLED CHAR (1) DEFAULT '0', + INBOUND_PROV_USER_STORE_ID VARCHAR(254), + USER_CLAIM_URI VARCHAR(254), + ROLE_CLAIM_URI VARCHAR(254), + DESCRIPTION VARCHAR (1024), + DEFAULT_AUTHENTICATOR_NAME VARCHAR(254), + DEFAULT_PRO_CONNECTOR_NAME VARCHAR(254), + PROVISIONING_ROLE VARCHAR(128), + IS_FEDERATION_HUB CHAR(1) DEFAULT '0', + IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '0', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, NAME)) +/ +CREATE SEQUENCE IDP_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_TRIG + BEFORE INSERT + ON IDP + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost') +/ +CREATE TABLE IDP_ROLE ( + ID INTEGER, + IDP_ID INTEGER, + TENANT_ID INTEGER, + ROLE VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, ROLE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_ROLE_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_ROLE_TRIG + BEFORE INSERT + ON IDP_ROLE + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_ROLE_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_ROLE_MAPPING ( + ID INTEGER, + IDP_ROLE_ID INTEGER, + TENANT_ID INTEGER, + USER_STORE_ID VARCHAR (253), + LOCAL_ROLE VARCHAR(253), + PRIMARY KEY (ID), + UNIQUE (IDP_ROLE_ID, TENANT_ID, USER_STORE_ID, LOCAL_ROLE), + FOREIGN KEY (IDP_ROLE_ID) REFERENCES IDP_ROLE(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_ROLE_MAPPING_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_ROLE_MAPPING_TRIG + BEFORE INSERT + ON IDP_ROLE_MAPPING + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_ROLE_MAPPING_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_CLAIM ( + ID INTEGER, + IDP_ID INTEGER, + TENANT_ID INTEGER, + CLAIM VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, CLAIM), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_CLAIM_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_CLAIM_TRIG + BEFORE INSERT + ON IDP_CLAIM + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_CLAIM_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_CLAIM_MAPPING ( + ID INTEGER, + IDP_CLAIM_ID INTEGER, + TENANT_ID INTEGER, + LOCAL_CLAIM VARCHAR(253), + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (IDP_CLAIM_ID, TENANT_ID, LOCAL_CLAIM), + FOREIGN KEY (IDP_CLAIM_ID) REFERENCES IDP_CLAIM(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_CLAIM_MAPPING_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_CLAIM_MAPPING_TRIG + BEFORE INSERT + ON IDP_CLAIM_MAPPING + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_CLAIM_MAPPING_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_AUTHENTICATOR ( + ID INTEGER, + TENANT_ID INTEGER, + IDP_ID INTEGER, + NAME VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '1', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, NAME), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_AUTHENTICATOR_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_AUTHENTICATOR_TRIG + BEFORE INSERT + ON IDP_AUTHENTICATOR + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_AUTHENTICATOR_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'samlsso') +/ +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'IDPProperties') +/ +CREATE TABLE IDP_AUTHENTICATOR_PROPERTY ( + ID INTEGER, + TENANT_ID INTEGER, + AUTHENTICATOR_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2047), + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY), + FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_AUTHENTICATOR_PROP_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_AUTHENTICATOR_PROP_TRIG + BEFORE INSERT + ON IDP_AUTHENTICATOR_PROPERTY + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_AUTHENTICATOR_PROP_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +INSERT INTO IDP_AUTHENTICATOR_PROPERTY (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY,PROPERTY_VALUE, IS_SECRET ) VALUES (-1234, 1 , 'IdPEntityId', 'localhost', '0') +/ +CREATE TABLE IDP_PROVISIONING_CONFIG ( + ID INTEGER, + TENANT_ID INTEGER, + IDP_ID INTEGER, + PROVISIONING_CONNECTOR_TYPE VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '0', + IS_BLOCKING CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, PROVISIONING_CONNECTOR_TYPE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_PROVISIONING_CONFIG_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_PROVISIONING_CONFIG_TRIG + BEFORE INSERT + ON IDP_PROVISIONING_CONFIG + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_PROVISIONING_CONFIG_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_PROV_CONFIG_PROPERTY ( + ID INTEGER, + TENANT_ID INTEGER, + PROVISIONING_CONFIG_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2048), + PROPERTY_BLOB_VALUE BLOB, + PROPERTY_TYPE CHAR(32) NOT NULL, + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, PROVISIONING_CONFIG_ID, PROPERTY_KEY), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_PROV_CONFIG_PROP_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_PROV_CONFIG_PROP_TRIG + BEFORE INSERT + ON IDP_PROV_CONFIG_PROPERTY + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_PROV_CONFIG_PROP_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_PROVISIONING_ENTITY ( + ID INTEGER, + PROVISIONING_CONFIG_ID INTEGER, + ENTITY_TYPE VARCHAR(255) NOT NULL, + ENTITY_LOCAL_USERSTORE VARCHAR(255) NOT NULL, + ENTITY_NAME VARCHAR(255) NOT NULL, + ENTITY_VALUE VARCHAR(255), + TENANT_ID INTEGER, + PRIMARY KEY (ID), + UNIQUE (ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID), + UNIQUE (PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_PROV_ENTITY_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_PROV_ENTITY_TRIG + BEFORE INSERT + ON IDP_PROVISIONING_ENTITY + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_PROV_ENTITY_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_LOCAL_CLAIM ( + ID INTEGER, + TENANT_ID INTEGER, + IDP_ID INTEGER, + CLAIM_URI VARCHAR(255) NOT NULL, + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, CLAIM_URI), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_LOCAL_CLAIM_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDP_LOCAL_CLAIM_TRIG + BEFORE INSERT + ON IDP_LOCAL_CLAIM + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_LOCAL_CLAIM_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDN_ASSOCIATED_ID ( + ID INTEGER, + IDP_USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + IDP_ID INTEGER NOT NULL, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (ID), + UNIQUE(IDP_USER_ID, TENANT_ID, IDP_ID), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +) +/ +CREATE SEQUENCE IDN_ASSOCIATED_ID_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDN_ASSOCIATED_ID_TRIG +BEFORE INSERT +ON IDN_ASSOCIATED_ID +REFERENCING NEW AS NEW +FOR EACH ROW + BEGIN + SELECT IDN_ASSOCIATED_ID_SEQ.nextval + INTO :NEW.ID + FROM dual; + END; +/ +CREATE TABLE IDN_USER_ACCOUNT_ASSOCIATION ( + ASSOCIATION_KEY VARCHAR(255) NOT NULL, + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME)) +/ +CREATE TABLE FIDO_DEVICE_STORE ( + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(45) NOT NULL, + TIME_REGISTERED TIMESTAMP, + KEY_HANDLE VARCHAR(200) NOT NULL, + DEVICE_DATA VARCHAR(2048) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE)) +/ + +CREATE TABLE WF_REQUEST ( + UUID VARCHAR2 (45), + CREATED_BY VARCHAR2 (255), + TENANT_ID INTEGER DEFAULT -1, + OPERATION_TYPE VARCHAR2 (50), + CREATED_AT TIMESTAMP, + UPDATED_AT TIMESTAMP, + STATUS VARCHAR2 (30), + REQUEST BLOB, + PRIMARY KEY (UUID)) +/ + +CREATE TABLE WF_BPS_PROFILE ( + PROFILE_NAME VARCHAR2(45), + HOST_URL VARCHAR2(45), + USERNAME VARCHAR2(45), + PASSWORD VARCHAR2(255), + CALLBACK_HOST VARCHAR2 (45), + CALLBACK_USERNAME VARCHAR2 (45), + CALLBACK_PASSWORD VARCHAR2 (255), + TENANT_ID VARCHAR2 (45), + PRIMARY KEY (PROFILE_NAME, TENANT_ID)) +/ + +CREATE TABLE WF_WORKFLOW( + ID VARCHAR2 (45), + WF_NAME VARCHAR2 (45), + DESCRIPTION VARCHAR2 (255), + TEMPLATE_ID VARCHAR2 (45), + IMPL_ID VARCHAR2 (45), + TENANT_ID VARCHAR2 (45), + PRIMARY KEY (ID)) +/ + +CREATE TABLE WF_WORKFLOW_ASSOCIATION( + ID INTEGER, + ASSOC_NAME VARCHAR2 (45), + EVENT_ID VARCHAR2(45), + ASSOC_CONDITION VARCHAR2 (2000), + WORKFLOW_ID VARCHAR2 (45), + IS_ENABLED CHAR (1) DEFAULT '1', + PRIMARY KEY(ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE) +/ + +CREATE SEQUENCE WF_WORKFLOW_ASSOCIATION_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER WF_WORKFLOW_ASSOCIATION_TRIG +BEFORE INSERT +ON WF_WORKFLOW_ASSOCIATION +REFERENCING NEW AS NEW +FOR EACH ROW + BEGIN + SELECT WF_WORKFLOW_ASSOCIATION_SEQ.nextval + INTO :NEW.ID + FROM dual; + END; +/ + +CREATE TABLE WF_WORKFLOW_CONFIG_PARAM( + WORKFLOW_ID VARCHAR2 (45), + PARAM_NAME VARCHAR2 (45), + PARAM_VALUE VARCHAR2 (1000), + PRIMARY KEY (WORKFLOW_ID, PARAM_NAME), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE) +/ + +CREATE TABLE WF_REQUEST_ENTITY_RELATIONSHIP( + REQUEST_ID VARCHAR2 (45), + ENTITY_NAME VARCHAR2 (255), + ENTITY_TYPE VARCHAR2 (50), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY(REQUEST_ID, ENTITY_NAME, ENTITY_TYPE, TENANT_ID), + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE) +/ + +CREATE TABLE WORKFLOW_REQUEST_RELATION( + RELATIONSHIP_ID VARCHAR2 (45), + WORKFLOW_ID VARCHAR2 (45), + REQUEST_ID VARCHAR2 (45), + UPDATED_AT TIMESTAMP, + STATUS VARCHAR (30), + PRIMARY KEY (RELATIONSHIP_ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE, + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE) +/ + +-- End of IDENTITY Tables-- + +-- Start of API-MGT Tables-- +CREATE TABLE AM_SUBSCRIBER ( + SUBSCRIBER_ID INTEGER, + USER_ID VARCHAR2(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EMAIL_ADDRESS VARCHAR2(256) NULL, + DATE_SUBSCRIBED DATE NOT NULL, + CREATED_BY VARCHAR2(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR2(100), + UPDATED_TIME DATE, + PRIMARY KEY (SUBSCRIBER_ID), + UNIQUE (TENANT_ID,USER_ID) +) +/ + +CREATE SEQUENCE AM_SUBSCRIBER_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_SUBSCRIBER_TRIGGER + BEFORE INSERT + ON AM_SUBSCRIBER + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_SUBSCRIBER_SEQUENCE.nextval INTO :NEW.SUBSCRIBER_ID FROM dual; + END; +/ +-- TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(SUBSCRIBER_ID) relation +CREATE TABLE AM_APPLICATION ( + APPLICATION_ID INTEGER, + NAME VARCHAR2(100), + SUBSCRIBER_ID INTEGER, + APPLICATION_TIER VARCHAR2(50) DEFAULT 'Unlimited', + CALLBACK_URL VARCHAR2(512), + DESCRIPTION VARCHAR2(512), + APPLICATION_STATUS VARCHAR2(50) DEFAULT 'APPROVED', + GROUP_ID VARCHAR2(100), + CREATED_BY VARCHAR2(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR2(100), + UPDATED_TIME DATE, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON DELETE CASCADE, + PRIMARY KEY(APPLICATION_ID), + UNIQUE (NAME,SUBSCRIBER_ID) +) +/ + +CREATE SEQUENCE AM_APPLICATION_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_APPLICATION_TRIGGER + BEFORE INSERT + ON AM_APPLICATION + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_APPLICATION_SEQUENCE.nextval INTO :NEW.APPLICATION_ID FROM dual; + END; +/ + +CREATE TABLE AM_API ( + API_ID INTEGER, + API_PROVIDER VARCHAR2(256), + API_NAME VARCHAR2(256), + API_VERSION VARCHAR2(30), + CONTEXT VARCHAR2(256), + CONTEXT_TEMPLATE VARCHAR2(256), + CREATED_BY VARCHAR2(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR2(100), + UPDATED_TIME DATE, + PRIMARY KEY(API_ID), + UNIQUE (API_PROVIDER,API_NAME,API_VERSION) +) +/ + +CREATE SEQUENCE AM_API_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_API_TRIGGER + BEFORE INSERT + ON AM_API + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_SEQUENCE.nextval INTO :NEW.API_ID FROM dual; + END; +/ + +CREATE TABLE AM_API_URL_MAPPING ( + URL_MAPPING_ID INTEGER, + API_ID INTEGER NOT NULL, + HTTP_METHOD VARCHAR(20) NULL, + AUTH_SCHEME VARCHAR(50) NULL, + URL_PATTERN VARCHAR(512) NULL, + THROTTLING_TIER varchar(512) DEFAULT NULL, + MEDIATION_SCRIPT BLOB, + PRIMARY KEY(URL_MAPPING_ID) +) +/ + +CREATE SEQUENCE AM_API_URL_MAPPING_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_API_URL_MAPPING_TRIGGER + BEFORE INSERT + ON AM_API_URL_MAPPING + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_URL_MAPPING_SEQUENCE.nextval INTO :NEW.URL_MAPPING_ID FROM dual; + END; +/ + +-- TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(SUBSCRIPTION_ID) relation +CREATE TABLE AM_SUBSCRIPTION ( + SUBSCRIPTION_ID INTEGER, + TIER_ID VARCHAR2(50), + API_ID INTEGER, + LAST_ACCESSED DATE NULL, + APPLICATION_ID INTEGER, + SUB_STATUS VARCHAR(50), + SUBS_CREATE_STATE VARCHAR(50) DEFAULT 'SUBSCRIBE', + CREATED_BY VARCHAR2(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR2(100), + UPDATED_TIME DATE, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON DELETE CASCADE, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, + PRIMARY KEY (SUBSCRIPTION_ID) +) +/ + +CREATE SEQUENCE AM_SUBSCRIPTION_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_SUBSCRIPTION_TRIGGER + BEFORE INSERT + ON AM_SUBSCRIPTION + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_SUBSCRIPTION_SEQUENCE.nextval INTO :NEW.SUBSCRIPTION_ID FROM dual; + END; +/ +-- TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(APPLICATION_ID) and FOREIGN KEY(API_ID) relations +CREATE TABLE AM_SUBSCRIPTION_KEY_MAPPING ( + SUBSCRIPTION_ID INTEGER, + ACCESS_TOKEN VARCHAR2(512), + KEY_TYPE VARCHAR2(512) NOT NULL, + FOREIGN KEY(SUBSCRIPTION_ID) REFERENCES AM_SUBSCRIPTION(SUBSCRIPTION_ID) ON DELETE CASCADE, + PRIMARY KEY(SUBSCRIPTION_ID,ACCESS_TOKEN) +) +/ +--TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(APPLICATION_ID) relation +CREATE TABLE AM_APPLICATION_KEY_MAPPING ( + APPLICATION_ID INTEGER, + CONSUMER_KEY VARCHAR2(512), + KEY_TYPE VARCHAR2(512) NOT NULL, + STATE VARCHAR2(30) NOT NULL, + CREATE_MODE VARCHAR2(30) DEFAULT 'CREATED', + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON DELETE CASCADE, + PRIMARY KEY(APPLICATION_ID,KEY_TYPE) +) +/ + +CREATE TABLE AM_APPLICATION_REGISTRATION ( + REG_ID INTEGER , + SUBSCRIBER_ID INTEGER, + WF_REF VARCHAR2(255) NOT NULL, + APP_ID INTEGER, + TOKEN_TYPE VARCHAR2(30), + TOKEN_SCOPE VARCHAR2(256) DEFAULT 'default', + INPUTS VARCHAR2(1024), + ALLOWED_DOMAINS VARCHAR2(256), + VALIDITY_PERIOD NUMBER(19), + UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE), + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID), + FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID), + PRIMARY KEY (REG_ID) +) +/ +-- TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(API_ID) relation +CREATE TABLE AM_API_LC_EVENT ( + EVENT_ID INTEGER, + API_ID INTEGER NOT NULL, + PREVIOUS_STATE VARCHAR2(50), + NEW_STATE VARCHAR2(50) NOT NULL, + USER_ID VARCHAR2(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EVENT_DATE DATE NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, + PRIMARY KEY (EVENT_ID) +) +/ + +CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING ( + CONSUMER_KEY VARCHAR(255), + AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL', + PRIMARY KEY (CONSUMER_KEY,AUTHZ_DOMAIN) +) +/ + +CREATE TABLE AM_API_COMMENTS ( + COMMENT_ID INTEGER, + COMMENT_TEXT VARCHAR2(512), + COMMENTED_USER VARCHAR2(255), + DATE_COMMENTED DATE NOT NULL, + API_ID INTEGER NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, + PRIMARY KEY (COMMENT_ID) +) +/ + +CREATE SEQUENCE AM_API_COMMENTS_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_API_COMMENTS_TRIGGER + BEFORE INSERT + ON AM_API_COMMENTS + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_COMMENTS_SEQUENCE.nextval INTO :NEW.COMMENT_ID FROM dual; + END; +/ + +CREATE TABLE AM_API_RATINGS ( + RATING_ID INTEGER, + API_ID INTEGER, + RATING INTEGER, + SUBSCRIBER_ID INTEGER, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON DELETE CASCADE, + PRIMARY KEY (RATING_ID) +) +/ + +CREATE SEQUENCE AM_API_RATINGS_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_API_RATINGS_TRIGGER + BEFORE INSERT + ON AM_API_RATINGS + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_RATINGS_SEQUENCE.nextval INTO :NEW.RATING_ID FROM dual; + END; +/ + +CREATE TABLE AM_TIER_PERMISSIONS ( + TIER_PERMISSIONS_ID INTEGER, + TIER VARCHAR2(50) NOT NULL, + PERMISSIONS_TYPE VARCHAR2(50) NOT NULL, + ROLES VARCHAR2(512) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(TIER_PERMISSIONS_ID) +) +/ + +CREATE SEQUENCE AM_TIER_PERMISSIONS_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_TIER_PERMISSIONS_TRIGGER + BEFORE INSERT + ON AM_TIER_PERMISSIONS + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_TIER_PERMISSIONS_SEQUENCE.nextval INTO :NEW.TIER_PERMISSIONS_ID FROM dual; + END; +/ + +CREATE SEQUENCE AM_API_LC_EVENT_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_API_LC_EVENT_TRIGGER + BEFORE INSERT + ON AM_API_LC_EVENT + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_LC_EVENT_SEQUENCE.nextval INTO :NEW.EVENT_ID FROM dual; + END; +/ +-- Start of IDP-APPLICATION-MGT Tables -- + +-- End of IDP-APPLICATION-MGT Tables -- + + +CREATE TABLE AM_EXTERNAL_STORES ( + APISTORE_ID INTEGER, + API_ID INTEGER, + STORE_ID VARCHAR2(255) NOT NULL, + STORE_DISPLAY_NAME VARCHAR2(255) NOT NULL, + STORE_ENDPOINT VARCHAR2(255) NOT NULL, + STORE_TYPE VARCHAR2(255) NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, + PRIMARY KEY (APISTORE_ID) +) +/ + +CREATE TABLE AM_WORKFLOWS( + WF_ID INTEGER, + WF_REFERENCE VARCHAR(255) NOT NULL, + WF_TYPE VARCHAR(255) NOT NULL, + WF_STATUS VARCHAR(255) NOT NULL, + WF_CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + WF_UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + WF_STATUS_DESC VARCHAR(1000), + TENANT_ID INTEGER, + TENANT_DOMAIN VARCHAR(255), + WF_EXTERNAL_REFERENCE VARCHAR(255) NOT NULL UNIQUE, + PRIMARY KEY (WF_ID) +) +/ + +CREATE TABLE AM_API_SCOPES ( + API_ID INTEGER NOT NULL, + SCOPE_ID INTEGER NOT NULL, + FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE, + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE +) +/ +CREATE SEQUENCE AM_APP_REGISTRATION_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_APP_REGISTRATION_TRIGGER + BEFORE INSERT + ON AM_APPLICATION_REGISTRATION + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_APP_REGISTRATION_SEQUENCE.nextval INTO :NEW.REG_ID FROM dual; + END; +/ + +CREATE SEQUENCE AM_WORKFLOWS_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_WORKFLOWS_TRIGGER + BEFORE INSERT + ON AM_WORKFLOWS + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_WORKFLOWS_SEQUENCE.nextval INTO :NEW.WF_ID FROM dual; + END; +/ + +CREATE SEQUENCE AM_EXTERNAL_STORES_SEQUENCE START WITH 1 INCREMENT BY 1 +/ + +CREATE OR REPLACE TRIGGER AM_EXTERNAL_STORES_TRIGGER + BEFORE INSERT + ON AM_EXTERNAL_STORES + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_EXTERNAL_STORES_SEQUENCE.nextval INTO :NEW.APISTORE_ID FROM dual; + END; +/ + +CREATE TABLE AM_API_DEFAULT_VERSION ( + DEFAULT_VERSION_ID NUMBER, + API_NAME VARCHAR(256) NOT NULL , + API_PROVIDER VARCHAR(256) NOT NULL , + DEFAULT_API_VERSION VARCHAR(30) , + PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) , + PRIMARY KEY (DEFAULT_VERSION_ID) +) +/ +CREATE SEQUENCE AM_API_DEFAULT_VERSION_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER AM_API_DEFAULT_VERSION_TRG + BEFORE INSERT + ON AM_API_DEFAULT_VERSION + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_DEFAULT_VERSION_SEQ.nextval INTO :NEW.DEFAULT_VERSION_ID FROM dual; + END; +/ +CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID) +/ + diff --git a/modules/distribution/src/api-resource/sql/oracle_rac.sql b/modules/distribution/src/api-resource/sql/oracle_rac.sql new file mode 100644 index 00000000..4b510a58 --- /dev/null +++ b/modules/distribution/src/api-resource/sql/oracle_rac.sql @@ -0,0 +1,1180 @@ +-- Create Oracle New User and Connect +-------------------------------------- +-- CREATE USER apimuser IDENTIFIED BY wso2; +-- GRANT CONNECT,RESOURCE to apimuser WITH ADMIN OPTION; +-- CONNECT apimuser/wso2 +-- + +-- Start of IDN Tables -- +CREATE TABLE IDN_BASE_TABLE ( + PRODUCT_NAME VARCHAR2 (20), + PRIMARY KEY (PRODUCT_NAME)) +/ +INSERT INTO IDN_BASE_TABLE values ('WSO2 Identity Server') +/ +CREATE TABLE IDN_OAUTH_CONSUMER_APPS ( + ID INTEGER, + CONSUMER_KEY VARCHAR2 (255), + CONSUMER_SECRET VARCHAR2 (512), + USERNAME VARCHAR2 (255), + TENANT_ID INTEGER DEFAULT 0, + APP_NAME VARCHAR2 (255), + OAUTH_VERSION VARCHAR2 (128), + CALLBACK_URL VARCHAR2 (1024), + GRANT_TYPES VARCHAR (1024), + CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY), + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE IDN_OAUTH_CONSUMER_APPS_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDN_OAUTH_CONSUMER_APPS_TRIG + BEFORE INSERT + ON IDN_OAUTH_CONSUMER_APPS + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDN_OAUTH_CONSUMER_APPS_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDN_OAUTH1A_REQUEST_TOKEN ( + REQUEST_TOKEN VARCHAR2 (512), + REQUEST_TOKEN_SECRET VARCHAR2 (512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR2 (1024), + SCOPE VARCHAR2(2048), + AUTHORIZED VARCHAR2 (128), + OAUTH_VERIFIER VARCHAR2 (512), + AUTHZ_USER VARCHAR2 (512), + PRIMARY KEY (REQUEST_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE) +/ +CREATE TABLE IDN_OAUTH1A_ACCESS_TOKEN ( + ACCESS_TOKEN VARCHAR2 (512), + ACCESS_TOKEN_SECRET VARCHAR2 (512), + CONSUMER_KEY_ID INTEGER, + SCOPE VARCHAR2(2048), + AUTHZ_USER VARCHAR2 (512), + PRIMARY KEY (ACCESS_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE) +/ +CREATE TABLE IDN_OAUTH2_ACCESS_TOKEN ( + TOKEN_ID VARCHAR (255), + ACCESS_TOKEN VARCHAR2 (255), + REFRESH_TOKEN VARCHAR2 (255), + CONSUMER_KEY_ID INTEGER, + AUTHZ_USER VARCHAR2 (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR2 (50), + USER_TYPE VARCHAR (25), + TIME_CREATED TIMESTAMP, + REFRESH_TOKEN_TIME_CREATED TIMESTAMP, + VALIDITY_PERIOD NUMBER(19), + REFRESH_TOKEN_VALIDITY_PERIOD NUMBER(19), + TOKEN_SCOPE_HASH VARCHAR2 (32), + TOKEN_STATE VARCHAR2 (25) DEFAULT 'ACTIVE', + TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE', + PRIMARY KEY (TOKEN_ID), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE, + CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TOKEN_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH, + TOKEN_STATE,TOKEN_STATE_ID)) +/ +CREATE INDEX IDX_AT_CK_AU ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TOKEN_STATE, USER_TYPE) +/ +CREATE INDEX IDX_TC ON IDN_OAUTH2_ACCESS_TOKEN(TIME_CREATED) +/ +CREATE TABLE IDN_OAUTH2_AUTHORIZATION_CODE ( + AUTHORIZATION_CODE VARCHAR2 (512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR2 (1024), + SCOPE VARCHAR2(2048), + AUTHZ_USER VARCHAR2 (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR2(50), + TIME_CREATED TIMESTAMP, + VALIDITY_PERIOD NUMBER(19), + STATE VARCHAR (25) DEFAULT 'ACTIVE', + TOKEN_ID VARCHAR(255), + PRIMARY KEY (AUTHORIZATION_CODE), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE) +/ +CREATE TABLE IDN_OAUTH2_SCOPE_ASSOCIATION ( + TOKEN_ID VARCHAR2 (255), + TOKEN_SCOPE VARCHAR2 (60), + PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), + FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE) +/ +CREATE TABLE IDN_OAUTH2_SCOPE ( + SCOPE_ID INTEGER, + SCOPE_KEY VARCHAR2 (100) NOT NULL, + NAME VARCHAR2 (255) NULL, + DESCRIPTION VARCHAR2 (512) NULL, + TENANT_ID INTEGER DEFAULT 0, + ROLES VARCHAR2 (500) NULL, + PRIMARY KEY (SCOPE_ID)) +/ +CREATE SEQUENCE IDN_OAUTH2_SCOPE_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDN_OAUTH2_SCOPE_TRIGGER + BEFORE INSERT + ON IDN_OAUTH2_SCOPE + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDN_OAUTH2_SCOPE_SEQUENCE.nextval INTO :NEW.SCOPE_ID FROM dual; + END; +/ +CREATE TABLE IDN_OAUTH2_RESOURCE_SCOPE ( + RESOURCE_PATH VARCHAR2 (255) NOT NULL, + SCOPE_ID INTEGER NOT NULL, + PRIMARY KEY (RESOURCE_PATH), + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID)) +/ +CREATE TABLE IDN_SCIM_GROUP ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + ROLE_NAME VARCHAR2(255) NOT NULL, + ATTR_NAME VARCHAR2(1024) NOT NULL, + ATTR_VALUE VARCHAR2(1024), + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE IDN_SCIM_GROUP_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER IDN_SCIM_GROUP_TRIGGER + BEFORE INSERT + ON IDN_SCIM_GROUP + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDN_SCIM_GROUP_SEQUENCE.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDN_OPENID_REMEMBER_ME ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + COOKIE_VALUE VARCHAR(1024), + CREATED_TIME TIMESTAMP, + PRIMARY KEY (USER_NAME, TENANT_ID)) +/ +CREATE TABLE IDN_OPENID_USER_RPS ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + RP_URL VARCHAR(255) NOT NULL, + TRUSTED_ALWAYS VARCHAR(128) DEFAULT 'FALSE', + LAST_VISIT DATE NOT NULL, + VISIT_COUNT INTEGER DEFAULT 0, + DEFAULT_PROFILE_NAME VARCHAR(255) DEFAULT 'DEFAULT', + PRIMARY KEY (USER_NAME, TENANT_ID, RP_URL)) +/ +CREATE TABLE IDN_OPENID_ASSOCIATIONS ( + HANDLE VARCHAR(255) NOT NULL, + ASSOC_TYPE VARCHAR(255) NOT NULL, + EXPIRE_IN TIMESTAMP NOT NULL, + MAC_KEY VARCHAR(255) NOT NULL, + ASSOC_STORE VARCHAR(128) DEFAULT 'SHARED', + PRIMARY KEY (HANDLE)) +/ +CREATE TABLE IDN_STS_STORE ( + ID INTEGER, + TOKEN_ID VARCHAR(255) NOT NULL, + TOKEN_CONTENT BLOB NOT NULL, + CREATE_DATE TIMESTAMP NOT NULL, + EXPIRE_DATE TIMESTAMP NOT NULL, + STATE INTEGER DEFAULT 0, + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE IDN_STS_STORE_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER IDN_STS_STORE_TRIGGER + BEFORE INSERT + ON IDN_STS_STORE + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDN_STS_STORE_SEQUENCE.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDN_IDENTITY_USER_DATA ( + TENANT_ID INTEGER DEFAULT -1234, + USER_NAME VARCHAR(255) NOT NULL, + DATA_KEY VARCHAR(255) NOT NULL, + DATA_VALUE VARCHAR(255), + PRIMARY KEY (TENANT_ID, USER_NAME, DATA_KEY)) +/ +CREATE TABLE IDN_IDENTITY_META_DATA ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + METADATA_TYPE VARCHAR(255) NOT NULL, + METADATA VARCHAR(255) NOT NULL, + VALID VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, USER_NAME, METADATA_TYPE,METADATA)) +/ +CREATE TABLE IDN_THRIFT_SESSION ( + SESSION_ID VARCHAR2(255) NOT NULL, + USER_NAME VARCHAR2(255) NOT NULL, + CREATED_TIME VARCHAR2(255) NOT NULL, + LAST_MODIFIED_TIME VARCHAR2(255) NOT NULL, + PRIMARY KEY (SESSION_ID) +) +/ +CREATE TABLE IDN_AUTH_SESSION_STORE ( + SESSION_ID VARCHAR (100) NOT NULL, + SESSION_TYPE VARCHAR(100) NOT NULL, + SESSION_OBJECT BLOB, + TIME_CREATED TIMESTAMP, + PRIMARY KEY (SESSION_ID, SESSION_TYPE) +) +/ +CREATE TABLE SP_APP ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + APP_NAME VARCHAR (255) NOT NULL , + USER_STORE VARCHAR (255) NOT NULL, + USERNAME VARCHAR (255) NOT NULL , + DESCRIPTION VARCHAR (1024), + ROLE_CLAIM VARCHAR (512), + AUTH_TYPE VARCHAR (255) NOT NULL, + PROVISIONING_USERSTORE_DOMAIN VARCHAR (512), + IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '1', + IS_SEND_LOCAL_SUBJECT_ID CHAR(1) DEFAULT '0', + IS_SEND_AUTH_LIST_OF_IDPS CHAR(1) DEFAULT '0', + IS_USE_TENANT_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + IS_USE_USER_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + SUBJECT_CLAIM_URI VARCHAR (512), + IS_SAAS_APP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_APP_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER SP_APP_TRIG + BEFORE INSERT + ON SP_APP + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_APP_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID) +/ +CREATE TABLE SP_INBOUND_AUTH ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + INBOUND_AUTH_KEY VARCHAR (255) NOT NULL, + INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL, + PROP_NAME VARCHAR (255), + PROP_VALUE VARCHAR (1024) , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_INBOUND_AUTH_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER SP_INBOUND_AUTH_TRIG + BEFORE INSERT + ON SP_INBOUND_AUTH + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_INBOUND_AUTH_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_AUTH_STEP ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + STEP_ORDER INTEGER DEFAULT 1, + APP_ID INTEGER NOT NULL, + IS_SUBJECT_STEP CHAR(1) DEFAULT '0', + IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_AUTH_STEP_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER SP_AUTH_STEP_TRIG + BEFORE INSERT + ON SP_AUTH_STEP + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_AUTH_STEP_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_FEDERATED_IDP ( + ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_ID INTEGER NOT NULL, + PRIMARY KEY (ID, AUTHENTICATOR_ID)) +/ +ALTER TABLE SP_FEDERATED_IDP ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_CLAIM_MAPPING ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + IDP_CLAIM VARCHAR (512) NOT NULL , + SP_CLAIM VARCHAR (512) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_REQUESTED VARCHAR(128) DEFAULT '0', + DEFAULT_VALUE VARCHAR(255), + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_CLAIM_MAPPING_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER SP_CLAIM_MAPPING_TRIG + BEFORE INSERT + ON SP_CLAIM_MAPPING + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_CLAIM_MAPPING_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_ROLE_MAPPING ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + IDP_ROLE VARCHAR (255) NOT NULL , + SP_ROLE VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_ROLE_MAPPING_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER SP_ROLE_MAPPING_TRIG + BEFORE INSERT + ON SP_ROLE_MAPPING + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_ROLE_MAPPING_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_REQ_PATH_AUTHENTICATOR ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_REQ_PATH_AUTH_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER SP_REQ_PATH_AUTH_TRIG + BEFORE INSERT + ON SP_REQ_PATH_AUTHENTICATOR + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_REQ_PATH_AUTH_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE SP_PROVISIONING_CONNECTOR ( + ID INTEGER, + TENANT_ID INTEGER NOT NULL, + IDP_NAME VARCHAR (255) NOT NULL , + CONNECTOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_JIT_ENABLED CHAR(1) DEFAULT '0', + BLOCKING CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)) +/ +CREATE SEQUENCE SP_PROV_CONNECTOR_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER SP_PROV_CONNECTOR_TRIG + BEFORE INSERT + ON SP_PROVISIONING_CONNECTOR + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT SP_PROV_CONNECTOR_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +/ +CREATE TABLE IDP ( + ID INTEGER, + TENANT_ID INTEGER, + NAME VARCHAR(254) NOT NULL, + IS_ENABLED CHAR(1) DEFAULT '1', + IS_PRIMARY CHAR(1) DEFAULT '0', + HOME_REALM_ID VARCHAR(254), + IMAGE BLOB, + CERTIFICATE BLOB, + ALIAS VARCHAR(254), + INBOUND_PROV_ENABLED CHAR (1) DEFAULT '0', + INBOUND_PROV_USER_STORE_ID VARCHAR(254), + USER_CLAIM_URI VARCHAR(254), + ROLE_CLAIM_URI VARCHAR(254), + DESCRIPTION VARCHAR (1024), + DEFAULT_AUTHENTICATOR_NAME VARCHAR(254), + DEFAULT_PRO_CONNECTOR_NAME VARCHAR(254), + PROVISIONING_ROLE VARCHAR(128), + IS_FEDERATION_HUB CHAR(1) DEFAULT '0', + IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '0', + DISPLAY_NAME VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, NAME)) +/ +CREATE SEQUENCE IDP_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_TRIG + BEFORE INSERT + ON IDP + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost') +/ +CREATE TABLE IDP_ROLE ( + ID INTEGER, + IDP_ID INTEGER, + TENANT_ID INTEGER, + ROLE VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, ROLE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_ROLE_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_ROLE_TRIG + BEFORE INSERT + ON IDP_ROLE + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_ROLE_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_ROLE_MAPPING ( + ID INTEGER, + IDP_ROLE_ID INTEGER, + TENANT_ID INTEGER, + USER_STORE_ID VARCHAR (253), + LOCAL_ROLE VARCHAR(253), + PRIMARY KEY (ID), + UNIQUE (IDP_ROLE_ID, TENANT_ID, USER_STORE_ID, LOCAL_ROLE), + FOREIGN KEY (IDP_ROLE_ID) REFERENCES IDP_ROLE(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_ROLE_MAPPING_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_ROLE_MAPPING_TRIG + BEFORE INSERT + ON IDP_ROLE_MAPPING + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_ROLE_MAPPING_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_CLAIM ( + ID INTEGER, + IDP_ID INTEGER, + TENANT_ID INTEGER, + CLAIM VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, CLAIM), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_CLAIM_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_CLAIM_TRIG + BEFORE INSERT + ON IDP_CLAIM + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_CLAIM_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_CLAIM_MAPPING ( + ID INTEGER, + IDP_CLAIM_ID INTEGER, + TENANT_ID INTEGER, + LOCAL_CLAIM VARCHAR(253), + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (IDP_CLAIM_ID, TENANT_ID, LOCAL_CLAIM), + FOREIGN KEY (IDP_CLAIM_ID) REFERENCES IDP_CLAIM(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_CLAIM_MAPPING_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_CLAIM_MAPPING_TRIG + BEFORE INSERT + ON IDP_CLAIM_MAPPING + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_CLAIM_MAPPING_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_AUTHENTICATOR ( + ID INTEGER, + TENANT_ID INTEGER, + IDP_ID INTEGER, + NAME VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '1', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, NAME), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_AUTHENTICATOR_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_AUTHENTICATOR_TRIG + BEFORE INSERT + ON IDP_AUTHENTICATOR + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_AUTHENTICATOR_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'samlsso') +/ +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'IDPProperties') +/ +CREATE TABLE IDP_AUTHENTICATOR_PROPERTY ( + ID INTEGER, + TENANT_ID INTEGER, + AUTHENTICATOR_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2047), + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY), + FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_AUTHENTICATOR_PROP_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_AUTHENTICATOR_PROP_TRIG + BEFORE INSERT + ON IDP_AUTHENTICATOR_PROPERTY + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_AUTHENTICATOR_PROP_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +INSERT INTO IDP_AUTHENTICATOR_PROPERTY (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY,PROPERTY_VALUE, IS_SECRET ) VALUES (-1234, 1 , 'IdPEntityId', 'localhost', '0') +/ +CREATE TABLE IDP_PROVISIONING_CONFIG ( + ID INTEGER, + TENANT_ID INTEGER, + IDP_ID INTEGER, + PROVISIONING_CONNECTOR_TYPE VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '0', + IS_BLOCKING CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, PROVISIONING_CONNECTOR_TYPE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_PROVISIONING_CONFIG_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_PROVISIONING_CONFIG_TRIG + BEFORE INSERT + ON IDP_PROVISIONING_CONFIG + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_PROVISIONING_CONFIG_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_PROV_CONFIG_PROPERTY ( + ID INTEGER, + TENANT_ID INTEGER, + PROVISIONING_CONFIG_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2048), + PROPERTY_BLOB_VALUE BLOB, + PROPERTY_TYPE CHAR(32) NOT NULL, + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, PROVISIONING_CONFIG_ID, PROPERTY_KEY), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_PROV_CONFIG_PROP_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_PROV_CONFIG_PROP_TRIG + BEFORE INSERT + ON IDP_PROV_CONFIG_PROPERTY + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_PROV_CONFIG_PROP_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_PROVISIONING_ENTITY ( + ID INTEGER, + PROVISIONING_CONFIG_ID INTEGER, + ENTITY_TYPE VARCHAR(255) NOT NULL, + ENTITY_LOCAL_USERSTORE VARCHAR(255) NOT NULL, + ENTITY_NAME VARCHAR(255) NOT NULL, + ENTITY_VALUE VARCHAR(255), + TENANT_ID INTEGER, + PRIMARY KEY (ID), + UNIQUE (ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID), + UNIQUE (PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_PROV_ENTITY_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_PROV_ENTITY_TRIG + BEFORE INSERT + ON IDP_PROVISIONING_ENTITY + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_PROV_ENTITY_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDP_LOCAL_CLAIM ( + ID INTEGER, + TENANT_ID INTEGER, + IDP_ID INTEGER, + CLAIM_URI VARCHAR(255) NOT NULL, + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, CLAIM_URI), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE) +/ +CREATE SEQUENCE IDP_LOCAL_CLAIM_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER IDP_LOCAL_CLAIM_TRIG + BEFORE INSERT + ON IDP_LOCAL_CLAIM + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDP_LOCAL_CLAIM_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDN_ASSOCIATED_ID ( + ID INTEGER, + IDP_USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + IDP_ID INTEGER NOT NULL, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (ID), + UNIQUE(IDP_USER_ID, TENANT_ID, IDP_ID), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +) +/ +CREATE SEQUENCE IDN_ASSOCIATED_ID_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER IDN_ASSOCIATED_ID_TRIG + BEFORE INSERT + ON IDN_ASSOCIATED_ID + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT IDN_ASSOCIATED_ID_SEQ.nextval INTO :NEW.ID FROM dual; + END; +/ +CREATE TABLE IDN_USER_ACCOUNT_ASSOCIATION ( + ASSOCIATION_KEY VARCHAR(255) NOT NULL, + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME)) +/ +CREATE TABLE FIDO_DEVICE_STORE ( + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(45) NOT NULL, + TIME_REGISTERED TIMESTAMP, + KEY_HANDLE VARCHAR(200) NOT NULL, + DEVICE_DATA VARCHAR(2048) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE)) +/ + +CREATE TABLE WF_REQUEST ( + UUID VARCHAR2 (45), + CREATED_BY VARCHAR2 (255), + TENANT_ID INTEGER DEFAULT -1, + OPERATION_TYPE VARCHAR2 (50), + CREATED_AT TIMESTAMP, + UPDATED_AT TIMESTAMP, + STATUS VARCHAR2 (30), + REQUEST BLOB, + PRIMARY KEY (UUID)) +/ + +CREATE TABLE WF_BPS_PROFILE ( + PROFILE_NAME VARCHAR2(45), + HOST_URL VARCHAR2(45), + USERNAME VARCHAR2(45), + PASSWORD VARCHAR2(255), + CALLBACK_HOST VARCHAR2 (45), + CALLBACK_USERNAME VARCHAR2 (45), + CALLBACK_PASSWORD VARCHAR2 (255), + TENANT_ID VARCHAR2 (45), + PRIMARY KEY (PROFILE_NAME, TENANT_ID)) +/ + +CREATE TABLE WF_WORKFLOW( + ID VARCHAR2 (45), + WF_NAME VARCHAR2 (45), + DESCRIPTION VARCHAR2 (255), + TEMPLATE_ID VARCHAR2 (45), + IMPL_ID VARCHAR2 (45), + TENANT_ID VARCHAR2 (45), + PRIMARY KEY (ID)) +/ + +CREATE TABLE WF_WORKFLOW_ASSOCIATION( + ID INTEGER, + ASSOC_NAME VARCHAR2 (45), + EVENT_ID VARCHAR2(45), + ASSOC_CONDITION VARCHAR2 (2000), + WORKFLOW_ID VARCHAR2 (45), + IS_ENABLED CHAR (1) DEFAULT '1', + PRIMARY KEY(ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE) +/ + +CREATE SEQUENCE WF_WORKFLOW_ASSOCIATION_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER WF_WORKFLOW_ASSOCIATION_TRIG +BEFORE INSERT +ON WF_WORKFLOW_ASSOCIATION +REFERENCING NEW AS NEW +FOR EACH ROW + BEGIN + SELECT WF_WORKFLOW_ASSOCIATION_SEQ.nextval + INTO :NEW.ID + FROM dual; + END; +/ + +CREATE TABLE WF_WORKFLOW_CONFIG_PARAM( + WORKFLOW_ID VARCHAR2 (45), + PARAM_NAME VARCHAR2 (45), + PARAM_VALUE VARCHAR2 (1000), + PRIMARY KEY (WORKFLOW_ID, PARAM_NAME), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE) +/ + +CREATE TABLE WF_REQUEST_ENTITY_RELATIONSHIP( + REQUEST_ID VARCHAR2 (45), + ENTITY_NAME VARCHAR2 (255), + ENTITY_TYPE VARCHAR2 (50), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY(REQUEST_ID, ENTITY_NAME, ENTITY_TYPE, TENANT_ID), + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE) +/ + +CREATE TABLE WORKFLOW_REQUEST_RELATION( + RELATIONSHIP_ID VARCHAR2 (45), + WORKFLOW_ID VARCHAR2 (45), + REQUEST_ID VARCHAR2 (45), + UPDATED_AT TIMESTAMP, + STATUS VARCHAR (30), + PRIMARY KEY (RELATIONSHIP_ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE, + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE) +/ + +-- End of IDENTITY Tables-- + +-- Start of API-MGT Tables-- +CREATE TABLE AM_SUBSCRIBER ( + SUBSCRIBER_ID INTEGER, + USER_ID VARCHAR2(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EMAIL_ADDRESS VARCHAR2(256) NULL, + DATE_SUBSCRIBED DATE NOT NULL, + CREATED_BY VARCHAR2(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR2(100), + UPDATED_TIME DATE, + PRIMARY KEY (SUBSCRIBER_ID), + UNIQUE (TENANT_ID,USER_ID) +) +/ + +CREATE SEQUENCE AM_SUBSCRIBER_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_SUBSCRIBER_TRIGGER + BEFORE INSERT + ON AM_SUBSCRIBER + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_SUBSCRIBER_SEQUENCE.nextval INTO :NEW.SUBSCRIBER_ID FROM dual; + END; +/ +-- TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(SUBSCRIBER_ID) relation +CREATE TABLE AM_APPLICATION ( + APPLICATION_ID INTEGER, + NAME VARCHAR2(100), + SUBSCRIBER_ID INTEGER, + APPLICATION_TIER VARCHAR2(50) DEFAULT 'Unlimited', + CALLBACK_URL VARCHAR2(512), + DESCRIPTION VARCHAR2(512), + APPLICATION_STATUS VARCHAR2(50) DEFAULT 'APPROVED', + GROUP_ID VARCHAR(100), + CREATED_BY VARCHAR2(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR2(100), + UPDATED_TIME DATE, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON DELETE CASCADE, + PRIMARY KEY(APPLICATION_ID), + UNIQUE (NAME,SUBSCRIBER_ID) +) +/ + +CREATE SEQUENCE AM_APPLICATION_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_APPLICATION_TRIGGER + BEFORE INSERT + ON AM_APPLICATION + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_APPLICATION_SEQUENCE.nextval INTO :NEW.APPLICATION_ID FROM dual; + END; +/ + +CREATE TABLE AM_API ( + API_ID INTEGER, + API_PROVIDER VARCHAR2(256), + API_NAME VARCHAR2(256), + API_VERSION VARCHAR2(30), + CONTEXT VARCHAR2(256), + CONTEXT_TEMPLATE VARCHAR2(256), + CREATED_BY VARCHAR2(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR2(100), + UPDATED_TIME DATE, + PRIMARY KEY(API_ID), + UNIQUE (API_PROVIDER,API_NAME,API_VERSION) +) +/ + +CREATE SEQUENCE AM_API_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_API_TRIGGER + BEFORE INSERT + ON AM_API + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_SEQUENCE.nextval INTO :NEW.API_ID FROM dual; + END; +/ + +CREATE TABLE AM_API_URL_MAPPING ( + URL_MAPPING_ID INTEGER, + API_ID INTEGER NOT NULL, + HTTP_METHOD VARCHAR(20) NULL, + AUTH_SCHEME VARCHAR(50) NULL, + URL_PATTERN VARCHAR(512) NULL, + THROTTLING_TIER varchar(512) DEFAULT NULL, + MEDIATION_SCRIPT BLOB, + PRIMARY KEY(URL_MAPPING_ID) +) +/ + +CREATE SEQUENCE AM_API_URL_MAPPING_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_API_URL_MAPPING_TRIGGER + BEFORE INSERT + ON AM_API_URL_MAPPING + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_URL_MAPPING_SEQUENCE.nextval INTO :NEW.URL_MAPPING_ID FROM dual; + END; +/ + +-- TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(SUBSCRIPTION_ID) relation +CREATE TABLE AM_SUBSCRIPTION ( + SUBSCRIPTION_ID INTEGER, + TIER_ID VARCHAR2(50), + API_ID INTEGER, + LAST_ACCESSED DATE NULL, + APPLICATION_ID INTEGER, + SUB_STATUS VARCHAR(50), + SUBS_CREATE_STATE VARCHAR(50) DEFAULT 'SUBSCRIBE', + CREATED_BY VARCHAR2(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR2(100), + UPDATED_TIME DATE, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON DELETE CASCADE, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, + PRIMARY KEY (SUBSCRIPTION_ID) +) +/ + +CREATE SEQUENCE AM_SUBSCRIPTION_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_SUBSCRIPTION_TRIGGER + BEFORE INSERT + ON AM_SUBSCRIPTION + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_SUBSCRIPTION_SEQUENCE.nextval INTO :NEW.SUBSCRIPTION_ID FROM dual; + END; +/ +-- TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(APPLICATION_ID) and FOREIGN KEY(API_ID) relations +CREATE TABLE AM_SUBSCRIPTION_KEY_MAPPING ( + SUBSCRIPTION_ID INTEGER, + ACCESS_TOKEN VARCHAR2(512), + KEY_TYPE VARCHAR2(512) NOT NULL, + FOREIGN KEY(SUBSCRIPTION_ID) REFERENCES AM_SUBSCRIPTION(SUBSCRIPTION_ID) ON DELETE CASCADE, + PRIMARY KEY(SUBSCRIPTION_ID,ACCESS_TOKEN) +) +/ +--TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(APPLICATION_ID) relation +CREATE TABLE AM_APPLICATION_KEY_MAPPING ( + APPLICATION_ID INTEGER, + CONSUMER_KEY VARCHAR2(512), + KEY_TYPE VARCHAR2(512) NOT NULL, + CREATE_MODE VARCHAR2(30) DEFAULT 'CREATED', + STATE VARCHAR2(30) NOT NULL, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON DELETE CASCADE, + PRIMARY KEY(APPLICATION_ID,KEY_TYPE) +) +/ + +CREATE TABLE AM_APPLICATION_REGISTRATION ( + REG_ID INTEGER , + SUBSCRIBER_ID INTEGER, + WF_REF VARCHAR2(255) NOT NULL, + APP_ID INTEGER, + TOKEN_TYPE VARCHAR2(30), + TOKEN_SCOPE VARCHAR2(256) DEFAULT 'default', + INPUTS VARCHAR2(1000), + ALLOWED_DOMAINS VARCHAR2(256), + VALIDITY_PERIOD NUMBER(19), + UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE), + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID), + FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID), + PRIMARY KEY (REG_ID) +) +/ +-- TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(API_ID) relation +CREATE TABLE AM_API_LC_EVENT ( + EVENT_ID INTEGER, + API_ID INTEGER NOT NULL, + PREVIOUS_STATE VARCHAR2(50), + NEW_STATE VARCHAR2(50) NOT NULL, + USER_ID VARCHAR2(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EVENT_DATE DATE NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, + PRIMARY KEY (EVENT_ID) +) +/ + +CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING ( + CONSUMER_KEY VARCHAR(255), + AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL', + PRIMARY KEY (CONSUMER_KEY,AUTHZ_DOMAIN) +) +/ + +CREATE TABLE AM_API_COMMENTS ( + COMMENT_ID INTEGER, + COMMENT_TEXT VARCHAR2(512), + COMMENTED_USER VARCHAR2(255), + DATE_COMMENTED DATE NOT NULL, + API_ID INTEGER NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, + PRIMARY KEY (COMMENT_ID) +) +/ + +CREATE SEQUENCE AM_API_COMMENTS_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_API_COMMENTS_TRIGGER + BEFORE INSERT + ON AM_API_COMMENTS + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_COMMENTS_SEQUENCE.nextval INTO :NEW.COMMENT_ID FROM dual; + END; +/ + +CREATE TABLE AM_API_RATINGS ( + RATING_ID INTEGER, + API_ID INTEGER, + RATING INTEGER, + SUBSCRIBER_ID INTEGER, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON DELETE CASCADE, + PRIMARY KEY (RATING_ID) +) +/ + +CREATE SEQUENCE AM_API_RATINGS_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_API_RATINGS_TRIGGER + BEFORE INSERT + ON AM_API_RATINGS + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_RATINGS_SEQUENCE.nextval INTO :NEW.RATING_ID FROM dual; + END; +/ + +CREATE TABLE AM_TIER_PERMISSIONS ( + TIER_PERMISSIONS_ID INTEGER, + TIER VARCHAR2(50) NOT NULL, + PERMISSIONS_TYPE VARCHAR2(50) NOT NULL, + ROLES VARCHAR2(512) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(TIER_PERMISSIONS_ID) +) +/ + +CREATE SEQUENCE AM_TIER_PERMISSIONS_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_TIER_PERMISSIONS_TRIGGER + BEFORE INSERT + ON AM_TIER_PERMISSIONS + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_TIER_PERMISSIONS_SEQUENCE.nextval INTO :NEW.TIER_PERMISSIONS_ID FROM dual; + END; +/ + +CREATE SEQUENCE AM_API_LC_EVENT_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_API_LC_EVENT_TRIGGER + BEFORE INSERT + ON AM_API_LC_EVENT + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_LC_EVENT_SEQUENCE.nextval INTO :NEW.EVENT_ID FROM dual; + END; +/ +-- Start of IDP-APPLICATION-MGT Tables -- + +-- End of IDP-APPLICATION-MGT Tables -- + + +CREATE TABLE AM_EXTERNAL_STORES ( + APISTORE_ID INTEGER, + API_ID INTEGER, + STORE_ID VARCHAR2(255) NOT NULL, + STORE_DISPLAY_NAME VARCHAR2(255) NOT NULL, + STORE_ENDPOINT VARCHAR2(255) NOT NULL, + STORE_TYPE VARCHAR2(255) NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, + PRIMARY KEY (APISTORE_ID) +) +/ + +CREATE TABLE AM_WORKFLOWS( + WF_ID INTEGER, + WF_REFERENCE VARCHAR(255) NOT NULL, + WF_TYPE VARCHAR(255) NOT NULL, + WF_STATUS VARCHAR(255) NOT NULL, + WF_CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + WF_UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + WF_STATUS_DESC VARCHAR(1000), + TENANT_ID INTEGER, + TENANT_DOMAIN VARCHAR(255), + WF_EXTERNAL_REFERENCE VARCHAR(255) NOT NULL UNIQUE, + PRIMARY KEY (WF_ID) +) +/ + +CREATE TABLE AM_API_SCOPES ( + API_ID INTEGER NOT NULL, + SCOPE_ID INTEGER NOT NULL, + FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE, + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE +) +/ +CREATE SEQUENCE AM_APP_REGISTRATION_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_APP_REGISTRATION_TRIGGER + BEFORE INSERT + ON AM_APPLICATION_REGISTRATION + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_APP_REGISTRATION_SEQUENCE.nextval INTO :NEW.REG_ID FROM dual; + END; +/ + +CREATE SEQUENCE AM_WORKFLOWS_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_WORKFLOWS_TRIGGER + BEFORE INSERT + ON AM_WORKFLOWS + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_WORKFLOWS_SEQUENCE.nextval INTO :NEW.WF_ID FROM dual; + END; +/ + +CREATE SEQUENCE AM_EXTERNAL_STORES_SEQUENCE START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ + +CREATE OR REPLACE TRIGGER AM_EXTERNAL_STORES_TRIGGER + BEFORE INSERT + ON AM_EXTERNAL_STORES + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_EXTERNAL_STORES_SEQUENCE.nextval INTO :NEW.APISTORE_ID FROM dual; + END; +/ + +CREATE TABLE AM_API_DEFAULT_VERSION ( + DEFAULT_VERSION_ID NUMBER, + API_NAME VARCHAR(256) NOT NULL , + API_PROVIDER VARCHAR(256) NOT NULL , + DEFAULT_API_VERSION VARCHAR(30) , + PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) , + PRIMARY KEY (DEFAULT_VERSION_ID) +) +/ +CREATE SEQUENCE AM_API_DEFAULT_VERSION_SEQ START WITH 1 INCREMENT BY 1 CACHE 20 ORDER +/ +CREATE OR REPLACE TRIGGER AM_API_DEFAULT_VERSION_TRG + BEFORE INSERT + ON AM_API_DEFAULT_VERSION + REFERENCING NEW AS NEW + FOR EACH ROW + BEGIN + SELECT AM_API_DEFAULT_VERSION_SEQ.nextval INTO :NEW.DEFAULT_VERSION_ID FROM dual; + END; +/ +CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID) +/ + diff --git a/modules/distribution/src/api-resource/sql/postgresql.sql b/modules/distribution/src/api-resource/sql/postgresql.sql new file mode 100644 index 00000000..7545a9c4 --- /dev/null +++ b/modules/distribution/src/api-resource/sql/postgresql.sql @@ -0,0 +1,859 @@ +BEGIN TRANSACTION; + +-- Start of IDN Tables -- +DROP TABLE IF EXISTS IDN_BASE_TABLE; +CREATE TABLE IDN_BASE_TABLE ( + PRODUCT_NAME VARCHAR(20), + PRIMARY KEY (PRODUCT_NAME) +); + +INSERT INTO IDN_BASE_TABLE values ('WSO2 Identity Server'); + +DROP TABLE IF EXISTS IDN_OAUTH_CONSUMER_APPS; +DROP SEQUENCE IF EXISTS IDN_OAUTH_CONSUMER_APPS_PK_SEQ; +CREATE SEQUENCE IDN_OAUTH_CONSUMER_APPS_PK_SEQ; +CREATE TABLE IDN_OAUTH_CONSUMER_APPS ( + ID INTEGER DEFAULT NEXTVAL('IDN_OAUTH_CONSUMER_APPS_PK_SEQ'), + CONSUMER_KEY VARCHAR(255), + CONSUMER_SECRET VARCHAR(512), + USERNAME VARCHAR(255), + TENANT_ID INTEGER DEFAULT 0, + APP_NAME VARCHAR(255), + OAUTH_VERSION VARCHAR(128), + CALLBACK_URL VARCHAR(1024), + GRANT_TYPES VARCHAR (1024), + CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY), + PRIMARY KEY (ID) +); + +DROP TABLE IF EXISTS IDN_OAUTH1A_REQUEST_TOKEN; +CREATE TABLE IDN_OAUTH1A_REQUEST_TOKEN ( + REQUEST_TOKEN VARCHAR(512), + REQUEST_TOKEN_SECRET VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR(1024), + SCOPE VARCHAR(2048), + AUTHORIZED VARCHAR(128), + OAUTH_VERIFIER VARCHAR(512), + AUTHZ_USER VARCHAR(512), + PRIMARY KEY (REQUEST_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +DROP TABLE IF EXISTS IDN_OAUTH1A_ACCESS_TOKEN; +CREATE TABLE IDN_OAUTH1A_ACCESS_TOKEN ( + ACCESS_TOKEN VARCHAR(512), + ACCESS_TOKEN_SECRET VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR(512), + PRIMARY KEY (ACCESS_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +DROP TABLE IF EXISTS IDN_OAUTH2_ACCESS_TOKEN; +CREATE TABLE IDN_OAUTH2_ACCESS_TOKEN ( + TOKEN_ID VARCHAR (255), + ACCESS_TOKEN VARCHAR(255), + REFRESH_TOKEN VARCHAR(255), + CONSUMER_KEY_ID INTEGER, + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + USER_TYPE VARCHAR (25), + TIME_CREATED TIMESTAMP, + REFRESH_TOKEN_TIME_CREATED TIMESTAMP, + VALIDITY_PERIOD BIGINT, + REFRESH_TOKEN_VALIDITY_PERIOD BIGINT, + TOKEN_SCOPE_HASH VARCHAR(32), + TOKEN_STATE VARCHAR(25) DEFAULT 'ACTIVE', + TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE', + PRIMARY KEY (TOKEN_ID), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE, + CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TOKEN_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH, + TOKEN_STATE,TOKEN_STATE_ID) +); + +CREATE INDEX IDX_AT_CK_AU ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TOKEN_STATE, USER_TYPE); + +CREATE INDEX IDX_TC ON IDN_OAUTH2_ACCESS_TOKEN(TIME_CREATED); + +DROP TABLE IF EXISTS IDN_OAUTH2_AUTHORIZATION_CODE; +CREATE TABLE IDN_OAUTH2_AUTHORIZATION_CODE ( + AUTHORIZATION_CODE VARCHAR(512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR(1024), + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + TIME_CREATED TIMESTAMP, + VALIDITY_PERIOD BIGINT, + STATE VARCHAR (25) DEFAULT 'ACTIVE', + TOKEN_ID VARCHAR(255), + PRIMARY KEY (AUTHORIZATION_CODE), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +DROP TABLE IF EXISTS IDN_OAUTH2_SCOPE_ASSOCIATION; +CREATE TABLE IDN_OAUTH2_SCOPE_ASSOCIATION ( + TOKEN_ID VARCHAR (255), + TOKEN_SCOPE VARCHAR (60), + PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), + FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE); + +DROP TABLE IF EXISTS IDN_OAUTH2_SCOPE; +DROP SEQUENCE IF EXISTS IDN_OAUTH2_SCOPE_PK_SEQ; +CREATE SEQUENCE IDN_OAUTH2_SCOPE_PK_SEQ; +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE ( + SCOPE_ID INTEGER DEFAULT NEXTVAL('IDN_OAUTH2_SCOPE_PK_SEQ'), + SCOPE_KEY VARCHAR(100) NOT NULL, + NAME VARCHAR(255) NULL, + DESCRIPTION VARCHAR(512) NULL, + TENANT_ID INTEGER DEFAULT 0, + ROLES VARCHAR (500) NULL, + PRIMARY KEY (SCOPE_ID) +); + +DROP TABLE IF EXISTS IDN_OAUTH2_RESOURCE_SCOPE; +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_RESOURCE_SCOPE ( + RESOURCE_PATH VARCHAR(255) NOT NULL, + SCOPE_ID INTEGER NOT NULL, + PRIMARY KEY (RESOURCE_PATH), + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) +); + +DROP TABLE IF EXISTS IDN_SCIM_GROUP; +DROP SEQUENCE IF EXISTS IDN_SCIM_GROUP_PK_SEQ; +CREATE SEQUENCE IDN_SCIM_GROUP_PK_SEQ; +CREATE TABLE IDN_SCIM_GROUP ( + ID INTEGER DEFAULT NEXTVAL('IDN_SCIM_GROUP_PK_SEQ'), + TENANT_ID INTEGER NOT NULL, + ROLE_NAME VARCHAR(255) NOT NULL, + ATTR_NAME VARCHAR(1024) NOT NULL, + ATTR_VALUE VARCHAR(1024), + PRIMARY KEY (ID) +); + +DROP TABLE IF EXISTS IDN_OPENID_REMEMBER_ME; +CREATE TABLE IDN_OPENID_REMEMBER_ME ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + COOKIE_VALUE VARCHAR(1024), + CREATED_TIME TIMESTAMP, + PRIMARY KEY (USER_NAME, TENANT_ID) +); + +DROP TABLE IF EXISTS IDN_OPENID_USER_RPS; +CREATE TABLE IDN_OPENID_USER_RPS ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + RP_URL VARCHAR(255) NOT NULL, + TRUSTED_ALWAYS VARCHAR(128) DEFAULT 'FALSE', + LAST_VISIT DATE NOT NULL, + VISIT_COUNT INTEGER DEFAULT 0, + DEFAULT_PROFILE_NAME VARCHAR(255) DEFAULT 'DEFAULT', + PRIMARY KEY (USER_NAME, TENANT_ID, RP_URL) +); + +DROP TABLE IF EXISTS IDN_OPENID_ASSOCIATIONS; +CREATE TABLE IDN_OPENID_ASSOCIATIONS ( + HANDLE VARCHAR(255) NOT NULL, + ASSOC_TYPE VARCHAR(255) NOT NULL, + EXPIRE_IN TIMESTAMP NOT NULL, + MAC_KEY VARCHAR(255) NOT NULL, + ASSOC_STORE VARCHAR(128) DEFAULT 'SHARED', + PRIMARY KEY (HANDLE) +); + +DROP TABLE IF EXISTS IDN_STS_STORE; +DROP SEQUENCE IF EXISTS IDN_STS_STORE_PK_SEQ; +CREATE SEQUENCE IDN_STS_STORE_PK_SEQ; +CREATE TABLE IDN_STS_STORE ( + ID INTEGER DEFAULT NEXTVAL('IDN_STS_STORE_PK_SEQ'), + TOKEN_ID VARCHAR(255) NOT NULL, + TOKEN_CONTENT BYTEA NOT NULL, + CREATE_DATE TIMESTAMP NOT NULL, + EXPIRE_DATE TIMESTAMP NOT NULL, + STATE INTEGER DEFAULT 0, + PRIMARY KEY (ID) +); + +DROP TABLE IF EXISTS IDN_IDENTITY_USER_DATA; +CREATE TABLE IDN_IDENTITY_USER_DATA ( + TENANT_ID INTEGER DEFAULT -1234, + USER_NAME VARCHAR(255) NOT NULL, + DATA_KEY VARCHAR(255) NOT NULL, + DATA_VALUE VARCHAR(255), + PRIMARY KEY (TENANT_ID, USER_NAME, DATA_KEY) +); + +DROP TABLE IF EXISTS IDN_IDENTITY_META_DATA; +CREATE TABLE IDN_IDENTITY_META_DATA ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + METADATA_TYPE VARCHAR(255) NOT NULL, + METADATA VARCHAR(255) NOT NULL, + VALID VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, USER_NAME, METADATA_TYPE,METADATA) +); + +DROP TABLE IF EXISTS IDN_THRIFT_SESSION; +CREATE TABLE IDN_THRIFT_SESSION ( + SESSION_ID VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + CREATED_TIME VARCHAR(255) NOT NULL, + LAST_MODIFIED_TIME VARCHAR(255) NOT NULL, + PRIMARY KEY (SESSION_ID) +); + +DROP TABLE IF EXISTS IDN_AUTH_SESSION_STORE; +CREATE TABLE IDN_AUTH_SESSION_STORE ( + SESSION_ID VARCHAR(100) NOT NULL, + SESSION_TYPE VARCHAR(100) NOT NULL, + SESSION_OBJECT BYTEA, + TIME_CREATED TIMESTAMP, + PRIMARY KEY (SESSION_ID, SESSION_TYPE) + ); + +DROP TABLE IF EXISTS SP_APP; +DROP SEQUENCE IF EXISTS SP_APP_SEQ; +CREATE SEQUENCE SP_APP_SEQ; +CREATE TABLE SP_APP ( + ID INTEGER DEFAULT NEXTVAL('SP_APP_SEQ'), + TENANT_ID INTEGER NOT NULL, + APP_NAME VARCHAR (255) NOT NULL , + USER_STORE VARCHAR (255) NOT NULL, + USERNAME VARCHAR (255) NOT NULL , + DESCRIPTION VARCHAR (1024), + ROLE_CLAIM VARCHAR (512), + AUTH_TYPE VARCHAR (255) NOT NULL, + PROVISIONING_USERSTORE_DOMAIN VARCHAR (512), + IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '1', + IS_SEND_LOCAL_SUBJECT_ID CHAR(1) DEFAULT '0', + IS_SEND_AUTH_LIST_OF_IDPS CHAR(1) DEFAULT '0', + IS_USE_TENANT_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + IS_USE_USER_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + SUBJECT_CLAIM_URI VARCHAR (512), + IS_SAAS_APP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID); + +DROP TABLE IF EXISTS SP_INBOUND_AUTH; +DROP SEQUENCE IF EXISTS SP_INBOUND_AUTH_SEQ; +CREATE SEQUENCE SP_INBOUND_AUTH_SEQ; +CREATE TABLE SP_INBOUND_AUTH ( + ID INTEGER DEFAULT NEXTVAL('SP_INBOUND_AUTH_SEQ'), + TENANT_ID INTEGER NOT NULL, + INBOUND_AUTH_KEY VARCHAR (255) NOT NULL, + INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL, + PROP_NAME VARCHAR (255), + PROP_VALUE VARCHAR (1024) , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +DROP TABLE IF EXISTS SP_AUTH_STEP; +DROP SEQUENCE IF EXISTS SP_AUTH_STEP_SEQ; +CREATE SEQUENCE SP_AUTH_STEP_SEQ; +CREATE TABLE SP_AUTH_STEP ( + ID INTEGER DEFAULT NEXTVAL('SP_AUTH_STEP_SEQ'), + TENANT_ID INTEGER NOT NULL, + STEP_ORDER INTEGER DEFAULT 1, + APP_ID INTEGER NOT NULL, + IS_SUBJECT_STEP CHAR(1) DEFAULT '0', + IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +DROP TABLE IF EXISTS SP_FEDERATED_IDP; +CREATE TABLE SP_FEDERATED_IDP ( + ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_ID INTEGER NOT NULL, + PRIMARY KEY (ID, AUTHENTICATOR_ID)); + +ALTER TABLE SP_FEDERATED_IDP ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE; + +DROP TABLE IF EXISTS SP_CLAIM_MAPPING; +DROP SEQUENCE IF EXISTS SP_CLAIM_MAPPING_SEQ; +CREATE SEQUENCE SP_CLAIM_MAPPING_SEQ; +CREATE TABLE SP_CLAIM_MAPPING ( + ID INTEGER DEFAULT NEXTVAL('SP_CLAIM_MAPPING_SEQ'), + TENANT_ID INTEGER NOT NULL, + IDP_CLAIM VARCHAR (512) NOT NULL , + SP_CLAIM VARCHAR (512) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_REQUESTED VARCHAR(128) DEFAULT '0', + DEFAULT_VALUE VARCHAR(255), + PRIMARY KEY (ID)); + +ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +DROP TABLE IF EXISTS SP_ROLE_MAPPING; +DROP SEQUENCE IF EXISTS SP_ROLE_MAPPING_SEQ; +CREATE SEQUENCE SP_ROLE_MAPPING_SEQ; +CREATE TABLE SP_ROLE_MAPPING ( + ID INTEGER DEFAULT NEXTVAL('SP_ROLE_MAPPING_SEQ'), + TENANT_ID INTEGER NOT NULL, + IDP_ROLE VARCHAR (255) NOT NULL , + SP_ROLE VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +DROP TABLE IF EXISTS SP_REQ_PATH_AUTH; +DROP SEQUENCE IF EXISTS SP_REQ_PATH_AUTH_SEQ; +CREATE SEQUENCE SP_REQ_PATH_AUTH_SEQ; +CREATE TABLE SP_REQ_PATH_AUTHENTICATOR ( + ID INTEGER DEFAULT NEXTVAL('SP_REQ_PATH_AUTH_SEQ'), + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +DROP TABLE IF EXISTS SP_PROV_CONNECTOR; +DROP SEQUENCE IF EXISTS SP_PROV_CONNECTOR_SEQ; +CREATE SEQUENCE SP_PROV_CONNECTOR_SEQ; +CREATE TABLE SP_PROVISIONING_CONNECTOR ( + ID INTEGER DEFAULT NEXTVAL('SP_PROV_CONNECTOR_SEQ'), + TENANT_ID INTEGER NOT NULL, + IDP_NAME VARCHAR (255) NOT NULL , + CONNECTOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_JIT_ENABLED CHAR(1) NOT NULL DEFAULT '0', + BLOCKING CHAR(1) NOT NULL DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +DROP TABLE IF EXISTS IDP; +DROP SEQUENCE IF EXISTS IDP_SEQ; +CREATE SEQUENCE IDP_SEQ; +CREATE TABLE IDP ( + ID INTEGER DEFAULT NEXTVAL('IDP_SEQ'), + TENANT_ID INTEGER, + NAME VARCHAR(254) NOT NULL, + IS_ENABLED CHAR(1) NOT NULL DEFAULT '1', + IS_PRIMARY CHAR(1) NOT NULL DEFAULT '0', + HOME_REALM_ID VARCHAR(254), + IMAGE BYTEA, + CERTIFICATE BYTEA, + ALIAS VARCHAR(254), + INBOUND_PROV_ENABLED CHAR (1) NOT NULL DEFAULT '0', + INBOUND_PROV_USER_STORE_ID VARCHAR(254), + USER_CLAIM_URI VARCHAR(254), + ROLE_CLAIM_URI VARCHAR(254), + DESCRIPTION VARCHAR (1024), + DEFAULT_AUTHENTICATOR_NAME VARCHAR(254), + DEFAULT_PRO_CONNECTOR_NAME VARCHAR(254), + PROVISIONING_ROLE VARCHAR(128), + IS_FEDERATION_HUB CHAR(1) NOT NULL DEFAULT '0', + IS_LOCAL_CLAIM_DIALECT CHAR(1) NOT NULL DEFAULT '0', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, NAME)); + +INSERT INTO IDP (TENANT_ID, NAME, HOME_REALM_ID) VALUES (-1234, 'LOCAL', 'localhost'); + +DROP TABLE IF EXISTS IDP_ROLE; +DROP SEQUENCE IF EXISTS IDP_ROLE_SEQ; +CREATE SEQUENCE IDP_ROLE_SEQ; +CREATE TABLE IDP_ROLE ( + ID INTEGER DEFAULT NEXTVAL('IDP_ROLE_SEQ'), + IDP_ID INTEGER, + TENANT_ID INTEGER, + ROLE VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, ROLE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +DROP TABLE IF EXISTS IDP_ROLE_MAPPING; +DROP SEQUENCE IF EXISTS IDP_ROLE_MAPPING_SEQ; +CREATE SEQUENCE IDP_ROLE_MAPPING_SEQ; +CREATE TABLE IDP_ROLE_MAPPING ( + ID INTEGER DEFAULT NEXTVAL('IDP_ROLE_MAPPING_SEQ'), + IDP_ROLE_ID INTEGER, + TENANT_ID INTEGER, + USER_STORE_ID VARCHAR (253), + LOCAL_ROLE VARCHAR(253), + PRIMARY KEY (ID), + UNIQUE (IDP_ROLE_ID, TENANT_ID, USER_STORE_ID, LOCAL_ROLE), + FOREIGN KEY (IDP_ROLE_ID) REFERENCES IDP_ROLE(ID) ON DELETE CASCADE); + +DROP TABLE IF EXISTS IDP_CLAIM; +DROP SEQUENCE IF EXISTS IDP_CLAIM_SEQ; +CREATE SEQUENCE IDP_CLAIM_SEQ; +CREATE TABLE IDP_CLAIM ( + ID INTEGER DEFAULT NEXTVAL('IDP_CLAIM_SEQ'), + IDP_ID INTEGER, + TENANT_ID INTEGER, + CLAIM VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, CLAIM), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +DROP TABLE IF EXISTS IDP_CLAIM_MAPPING; +DROP SEQUENCE IF EXISTS IDP_CLAIM_MAPPING_SEQ; +CREATE SEQUENCE IDP_CLAIM_MAPPING_SEQ; +CREATE TABLE IDP_CLAIM_MAPPING ( + ID INTEGER DEFAULT NEXTVAL('IDP_CLAIM_MAPPING_SEQ'), + IDP_CLAIM_ID INTEGER, + TENANT_ID INTEGER, + LOCAL_CLAIM VARCHAR(253), + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (IDP_CLAIM_ID, TENANT_ID, LOCAL_CLAIM), + FOREIGN KEY (IDP_CLAIM_ID) REFERENCES IDP_CLAIM(ID) ON DELETE CASCADE); + +DROP TABLE IF EXISTS IDP_AUTHENTICATOR; +DROP SEQUENCE IF EXISTS IDP_AUTHENTICATOR_SEQ; +CREATE SEQUENCE IDP_AUTHENTICATOR_SEQ; +CREATE TABLE IDP_AUTHENTICATOR ( + ID INTEGER DEFAULT NEXTVAL('IDP_AUTHENTICATOR_SEQ'), + TENANT_ID INTEGER, + IDP_ID INTEGER, + NAME VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '1', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, NAME), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'samlsso'); +INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME) VALUES (-1234, 1, 'IDPProperties'); + +DROP TABLE IF EXISTS IDP_AUTHENTICATOR_PROP; +DROP SEQUENCE IF EXISTS IDP_AUTHENTICATOR_PROP_SEQ; +CREATE SEQUENCE IDP_AUTHENTICATOR_PROP_SEQ; +CREATE TABLE IDP_AUTHENTICATOR_PROPERTY ( + ID INTEGER DEFAULT NEXTVAL('IDP_AUTHENTICATOR_PROP_SEQ'), + TENANT_ID INTEGER, + AUTHENTICATOR_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2047), + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY), + FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE); + +INSERT INTO IDP_AUTHENTICATOR_PROPERTY (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY,PROPERTY_VALUE, IS_SECRET ) VALUES (-1234, 1 , 'IdPEntityId', 'localhost', '0'); + +DROP TABLE IF EXISTS IDP_PROV_CONFIG; +DROP SEQUENCE IF EXISTS IDP_PROV_CONFIG_SEQ; +CREATE SEQUENCE IDP_PROV_CONFIG_SEQ; +CREATE TABLE IDP_PROVISIONING_CONFIG ( + ID INTEGER DEFAULT NEXTVAL('IDP_PROV_CONFIG_SEQ'), + TENANT_ID INTEGER, + IDP_ID INTEGER, + PROVISIONING_CONNECTOR_TYPE VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '0', + IS_BLOCKING CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, PROVISIONING_CONNECTOR_TYPE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +DROP TABLE IF EXISTS IDP_PROV_CONFIG_PROP; +DROP SEQUENCE IF EXISTS IDP_PROV_CONFIG_PROP_SEQ; +CREATE SEQUENCE IDP_PROV_CONFIG_PROP_SEQ; +CREATE TABLE IDP_PROV_CONFIG_PROPERTY ( + ID INTEGER DEFAULT NEXTVAL('IDP_PROV_CONFIG_PROP_SEQ'), + TENANT_ID INTEGER, + PROVISIONING_CONFIG_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2048), + PROPERTY_BLOB_VALUE BYTEA, + PROPERTY_TYPE CHAR(32) NOT NULL, + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, PROVISIONING_CONFIG_ID, PROPERTY_KEY), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE); + +DROP TABLE IF EXISTS IDP_PROV_ENTITY; +DROP SEQUENCE IF EXISTS IDP_PROV_ENTITY_SEQ; +CREATE SEQUENCE IDP_PROV_ENTITY_SEQ; +CREATE TABLE IDP_PROVISIONING_ENTITY ( + ID INTEGER DEFAULT NEXTVAL('IDP_PROV_ENTITY_SEQ'), + PROVISIONING_CONFIG_ID INTEGER, + ENTITY_TYPE VARCHAR(255) NOT NULL, + ENTITY_LOCAL_USERSTORE VARCHAR(255) NOT NULL, + ENTITY_NAME VARCHAR(255) NOT NULL, + ENTITY_VALUE VARCHAR(255), + TENANT_ID INTEGER, + PRIMARY KEY (ID), + UNIQUE (ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID), + UNIQUE (PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE); + +DROP TABLE IF EXISTS IDP_LOCAL_CLAIM; +DROP SEQUENCE IF EXISTS IDP_LOCAL_CLAIM_SEQ; +CREATE SEQUENCE IDP_LOCAL_CLAIM_SEQ; +CREATE TABLE IF NOT EXISTS IDP_LOCAL_CLAIM( + ID INTEGER DEFAULT NEXTVAL('IDP_LOCAL_CLAIM_SEQ'), + TENANT_ID INTEGER, + IDP_ID INTEGER, + CLAIM_URI VARCHAR(255) NOT NULL, + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, CLAIM_URI), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +DROP TABLE IF EXISTS IDN_ASSOCIATED_ID; +DROP SEQUENCE IF EXISTS IDN_ASSOCIATED_ID_SEQ; +CREATE SEQUENCE IDN_ASSOCIATED_ID_SEQ; +CREATE TABLE IDN_ASSOCIATED_ID ( + ID INTEGER DEFAULT NEXTVAL('IDN_ASSOCIATED_ID_SEQ'), + IDP_USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + IDP_ID INTEGER NOT NULL, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (ID), + UNIQUE(IDP_USER_ID, TENANT_ID, IDP_ID), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +); + +DROP TABLE IF EXISTS IDN_USER_ACCOUNT_ASSOCIATION; +CREATE TABLE IDN_USER_ACCOUNT_ASSOCIATION ( + ASSOCIATION_KEY VARCHAR(255) NOT NULL, + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME)); + +DROP TABLE IF EXISTS FIDO_DEVICE_STORE; +CREATE TABLE FIDO_DEVICE_STORE ( + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(45) NOT NULL, + TIME_REGISTERED TIMESTAMP, + KEY_HANDLE VARCHAR(200) NOT NULL, + DEVICE_DATA VARCHAR(2048) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE)); + +DROP TABLE IF EXISTS WF_REQUEST; +CREATE TABLE WF_REQUEST ( + UUID VARCHAR (45), + CREATED_BY VARCHAR (255), + TENANT_ID INTEGER DEFAULT -1, + OPERATION_TYPE VARCHAR (50), + CREATED_AT TIMESTAMP, + UPDATED_AT TIMESTAMP, + STATUS VARCHAR (30), + REQUEST BYTEA, + PRIMARY KEY (UUID) +); + +DROP TABLE IF EXISTS WF_BPS_PROFILE; +CREATE TABLE WF_BPS_PROFILE ( + PROFILE_NAME VARCHAR(45), + HOST_URL VARCHAR(45), + USERNAME VARCHAR(45), + PASSWORD VARCHAR(255), + CALLBACK_HOST VARCHAR (45), + CALLBACK_USERNAME VARCHAR (45), + CALLBACK_PASSWORD VARCHAR (255), + TENANT_ID VARCHAR (45), + PRIMARY KEY (PROFILE_NAME, TENANT_ID) +); + +DROP TABLE IF EXISTS WF_WORKFLOW; +CREATE TABLE WF_WORKFLOW( + ID VARCHAR (45), + WF_NAME VARCHAR (45), + DESCRIPTION VARCHAR (255), + TEMPLATE_ID VARCHAR (45), + IMPL_ID VARCHAR (45), + TENANT_ID VARCHAR (45), + PRIMARY KEY (ID) +); + +DROP TABLE IF EXISTS WF_WORKFLOW_ASSOCIATION; +DROP SEQUENCE IF EXISTS WF_WORKFLOW_ASSOCIATION_PK_SEQ; +CREATE SEQUENCE WF_WORKFLOW_ASSOCIATION_PK_SEQ; +CREATE TABLE WF_WORKFLOW_ASSOCIATION( + ID INTEGER DEFAULT NEXTVAL('WF_WORKFLOW_ASSOCIATION_PK_SEQ'), + ASSOC_NAME VARCHAR (45), + EVENT_ID VARCHAR(45), + ASSOC_CONDITION VARCHAR (2000), + WORKFLOW_ID VARCHAR (45), + IS_ENABLED CHAR (1) DEFAULT '1', + PRIMARY KEY(ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE +); + +DROP TABLE IF EXISTS WF_WORKFLOW_CONFIG_PARAM; +CREATE TABLE WF_WORKFLOW_CONFIG_PARAM( + WORKFLOW_ID VARCHAR (45), + PARAM_NAME VARCHAR (45), + PARAM_VALUE VARCHAR (1000), + PRIMARY KEY (WORKFLOW_ID, PARAM_NAME), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE +); + +DROP TABLE IF EXISTS WF_REQUEST_ENTITY_RELATIONSHIP; +CREATE TABLE WF_REQUEST_ENTITY_RELATIONSHIP( + REQUEST_ID VARCHAR (45), + ENTITY_NAME VARCHAR (255), + ENTITY_TYPE VARCHAR (50), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY(REQUEST_ID, ENTITY_NAME, ENTITY_TYPE, TENANT_ID), + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE +); + +DROP TABLE IF EXISTS WORKFLOW_REQUEST_RELATION; +CREATE TABLE WORKFLOW_REQUEST_RELATION( + RELATIONSHIP_ID VARCHAR (45), + WORKFLOW_ID VARCHAR (45), + REQUEST_ID VARCHAR (45), + UPDATED_AT TIMESTAMP, + STATUS VARCHAR (30), + PRIMARY KEY (RELATIONSHIP_ID), + FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE, + FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE +); + +-- End of IDENTITY Tables-- + +CREATE SEQUENCE AM_SUBSCRIBER_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE AM_SUBSCRIBER ( + SUBSCRIBER_ID INTEGER DEFAULT nextval('am_subscriber_sequence'), + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EMAIL_ADDRESS VARCHAR(256) NULL, + DATE_SUBSCRIBED DATE NOT NULL, + CREATED_BY VARCHAR(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR(100), + UPDATED_TIME DATE, + PRIMARY KEY (SUBSCRIBER_ID), + UNIQUE (TENANT_ID,USER_ID) +) +; + +CREATE SEQUENCE AM_APPLICATION_SEQUENCE START WITH 1 INCREMENT BY 1 ; +CREATE TABLE AM_APPLICATION ( + APPLICATION_ID INTEGER DEFAULT nextval('am_application_sequence'), + NAME VARCHAR(100), + SUBSCRIBER_ID INTEGER, + APPLICATION_TIER VARCHAR(50) DEFAULT 'Unlimited', + CALLBACK_URL VARCHAR(512), + DESCRIPTION VARCHAR(512), + APPLICATION_STATUS VARCHAR(50) DEFAULT 'APPROVED', + GROUP_ID VARCHAR(100), + CREATED_BY VARCHAR(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR(100), + UPDATED_TIME DATE, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY(APPLICATION_ID), + UNIQUE (NAME,SUBSCRIBER_ID) +) +; + +CREATE SEQUENCE AM_API_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE AM_API ( + API_ID INTEGER DEFAULT nextval('am_api_sequence'), + API_PROVIDER VARCHAR(256), + API_NAME VARCHAR(256), + API_VERSION VARCHAR(30), + CONTEXT VARCHAR(256), + CONTEXT_TEMPLATE VARCHAR(256), + CREATED_BY VARCHAR(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR(100), + UPDATED_TIME DATE, + PRIMARY KEY(API_ID), + UNIQUE (API_PROVIDER,API_NAME,API_VERSION) +) +; + +CREATE SEQUENCE AM_API_URL_MAPPING_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE AM_API_URL_MAPPING ( + URL_MAPPING_ID INTEGER DEFAULT nextval('am_api_url_mapping_sequence'), + API_ID INTEGER NOT NULL, + HTTP_METHOD VARCHAR(20) NULL, + AUTH_SCHEME VARCHAR(50) NULL, + URL_PATTERN VARCHAR(512) NULL, + THROTTLING_TIER varchar(512) DEFAULT NULL, + MEDIATION_SCRIPT BYTEA, + PRIMARY KEY(URL_MAPPING_ID) +) +; + +CREATE SEQUENCE AM_SUBSCRIPTION_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE AM_SUBSCRIPTION ( + SUBSCRIPTION_ID INTEGER DEFAULT nextval('am_subscription_sequence'), + TIER_ID VARCHAR(50), + API_ID INTEGER, + LAST_ACCESSED DATE NULL, + APPLICATION_ID INTEGER, + SUB_STATUS VARCHAR(50), + SUBS_CREATE_STATE VARCHAR(50) DEFAULT 'SUBSCRIBE', + CREATED_BY VARCHAR(100), + CREATED_TIME DATE, + UPDATED_BY VARCHAR(100), + UPDATED_TIME DATE, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (SUBSCRIPTION_ID) +) +; + +CREATE TABLE AM_SUBSCRIPTION_KEY_MAPPING ( + SUBSCRIPTION_ID INTEGER, + ACCESS_TOKEN VARCHAR(512), + KEY_TYPE VARCHAR(512) NOT NULL, + FOREIGN KEY(SUBSCRIPTION_ID) REFERENCES AM_SUBSCRIPTION(SUBSCRIPTION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY(SUBSCRIPTION_ID,ACCESS_TOKEN) +) +; + +CREATE TABLE AM_APPLICATION_KEY_MAPPING ( + APPLICATION_ID INTEGER, + CONSUMER_KEY VARCHAR(512), + KEY_TYPE VARCHAR(512) NOT NULL, + CREATE_MODE VARCHAR(30) DEFAULT 'CREATED', + STATE VARCHAR(30), + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY(APPLICATION_ID,KEY_TYPE) +) +; + +CREATE SEQUENCE AM_APPLICATION_REGISTRATION_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION ( + REG_ID INTEGER DEFAULT nextval('am_application_registration_sequence'), + SUBSCRIBER_ID INT, + WF_REF VARCHAR(255) NOT NULL, + APP_ID INT, + TOKEN_TYPE VARCHAR(30), + TOKEN_SCOPE VARCHAR(256) DEFAULT 'default', + INPUTS VARCHAR(1000), + ALLOWED_DOMAINS VARCHAR(256), + VALIDITY_PERIOD BIGINT, + UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE), + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (REG_ID) +) +; + + + +CREATE SEQUENCE AM_API_LC_EVENT_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE AM_API_LC_EVENT ( + EVENT_ID INTEGER DEFAULT nextval('am_api_lc_event_sequence'), + API_ID INTEGER NOT NULL, + PREVIOUS_STATE VARCHAR(50), + NEW_STATE VARCHAR(50) NOT NULL, + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + EVENT_DATE DATE NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (EVENT_ID) +) +; + +CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING ( + CONSUMER_KEY VARCHAR(255), + AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL', + PRIMARY KEY (CONSUMER_KEY,AUTHZ_DOMAIN) +) +; + +CREATE SEQUENCE AM_API_COMMENTS_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE AM_API_COMMENTS ( + COMMENT_ID INTEGER DEFAULT nextval('am_api_comments_sequence'), + COMMENT_TEXT VARCHAR(512), + COMMENTED_USER VARCHAR(255), + DATE_COMMENTED DATE NOT NULL, + API_ID INTEGER NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (COMMENT_ID) +) +; + +CREATE SEQUENCE AM_WORKFLOWS_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE AM_WORKFLOWS( + WF_ID INTEGER DEFAULT nextval('am_workflows_sequence'), + WF_REFERENCE VARCHAR(255) NOT NULL, + WF_TYPE VARCHAR(255) NOT NULL, + WF_STATUS VARCHAR(255) NOT NULL, + WF_CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + WF_UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP , + WF_STATUS_DESC VARCHAR(1000), + TENANT_ID INTEGER, + TENANT_DOMAIN VARCHAR(255), + WF_EXTERNAL_REFERENCE VARCHAR(255) NOT NULL, + PRIMARY KEY (WF_ID), + UNIQUE (WF_EXTERNAL_REFERENCE) +) +; + +CREATE SEQUENCE AM_API_RATINGS_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE AM_API_RATINGS ( + RATING_ID INTEGER DEFAULT nextval('am_api_ratings_sequence'), + API_ID INTEGER, + RATING INTEGER, + SUBSCRIBER_ID INTEGER, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (RATING_ID) +) +; + +CREATE SEQUENCE AM_TIER_PERMISSIONS_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE AM_TIER_PERMISSIONS ( + TIER_PERMISSIONS_ID INTEGER DEFAULT nextval('am_tier_permissions_sequence'), + TIER VARCHAR(50) NOT NULL, + PERMISSIONS_TYPE VARCHAR(50) NOT NULL, + ROLES VARCHAR(512) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(TIER_PERMISSIONS_ID) +); + +CREATE SEQUENCE AM_EXTERNAL_STORES_SEQUENCE START WITH 1 INCREMENT BY 1; +CREATE TABLE AM_EXTERNAL_STORES ( + APISTORE_ID INTEGER DEFAULT nextval('am_external_stores_sequence'), + API_ID INTEGER, + STORE_ID VARCHAR(255) NOT NULL, + STORE_DISPLAY_NAME VARCHAR(255) NOT NULL, + STORE_ENDPOINT VARCHAR(255) NOT NULL, + STORE_TYPE VARCHAR(255) NOT NULL, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + PRIMARY KEY (APISTORE_ID) +) +; + +DROP TABLE IF EXISTS AM_API_SCOPES; +CREATE TABLE IF NOT EXISTS AM_API_SCOPES ( + API_ID INTEGER NOT NULL, + SCOPE_ID INTEGER NOT NULL, + FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE ON UPDATE CASCADE +); + +DROP TABLE IF EXISTS AM_API_DEFAULT_VERSION; +DROP SEQUENCE IF EXISTS AM_API_DEFAULT_VERSION_PK_SEQ; +CREATE SEQUENCE AM_API_DEFAULT_VERSION_PK_SEQ; +CREATE TABLE AM_API_DEFAULT_VERSION ( + DEFAULT_VERSION_ID INTEGER DEFAULT NEXTVAL('am_api_default_version_pk_seq'), + API_NAME VARCHAR(256) NOT NULL , + API_PROVIDER VARCHAR(256) NOT NULL , + DEFAULT_API_VERSION VARCHAR(30) , + PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) , + PRIMARY KEY (DEFAULT_VERSION_ID) +); + + +CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID) +; +commit; diff --git a/modules/distribution/src/assembly/bin.xml b/modules/distribution/src/assembly/bin.xml index 07167f2c..e78af55e 100644 --- a/modules/distribution/src/assembly/bin.xml +++ b/modules/distribution/src/assembly/bin.xml @@ -23,6 +23,7 @@ **/carbon.xml **/registry.xml + **/identity.xml **/client-truststore.jks **/wso2carbon.jks **/WSO2AM_DB.h2.db @@ -46,6 +47,40 @@ **/cipher-text.properties **/cipher-tool.properties **/lib/org.wso2.ciphertool-1.0.0-wso2v3.jar + + + **/repository/components/plugins/js_1.6.0.R7-wso2v1.jar + **/repository/components/plugins/json_1.0.0.wso2v1.jar + **/repository/components/plugins/wss4j_1.5.11.wso2v9.jar + **/repository/components/plugins/nimbus-jose-jwt_2.26.1.wso2v2.jar + **/repository/components/plugins/net.minidev.json-smart_1.2.0.jar + + **/repository/components/plugins/rampart-trust_1.6.1.wso2v14.jar + **/repository/components/plugins/rampart-policy_1.6.1.wso2v14.jar + **/repository/components/plugins/rampart-core_1.6.1.wso2v14.jar + **/repository/components/plugins/commons-io_2.0.0.wso2v2.jar + **/repository/components/plugins/com.google.gson_2.1.0.jar + **/repository/components/plugins/com.google.gson_2.2.4.jar + + **/repository/components/plugins/guava_12.0.0.wso2v1.jar + **/repository/components/plugins/wadl-core_1.1.3.wso2v2.jar + + + + + **/lib/endorsed/xalan*.jar + **/lib/endorsed/xercesImpl*.jar + **/lib/endorsed/xml-apis*.jar + **/conf/thrift-authentication.xml + **/repository/components/features/org.wso2.carbon.apimgt.store_${apim.feature.version}/store/** + **/repository/components/features/org.wso2.carbon.apimgt.store_${apim.feature.version}/admin-dashboard/** + **/repository/components/features/org.wso2.carbon.apimgt.store_${apim.feature.version}/workflow-admin/** + **/repository/components/features/org.wso2.carbon.apimgt.publisher_${apim.feature.version}/publisher/** + **/repository/components/features/org.wso2.carbon.apimgt.core_${apim.feature.version}/libs/** + + **/repository/components/plugins/asm-all_4.1.0.wso2v1.jar + + @@ -89,6 +124,28 @@ + + + ../p2-profile-gen/target/wso2carbon-core-${carbon.platform.version}/repository/conf/identity/ + ${pom.artifactId}-${pom.version}/repository/conf/identity + + **/identity.xml + **/entitlement.properties + + + + + + + + ../p2-profile-gen/target/wso2carbon-core-${carbon.platform.version}/dbscripts/identity/application-mgt/ + + ${pom.artifactId}-${pom.version}/dbscripts/identity/application-mgt + + **/**.sql + + + ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/multitenancy/ @@ -161,7 +218,6 @@ ${pom.artifactId}-${pom.version}/repository/conf/security/ - **/entitlement.properties **/trusted-idp-config.xml **/cipher-text.properties @@ -170,25 +226,8 @@ - - - src/repository/conf/identity/ - - ${pom.artifactId}-${pom.version}/repository/conf/identity/ - - **/** - - - - - - - - - - - - + + src/repository/resources ${pom.artifactId}-${pom.version}/repository/resources @@ -196,13 +235,6 @@ */** - - - - - - - ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/service-provider @@ -235,6 +267,16 @@ + + + src/api-resource/resources/sql/ + + ${pom.artifactId}-${pom.version}/dbscripts/apimgt + + **/**.sql + + + @@ -275,18 +317,6 @@ ${pom.artifactId}-${pom.version}/repository/resources - - - - - - - - - - - - src/statistics/carbonapps/ ${pom.artifactId}-${pom.version}/repository/deployment/server/carbonapps @@ -294,24 +324,6 @@ 755 - - - - - - - - - - - - - ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/jaggeryapps @@ -391,34 +403,7 @@ **/** - - - - - src/repository/conf - ${pom.artifactId}-${pom.version}/repository/conf/identity/ - - **/sso-idp-config.xml - - - - - - src/repository/conf/identity - ${pom.artifactId}-${pom.version}/repository/conf/identity/ - - **/** - - - - - src/repository/conf/bam - ${pom.artifactId}-${pom.version}/repository/conf/bam - - **/es-bam.xml - - @@ -443,26 +428,18 @@ shindig.war - - - src/repository/bam - ${pom.artifactId}-${pom.version}/repository/bam/ - - **/** - - - - src/repository/conf/security - ${pom.artifactId}-${pom.version}/repository/conf/identity/ - - **/application-authenticators.xml - - **/application-authentication.xml - - + + + + + + + + + @@ -501,7 +478,7 @@ - src/repository/conf/resources/customsequences + src/api-resource/customsequences ${pom.artifactId}-${pom.version}/repository/resources/customsequences **/**.xml @@ -582,48 +559,56 @@ org.apache.rampart:rampart:mar + + + + + ${pom.artifactId}-${pom.version}/lib/core/WEB-INF/lib + + org.wso2.carbon:org.wso2.carbon.mediator.bridge:jar + + + + + ${pom.artifactId}-${pom.version}/lib/core/WEB-INF/lib/ + org.apache.qpid.wso2:qpid-client:jar + + + + ${pom.artifactId}-${pom.version}/samples/axis2Client/client_repo/modules + + org.apache.axis2:addressing:mar + org.apache.rampart:rampart:mar + org.apache.sandesha2:sandesha2:mar + + ${artifact.artifactId}.${artifact.extension} + + + ${pom.artifactId}-${pom.version}/samples/axis2Server/repository/modules + + org.apache.axis2:addressing:mar + org.apache.rampart:rampart:mar + org.apache.sandesha2:sandesha2:mar + + ${artifact.artifactId}.${artifact.extension} + + + ${pom.artifactId}-${pom.version}/repository/axis2/client/lib + + bouncycastle:bcprov-jdk15:jar + + ${artifact.artifactId}.${artifact.extension} + + + ${pom.artifactId}-${pom.version}/repository/deployment/client/modules + + org.apache.rampart:rampart:mar + + - - + src/repository/conf/tomcat/context.xml ${pom.artifactId}-${pom.version}/repository/conf/tomcat @@ -678,13 +663,6 @@ true 644 - INSTALL.txt ${pom.artifactId}-${pom.version} @@ -754,9 +732,9 @@ - ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/msg-mgt.properties + ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/identity/msg-mgt.properties - ${pom.artifactId}-${pom.version}/repository/conf + ${pom.artifactId}-${pom.version}/repository/conf/identity/ 644 @@ -764,15 +742,9 @@ - ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/thrift-authentication.xml + ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/identity/thrift-authentication.xml - ${pom.artifactId}-${pom.version}/repository/conf/ - true - 644 - - - src/repository/conf/application-authenticators.xml - ${pom.artifactId}-${pom.version}/repository/conf/security/ + ${pom.artifactId}-${pom.version}/repository/conf/identity/ true 644 @@ -782,20 +754,6 @@ true 644 - - src/repository/conf/identity.xml - ${pom.artifactId}-${pom.version}/repository/conf - 644 - - - - ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading.xml - - ${pom.artifactId}-${pom.version}/repository/conf/tomcat - - true - 644 - @@ -858,26 +816,6 @@ 644 - - - - - ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading-environments.xml - - ${pom.artifactId}-${pom.version}/repository/conf/tomcat - - true - 644 - @@ -889,15 +827,6 @@ 644 - - - - - - - - - @@ -942,34 +871,6 @@ 644 - - - - - - - ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/governance.xml - - ${pom.artifactId}-${pom.version}/repository/conf - true - 644 - - - - - src/repository/conf/registry.xml - ${pom.artifactId}-${pom.version}/repository/conf/ - true - - - - - src/repository/conf/multitenancy/cloud-services-desc.xml - ${pom.artifactId}-${pom.version}/repository/conf/multitenancy/ - true - - - ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/log4j.properties @@ -980,14 +881,46 @@ - ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/identity/identity-mgt.properties + ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/governance.xml - ${pom.artifactId}-${pom.version}/repository/conf/identity + ${pom.artifactId}-${pom.version}/repository/conf true 644 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/email/email-admin-config.xml @@ -997,7 +930,7 @@ 644 - + ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/claim-config.xml @@ -1007,12 +940,12 @@ 644 - - - src/repository/database/WSO2IDENTITY_DB.h2.db - ${pom.artifactId}-${pom.version}/repository/database - 644 - + + + + + + @@ -1150,7 +1083,7 @@ 755 - + ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/webapps/analytics.war @@ -1161,6 +1094,13 @@ 644 + + src/repository/conf/synapse.properties + ${pom.artifactId}-${pom.version}/repository/conf + synapse.properties + true + + diff --git a/modules/distribution/src/repository/conf/axis2/axis2.xml b/modules/distribution/src/repository/conf/axis2/axis2.xml index 3b795a2a..4ac9c84f 100644 --- a/modules/distribution/src/repository/conf/axis2/axis2.xml +++ b/modules/distribution/src/repository/conf/axis2/axis2.xml @@ -1,68 +1,55 @@ + - + - - - - - ${hotdeployment} - ${hotupdate} - optional - true - work/mtom - 4000 + + true + + true - ${childfirstCL} + + false + + false - - true - - + false + + work/mtom + + 4000 - Possible value are: inmemory & persistent - --> - + false - inmemory - - - + + inmemory - - - services + + + + services axis2services @@ -70,69 +57,84 @@ axis2modules - - @product.name@-@product.version@ - - - @product.name@-@product.version@ - + + WSO2 IOT 1.0.0-SNAPSHOT + WSO2 IOT 1.0.0-SNAPSHOT - + + + false - - - false + + + + + + false - - - - - false + + true - - true + + 30000 - + repository/deployment/server/synapse-configs - . - . - - WSO2 Carbon Server + localhost + + + + - - - - - - ${jaxwsparam} + + + + + + + + + + + + + + + + + + + - + - + - + + - + - - - - + + + + + @@ -142,6 +144,13 @@ class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> + + + + + + + @@ -153,167 +162,259 @@ class="org.apache.axis2.transport.http.SOAPMessageFormatter"/> + + class="org.apache.synapse.commons.json.JsonFormatter"/> + - - - - - + + + + - + class="org.apache.synapse.format.hessian.HessianMessageFormatter"/> + + + + + + + + + class="org.apache.synapse.commons.builders.XFormURLEncodedBuilder"/> + + class="org.apache.synapse.commons.json.JsonBuilder"/> + + class="org.apache.axis2.json.JSONBuilder"/> + + + + - - - - - - - + class="org.wso2.carbon.relay.BinaryRelayBuilder"/> + + + + + + + + + + + + + class="org.apache.synapse.format.hessian.HessianMessageBuilder"/> + - - + - - - 9763 - - - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - 9443 - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -341,75 +442,50 @@ - - - - org.wso2.andes.jndi.PropertiesFileInitialContextFactory - repository/conf/jndi.properties - QueueConnectionFactory - queue - + + + 9763 - - org.wso2.andes.jndi.PropertiesFileInitialContextFactory - repository/conf/jndi.properties - QueueConnectionFactory - queue - - + + + + + + 9443 + + + + - + - - - - - - HTTP/1.1 - chunked - - true - - - HTTP/1.1 - chunked - - true - - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + repository/resources/security/client-truststore.jks + JKS + wso2carbon + + --> + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + true + + + multicast + + + + + wso2.carbon.domain + + + + + + 45564 + + 100 + + 60 + + + + + + 127.0.0.1 + + + + + + 4000 + + + + + + + + + + + + + + + 127.0.0.1 + 4000 + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"> - - - + @@ -482,39 +814,52 @@ + + + - + + + + - + + + - + + + + - - + - - + @@ -534,6 +879,8 @@ class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"> + @@ -542,10 +889,7 @@ - - - + @@ -561,16 +905,20 @@ + - + + - - + + + + @@ -584,119 +932,6 @@ NOTE: This should be the very last phase in this flow --> - - - - - - true - - - multicast - - - - - wso2.carbon.domain - - - - - - 45564 - - 100 - - 60 - - - - - - 127.0.0.1 - - - - - - 4000 - - - - - - - - - - - - - - - 127.0.0.1 - 4000 - - - - - - - - - \ No newline at end of file + diff --git a/modules/distribution/src/repository/conf/identity/identity-providers/default.xml b/modules/distribution/src/repository/conf/identity/identity-providers/default.xml deleted file mode 100644 index 3d1faa52..00000000 --- a/modules/distribution/src/repository/conf/identity/identity-providers/default.xml +++ /dev/null @@ -1,24 +0,0 @@ - - default - default - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/distribution/src/repository/conf/identity/service-providers/default.xml b/modules/distribution/src/repository/conf/identity/service-providers/default.xml deleted file mode 100644 index 83cb78a0..00000000 --- a/modules/distribution/src/repository/conf/identity/service-providers/default.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 1 - default - Default Service Provider - - - - default - - - - - - - - - 1 - - - BasicAuthenticator - basicauth - true - - - - true - true - - - - - - - - true - - - diff --git a/modules/distribution/src/repository/conf/identity/service-providers/sp_cdm.xml b/modules/distribution/src/repository/conf/identity/service-providers/sp_cdm.xml deleted file mode 100644 index e6006ead..00000000 --- a/modules/distribution/src/repository/conf/identity/service-providers/sp_cdm.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 2 - wso2_cdm - CDM - - - - cdm - samlsso - - - - - - - - 1 - - - BasicAuthenticator - basicauth - true - - - - true - true - - - - - - - - true - - - diff --git a/modules/distribution/src/repository/conf/identity/service-providers/sp_dashboard.xml b/modules/distribution/src/repository/conf/identity/service-providers/sp_dashboard.xml deleted file mode 100644 index c300d67c..00000000 --- a/modules/distribution/src/repository/conf/identity/service-providers/sp_dashboard.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 2 - wso2_sp_dashboard - Default Service Provider - - - - wso2.my.dashboard - samlsso - - - - - - - - 1 - - - BasicAuthenticator - basicauth - true - - - - true - true - - - - - - - - true - - - diff --git a/modules/distribution/src/repository/conf/identity/service-providers/sp_mdm.xml b/modules/distribution/src/repository/conf/identity/service-providers/sp_mdm.xml deleted file mode 100644 index 2b64586c..00000000 --- a/modules/distribution/src/repository/conf/identity/service-providers/sp_mdm.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 2 - wso2_mdm - MDM - - - - mdm - samlsso - - - - - - - - 1 - - - BasicAuthenticator - basicauth - true - - - - true - true - - - - - - - - true - - - diff --git a/modules/distribution/src/repository/conf/synapse.properties b/modules/distribution/src/repository/conf/synapse.properties new file mode 100644 index 00000000..42080fc0 --- /dev/null +++ b/modules/distribution/src/repository/conf/synapse.properties @@ -0,0 +1,42 @@ +# +# Copyright (c) 2005-2010, WSO2 Inc. (http://wso2.com) All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#synapse.threads.core = 20 +#synapse.threads.max = 100 +#synapse.threads.keepalive = 5 +#synapse.threads.qlen = 10 +#synapse.threads.group = synapse-thread-group +#synapse.threads.idprefix = SynapseWorker + +synapse.sal.endpoints.sesssion.timeout.default=600000 +synapse.global_timeout_interval=120000 +#In memory statistics cleaning state +statistics.clean.enable=false + +# Dependency tracking Synapse observer +# Comment out to disable dependency management +synapse.observers=org.wso2.carbon.mediation.dependency.mgt.DependencyTracker + +# User defined wsdlLocator/Schema Resolver Implementations. +# synapse.wsdl.resolver=org.wso2.carbon.mediation.initializer.RegistryWSDLLocator +# synapse.schema.resolver=org.wso2.carbon.mediation.initializer.RegistryXmlSchemaURIResolver + +# Uncomment following to support fallback XPATH 2.0 support with DOM and Saxon +#synapse.xpath.dom.failover.enabled=true +synapse.temp_data.chunk.size=3072 +#provides custom xpath function for securevault +synapse.xpath.func.extensions=org.wso2.carbon.mediation.security.vault.xpath.SecureVaultLookupXPathFunctionProvider +synapse.carbon.ext.tenant.info=org.wso2.carbon.mediation.initializer.handler.CarbonTenantInfoConfigurator diff --git a/modules/p2-profile-gen/pom.xml b/modules/p2-profile-gen/pom.xml index 47a538af..c5cb1cda 100644 --- a/modules/p2-profile-gen/pom.xml +++ b/modules/p2-profile-gen/pom.xml @@ -135,7 +135,10 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.analytics.server.feature:${carbon.device.mgt.version} - End of Device Management Features + + org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.enterprise.store.feature:${carbon.device.mgt.version} + + @@ -218,10 +221,10 @@ - - - org.wso2.carbon.identity:org.wso2.carbon.identity.oauth.common.feature:${carbon.identity.version} - + + + + org.wso2.carbon.identity:org.wso2.carbon.idp.mgt.feature:${carbon.identity.version} @@ -291,7 +294,7 @@ org.wso2.carbon.identity:org.wso2.carbon.identity.core.feature:${carbon.identity.version} - org.wso2.carbon.identity:org.wso2.carbon.identity.self.registration.server.feature:${carbon.identity.version} + org.wso2.carbon.identity:org.wso2.carbon.identity.user.registration.server.feature:${carbon.identity.version} org.wso2.carbon.identity:org.wso2.carbon.um.ws.service.server.feature:${carbon.identity.version} @@ -302,9 +305,9 @@ org.wso2.carbon.identity:org.wso2.carbon.identity.provider.server.feature:${carbon.identity.version} - - org.wso2.carbon.identity:org.wso2.carbon.identity.relying.party.server.feature:${carbon.identity.version} - + + + org.wso2.carbon.identity:org.wso2.carbon.um.ws.service.client.feature:${carbon.identity.version} @@ -369,6 +372,12 @@ org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.store.feature:${carbon.api.mgt.version} + + org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.gateway.feature:${carbon.api.mgt.version} + + + org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.startup.publisher.feature:${carbon.api.mgt.version} + @@ -392,16 +401,6 @@ org.wso2.carbon.registry:org.wso2.carbon.registry.task.feature:${carbon.registry.version} - - - - - - - org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.enterprise.store.feature:${carbon.device.mgt.version} - - - @@ -508,10 +507,10 @@ - org.wso2.carbon.mediation:org.apache.synapse.wso2.feature:${carbon.mediation.version} + org.wso2.carbon.mediation:org.wso2.carbon.mediation.initializer.feature:${carbon.mediation.version} @@ -521,19 +520,34 @@ org.wso2.carbon.mediation:org.apache.synapse.transport.nhttp.feature:${carbon.mediation.version} + + org.wso2.carbon.mediation:org.wso2.carbon.application.mgt.synapse.server.feature:${carbon.mediation.version} + + + org.wso2.carbon.mediation:org.wso2.carbon.application.deployer.synapse.feature:${carbon.mediation.version} + org.wso2.carbon.mediation:org.wso2.carbon.inbound.endpoints.server.feature:${carbon.mediation.version} org.wso2.carbon.mediation:org.wso2.carbon.mediation.ntask.feature:${carbon.mediation.version} - - - - - - + + org.wso2.carbon.mediation:org.wso2.carbon.mediation.admin.feature:${carbon.mediation.version} + + + org.wso2.carbon.deployment:org.wso2.carbon.service.mgt.server.feature:${carbon.deployment.version} + + + org.wso2.carbon.mediation:org.wso2.carbon.mediators.server.feature:${carbon.mediation.version} + + + org.wso2.carbon.mediation:org.wso2.carbon.mediation.configadmin.feature:${carbon.mediation.version} + + + org.wso2.carbon.mediation:org.wso2.carbon.relay.feature:${carbon.mediation.version} + org.wso2.carbon.commons:org.wso2.carbon.system.statistics.feature:${carbon.commons.version} @@ -659,6 +673,7 @@ + @@ -718,6 +733,10 @@ org.wso2.carbon.device.mgt.analytics.server.feature.group ${carbon.device.mgt.version} + + org.wso2.carbon.device.mgt.enterprise.store.feature.group + ${carbon.device.mgt.version} + @@ -760,24 +779,14 @@ org.wso2.carbon.webapp.mgt.feature.group ${carbon.deployment.version} - org.wso2.carbon.as.runtimes.cxf.feature.group ${carbon.deployment.version} - - - - - - - + org.wso2.carbon.event.server.feature.group ${carbon.commons.version} @@ -794,11 +803,6 @@ org.wso2.carbon.ntask.core.feature.group ${carbon.commons.version} - - - - - @@ -821,17 +825,6 @@ org.wso2.carbon.tenant.deployment.feature.group ${carbon.multitenancy.version} - - - - - - - - - - - @@ -862,37 +855,19 @@ org.wso2.carbon.identity.authenticator.saml2.sso.ui.feature.group ${carbon.identity.version} - - org.wso2.carbon.identity.application.authenticator.basicauth.server.feature.group ${carbon.identity.version} - org.wso2.carbon.identity.application.authentication.framework.server.feature.group ${carbon.identity.version} - - - org.wso2.carbon.identity.oauth.server.feature.group - ${carbon.identity.version} - - - - org.wso2.carbon.identity.oauth.common.feature.group - ${carbon.identity.version} - - org.wso2.carbon.idp.mgt.feature.group ${carbon.identity.version} - org.wso2.carbon.identity.authenticator.saml2.sso.feature.group ${carbon.identity.version} @@ -918,12 +893,10 @@ org.wso2.carbon.identity.mgt.feature.group ${carbon.identity.version} - org.wso2.carbon.identity.application.mgt.feature.group ${carbon.identity.version} - org.wso2.carbon.claim.mgt.server.feature.group ${carbon.identity.version} @@ -932,23 +905,16 @@ org.wso2.carbon.identity.notification.mgt.feature.group ${carbon.identity.version} - org.wso2.carbon.claim.mgt.feature.group ${carbon.identity.version} - - - - - - org.wso2.carbon.identity.core.feature.group ${carbon.identity.version} - org.wso2.carbon.identity.self.registration.server.feature.group + org.wso2.carbon.identity.user.registration.server.feature.group ${carbon.identity.version} @@ -959,10 +925,6 @@ org.wso2.carbon.identity.provider.server.feature.group ${carbon.identity.version} - - org.wso2.carbon.identity.relying.party.server.feature.group - ${carbon.identity.version} - org.wso2.carbon.um.ws.service.server.feature.group ${carbon.identity.version} @@ -1029,10 +991,6 @@ org.wso2.carbon.registry.extensions.feature.group ${carbon.governance.version} - - org.wso2.carbon.registry.ui.menu.governance.feature.group - ${carbon.registry.version} - org.wso2.carbon.registry.extensions.server.feature.group ${carbon.governance.version} @@ -1061,6 +1019,14 @@ org.wso2.carbon.apimgt.store.feature.group ${carbon.api.mgt.version} + + org.wso2.carbon.apimgt.gateway.feature.group + ${carbon.api.mgt.version} + + + org.wso2.carbon.apimgt.startup.publisher.feature.group + ${carbon.api.mgt.version} + org.wso2.carbon.mediation.initializer.feature.group ${carbon.mediation.version} @@ -1077,6 +1043,14 @@ org.apache.synapse.wso2.feature.group ${carbon.mediation.version} + + org.wso2.carbon.application.mgt.synapse.server.feature.group + ${carbon.mediation.version} + + + org.wso2.carbon.application.deployer.synapse.feature.group + ${carbon.mediation.version} + org.apache.axis2.transport.tcp.feature.group @@ -1090,14 +1064,27 @@ org.wso2.carbon.mediation.ntask.feature.group ${carbon.mediation.version} - - - - - - - - + + org.wso2.carbon.mediation.admin.feature.group + ${carbon.mediation.version} + + + org.wso2.carbon.mediators.server.feature.group + ${carbon.mediation.version} + + + org.wso2.carbon.service.mgt.server.feature.group + ${carbon.deployment.version} + + + + org.wso2.carbon.relay.server.feature.group + ${carbon.mediation.version} + + + org.wso2.carbon.mediation.configadmin.feature.group + ${carbon.mediation.version} + @@ -1107,121 +1094,113 @@ - - - + - org.wso2.carbon.device.mgt.enterprise.store.feature.group - ${carbon.device.mgt.version} + org.jaggeryjs.modules.caramel.feature.group + ${caramel.feature.version} + + + org.jaggeryjs.modules.handlebars.feature.group + ${handlebars.feature.version} + - - - org.jaggeryjs.modules.caramel.feature.group - ${caramel.feature.version} - - - org.jaggeryjs.modules.handlebars.feature.group - ${handlebars.feature.version} - - + + + org.wso2.carbon.webapp.mgt.server.feature.group + ${carbon.deployment.version} + + - - - org.wso2.carbon.webapp.mgt.server.feature.group - ${carbon.deployment.version} - - + + - - + + org.wso2.carbon.store.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.event.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.login.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.permission.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.registration.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.bampublisher.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.store.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.ues.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.account-management.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.rxt.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.utils.feature.group + ${carbon.store.version} + + + org.wso2.store.modules.lifecycle.feature.group + ${carbon.store.version} + + + org.wso2.carbon.social.feature.group + ${carbon.social.version} + + + org.wso2.carbon.store.extensions.assets.gadget.feature.group + ${carbon.store.version} + + + org.wso2.carbon.store.extensions.assets.site.feature.group + ${carbon.store.version} + - - org.wso2.carbon.store.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.event.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.login.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.permission.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.registration.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.bampublisher.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.store.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.ues.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.account-management.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.rxt.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.utils.feature.group - ${carbon.store.version} - - - org.wso2.store.modules.lifecycle.feature.group - ${carbon.store.version} - - - org.wso2.carbon.social.feature.group - ${carbon.social.version} - - - org.wso2.carbon.store.extensions.assets.gadget.feature.group - ${carbon.store.version} - - - org.wso2.carbon.store.extensions.assets.site.feature.group - ${carbon.store.version} - + + - - + + + + org.wso2.carbon.event.feature.group + ${carbon.commons.version} + + + org.wso2.carbon.tenant.mgt.common.feature.group + ${carbon.commons.version} + + + - - - - org.wso2.carbon.event.feature.group - ${carbon.commons.version} - - - org.wso2.carbon.tenant.mgt.common.feature.group - ${carbon.commons.version} - - - - - - org.wso2.carbon.dashboards.shindig.feature.group - ${carbon.dashboards.version} - - - org.wso2.ciphertool.feature.group - ${ciphertool.version} - + + org.wso2.carbon.dashboards.shindig.feature.group + ${carbon.dashboards.version} + + + org.wso2.ciphertool.feature.group + ${ciphertool.version} + @@ -1373,7 +1352,7 @@ ${carbon.event-processing.version} - + diff --git a/pom.xml b/pom.xml index 23cea62b..b7ecec4b 100644 --- a/pom.xml +++ b/pom.xml @@ -472,12 +472,12 @@ org.wso2.carbon.apimgt org.wso2.carbon.apimgt.core ${carbon.api.mgt.version} - - - org.wso2.carbon - org.wso2.carbon.mediation.initializer - - + + + + + + org.wso2.carbon.apimgt @@ -494,112 +494,112 @@ org.wso2.carbon.apimgt org.wso2.carbon.apimgt.impl ${carbon.api.mgt.version} - - - org.wso2.carbon - org.wso2.carbon.mediation.initializer - - - org.apache.woden.wso2 - woden - - - org.wso2.carbon - org.wso2.carbon.user.core - - - org.wso2.carbon.governance - org.wso2.carbon.governance.api - - - org.wso2.carbon - org.wso2.carbon.registry.ws.client - - - org.wso2.carbon - org.wso2.carbon.identity.core - - - org.wso2.carbon - org.wso2.carbon.identity.oauth - - - org.wso2.carbon - org.wso2.carbon.apimgt.keymgt.client - - - org.apache.poi - poi-ooxml - - - org.wso2.carbon - org.wso2.carbon.rest.api.stub - - - org.json.wso2 - json - - - com.h2database.wso2 - h2-database-engine - - - org.wso2.carbon - org.wso2.carbon.apimgt.handlers.security.stub - - - org.wso2.carbon - org.wso2.carbon.user.mgt.stub - - - org.wso2.carbon - org.wso2.carbon.um.ws.api - - - org.wso2.carbon - org.wso2.carbon.mediation.dependency.mgt - - - com.google.code.gson - gson - - - org.wso2.carbon - org.wso2.carbon.mediation.registry - - - org.apache.httpcomponents - httpmime - - - org.wso2.carbon - org.wso2.carbon.event.core - - - org.wso2.carbon - org.wso2.carbon.sequences.stub - - - org.wso2.carbon - org.wso2.carbon.mediation.security.stub - - - org.wso2.carbon - org.wso2.carbon.registry.indexing - - - org.wso2.carbon - org.wso2.carbon.apimgt.keymgt.stub - - - org.wso2.carbon - org.wso2.carbon.securevault - - - com.googlecode.json-simple.wso2 - json-simple - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -811,7 +811,7 @@ 1.3 - 0.10.2 + 0.12.0-M1 1.4.0 1.4.0 1.4.0 @@ -823,8 +823,8 @@ 1.4.0 - 2.3.6 - 2.3.6 + 2.3.8-SNAPSHOT + 2.3.8-SNAPSHOT 1.0.0 @@ -856,10 +856,10 @@ 4.5.2 - 4.5.6 + 4.6.0-SNAPSHOT - 4.4.1 + 4.5.0-m1 4.4.8 @@ -876,7 +876,7 @@ 1.0.0-SNAPSHOT - 4.4.5 + 4.4.10 4.3.0-SNAPSHOT @@ -891,7 +891,7 @@ 1.49 2.0.0 3.0.21 - 1.1.0-wso2v12 + 1.1.0-wso2v17 1.0.3 @@ -899,9 +899,6 @@ 1.0.0-wso2v3 1.0.0 2.0.5 - 3.0.0-SNAPSHOT - 4.3.1-SNAPSHOT - 1.0.1-SNAPSHOT 3.1.0.wso2v2