diff --git a/jans-linux-setup/jans_setup/setup_app/config.py b/jans-linux-setup/jans_setup/setup_app/config.py index 510615235e4..a6ba89fa021 100644 --- a/jans-linux-setup/jans_setup/setup_app/config.py +++ b/jans-linux-setup/jans_setup/setup_app/config.py @@ -45,7 +45,7 @@ def get(self, attr, default=None): @classmethod def set_mapping_locations(self): - ptype = 'rdbm' if self.persistence_type in ('sql', 'spanner') else self.persistence_type + ptype = 'rdbm' if self.persistence_type in ('sql',) else self.persistence_type self.mapping_locations = { group: ptype for group in self.couchbaseBucketDict } @classmethod @@ -167,13 +167,6 @@ def progress(self, service_name, msg, incr=False): self.rdbm_password_enc = '' self.static_rdbm_dir = os.path.join(self.install_dir, 'static/rdbm') - #spanner - self.spanner_project = 'jans-project' - self.spanner_instance = 'jans-instance' - self.spanner_database = 'jansdb' - self.spanner_emulator_host = None - self.google_application_credentials = None - # Jans components installation status self.loadData = True self.install_jans = True @@ -256,7 +249,6 @@ def progress(self, service_name, msg, incr=False): self.jans_python_readme = os.path.join(self.jansOptPythonFolder, 'libs/python.txt') self.jansCouchebaseProperties = os.path.join(self.configFolder, 'jans-couchbase.properties') self.jansRDBMProperties = os.path.join(self.configFolder, 'jans-sql.properties') - self.jansSpannerProperties = os.path.join(self.configFolder, 'jans-spanner.properties') self.ldif_base = os.path.join(self.output_dir, 'base.ldif') self.ldif_attributes = os.path.join(self.output_dir, 'attributes.ldif') diff --git a/jans-linux-setup/jans_setup/setup_app/installers/jans_auth.py b/jans-linux-setup/jans_setup/setup_app/installers/jans_auth.py index e24d33eb933..55e7970dd46 100644 --- a/jans-linux-setup/jans_setup/setup_app/installers/jans_auth.py +++ b/jans-linux-setup/jans_setup/setup_app/installers/jans_auth.py @@ -207,8 +207,7 @@ def external_libs(self): common_lib_dir = None if Config.cb_install: common_lib_dir = base.current_app.CouchbaseInstaller.common_lib_dir - elif Config.rdbm_install and Config.rdbm_type == 'spanner': - common_lib_dir = base.current_app.RDBMInstaller.common_lib_dir + if common_lib_dir: class_path = os.path.join(common_lib_dir, '*') current_plugins = self.get_plugins(paths=True) diff --git a/jans-linux-setup/jans_setup/setup_app/installers/jetty.py b/jans-linux-setup/jans_setup/setup_app/installers/jetty.py index bc0320f23a8..1f600b96007 100644 --- a/jans-linux-setup/jans_setup/setup_app/installers/jetty.py +++ b/jans-linux-setup/jans_setup/setup_app/installers/jetty.py @@ -447,9 +447,6 @@ def in_war(name): if Config.cb_install: common_lib_dir = base.current_app.CouchbaseInstaller.common_lib_dir - elif Config.rdbm_install and Config.rdbm_type == 'spanner': - common_lib_dir = base.current_app.RDBMInstaller.common_lib_dir - if common_lib_dir: add_custom_lib_dir = [] diff --git a/jans-linux-setup/jans_setup/setup_app/installers/rdbm.py b/jans-linux-setup/jans_setup/setup_app/installers/rdbm.py index 0ad357b4640..60222cb7c59 100644 --- a/jans-linux-setup/jans_setup/setup_app/installers/rdbm.py +++ b/jans-linux-setup/jans_setup/setup_app/installers/rdbm.py @@ -20,9 +20,7 @@ class RDBMInstaller(BaseInstaller, SetupUtils): - source_files = [ - (os.path.join(Config.dist_jans_dir, 'jans-orm-spanner-libs-distribution.zip'), os.path.join(base.current_app.app_info['JANS_MAVEN'], 'maven/io/jans/jans-orm-spanner-libs/{0}/jans-orm-spanner-libs-{0}-distribution.zip'.format(base.current_app.app_info['jans_version']))), - ] + source_files = [] def __init__(self): setattr(base.current_app, self.__class__.__name__, self) @@ -33,36 +31,35 @@ def __init__(self): self.install_var = 'rdbm_install' self.register_progess() self.output_dir = os.path.join(Config.output_dir, Config.rdbm_type) - self.common_lib_dir = os.path.join(Config.jetty_base, 'common/libs/spanner') opendj_schema_desc_fn = os.path.join(Config.install_dir, 'schema/opendj_schema_descriptions.json') self.opendj_schema_descriptions = base.readJsonFile(opendj_schema_desc_fn) @property def qchar(self): - return '`' if Config.rdbm_type in ('mysql', 'spanner') else '"' + return '`' if Config.rdbm_type in ('mysql',) else '"' def install(self): - if Config.rdbm_type == 'spanner': - self.extract_libs() self.local_install() if Config.rdbm_install_type == InstallTypes.REMOTE and base.argsp.reset_rdbm_db: self.reset_rdbm_db() - jans_schema_files = [] - self.jans_attributes = [] - for jans_schema_fn in ('jans_schema.json', 'custom_schema.json'): - schema_full_path = os.path.join(Config.install_dir, 'schema', jans_schema_fn) - jans_schema_files.append(schema_full_path) - schema_ = base.readJsonFile(schema_full_path) - self.jans_attributes += schema_.get('attributeTypes', []) - self.create_tables(jans_schema_files) - self.create_subtables() + self.prepare_jans_attributes() + self.create_tables(self.jans_schema_files) self.import_ldif() self.create_indexes() self.create_unique_indexes() self.rdbmProperties() + def prepare_jans_attributes(self): + self.jans_schema_files = [] + self.jans_attributes = [] + for jans_schema_fn in ('jans_schema.json', 'custom_schema.json'): + schema_full_path = os.path.join(Config.install_dir, 'schema', jans_schema_fn) + self.jans_schema_files.append(schema_full_path) + schema_ = base.readJsonFile(schema_full_path) + self.jans_attributes += schema_.get('attributeTypes', []) + def reset_rdbm_db(self): self.logIt("Resetting DB {}".format(Config.rdbm_db)) self.dbUtils.metadata.reflect(self.dbUtils.engine) @@ -178,8 +175,7 @@ def get_sql_col_type(self, attrname, table=None): if table in type_.get('tables', {}): type_ = type_['tables'][table] if 'size' in type_: - dtype = 'STRING' if type_['type'] and Config.rdbm_type == 'spanner' else type_['type'] - data_type = '{}({})'.format(dtype, type_['size']) + data_type = '{}({})'.format(type_['type'], type_['size']) else: data_type = type_['type'] @@ -190,7 +186,7 @@ def get_sql_col_type(self, attrname, table=None): attr_syntax = self.dbUtils.get_attr_syntax(attrname) type_ = self.dbUtils.ldap_sql_data_type_mapping[attr_syntax].get(Config.rdbm_type) or self.dbUtils.ldap_sql_data_type_mapping[attr_syntax]['mysql'] - char_type = 'STRING' if Config.rdbm_type == 'spanner' else 'VARCHAR' + char_type = 'VARCHAR' if type_['type'] in char_type: if type_['size'] <= 127: @@ -202,9 +198,6 @@ def get_sql_col_type(self, attrname, table=None): else: data_type = type_['type'] - if data_type == 'TEXT' and Config.rdbm_type == 'spanner': - data_type = 'STRING(MAX)' - return data_type @@ -234,8 +227,7 @@ def create_tables(self, jans_schema_files): tables = [] all_schema = {} all_attribs = {} - column_add = 'COLUMN ' if Config.rdbm_type == 'spanner' else '' - alter_table_sql_cmd = 'ALTER TABLE %s{}%s ADD %s{};' % (self.qchar, self.qchar, column_add) + alter_table_sql_cmd = 'ALTER TABLE %s{}%s ADD {};' % (self.qchar, self.qchar) for jans_schema_fn in jans_schema_files: jans_schema = base.readJsonFile(jans_schema_fn) @@ -244,9 +236,6 @@ def create_tables(self, jans_schema_files): for attr in jans_schema['attributeTypes']: all_attribs[attr['names'][0]] = attr - subtable_attrs = {} - for stbl in self.dbUtils.sub_tables.get(Config.rdbm_type): - subtable_attrs[stbl] = [ scol[0] for scol in self.dbUtils.sub_tables[Config.rdbm_type][stbl] ] for obj_name in all_schema: obj = all_schema[obj_name] @@ -275,9 +264,6 @@ def create_tables(self, jans_schema_files): if attrname in cols_: continue - if attrname in subtable_attrs.get(sql_tbl_name, []): - continue - cols_.append(attrname) col_def = self.get_col_def(attrname, sql_tbl_name) sql_tbl_cols.append(col_def) @@ -291,8 +277,6 @@ def create_tables(self, jans_schema_files): doc_id_type = self.get_sql_col_type('doc_id', sql_tbl_name) if Config.rdbm_type == 'pgsql': sql_cmd = 'CREATE TABLE "{}" (doc_id {} NOT NULL UNIQUE, "objectClass" VARCHAR(48), dn VARCHAR(128), {}, PRIMARY KEY (doc_id));'.format(sql_tbl_name, doc_id_type, ', '.join(sql_tbl_cols)) - elif Config.rdbm_type == 'spanner': - sql_cmd = 'CREATE TABLE `{}` (`doc_id` {} NOT NULL, `objectClass` STRING(48), dn STRING(128), {}) PRIMARY KEY (`doc_id`)'.format(sql_tbl_name, doc_id_type, ', '.join(sql_tbl_cols)) else: sql_cmd = 'CREATE TABLE `{}` (`doc_id` {} NOT NULL UNIQUE, `objectClass` VARCHAR(48), dn VARCHAR(128), {}, PRIMARY KEY (`doc_id`));'.format(sql_tbl_name, doc_id_type, ', '.join(sql_tbl_cols)) self.dbUtils.exec_rdbm_query(sql_cmd) @@ -308,25 +292,11 @@ def create_tables(self, jans_schema_files): if attr.get('sql', {}).get('add_table'): col_def = self.get_col_def(attrname, sql_tbl_name) sql_cmd = alter_table_sql_cmd.format(attr['sql']['add_table'], col_def) - - if Config.rdbm_type == 'spanner': - req = self.dbUtils.spanner_client.exec_sql(sql_cmd.strip(';')) - else: - self.dbUtils.exec_rdbm_query(sql_cmd) + self.dbUtils.exec_rdbm_query(sql_cmd) tables.append(sql_cmd) self.writeFile(os.path.join(self.output_dir, 'jans_tables.sql'), '\n'.join(tables)) - def create_subtables(self): - - for subtable in self.dbUtils.sub_tables.get(Config.rdbm_type, {}): - for sattr, sdt in self.dbUtils.sub_tables[Config.rdbm_type][subtable]: - subtable_columns = [] - sql_cmd = 'CREATE TABLE `{0}_{1}` (`doc_id` STRING(64) NOT NULL, `dict_doc_id` STRING(64), `{1}` {2}) PRIMARY KEY (`doc_id`, `dict_doc_id`), INTERLEAVE IN PARENT `{0}` ON DELETE CASCADE'.format(subtable, sattr, sdt) - self.dbUtils.spanner_client.exec_sql(sql_cmd) - sql_cmd_index = 'CREATE INDEX `{0}_{1}Idx` ON `{0}_{1}` (`{1}`)'.format(subtable, sattr) - self.dbUtils.spanner_client.exec_sql(sql_cmd_index) - def get_index_name(self, attrname): return re.sub(r'[^0-9a-zA-Z\s]+','_', attrname) @@ -349,110 +319,80 @@ def create_indexes(self): if attr_name in opendj_index_list and attr_name not in sql_indexes['__common__']['fields']: sql_indexes['__common__']['fields'].append(attr_name) - if Config.rdbm_type == 'spanner': - tables = self.dbUtils.spanner_client.get_tables() - for tblCls in tables: - tbl_fields = sql_indexes.get(tblCls, {}).get('fields', []) + sql_indexes['__common__']['fields'] + for tblCls in self.dbUtils.Base.classes.keys(): + tblObj = self.dbUtils.Base.classes[tblCls]() + tbl_fields = sql_indexes.get(tblCls, {}).get('fields', []) + sql_indexes['__common__']['fields'] - tbl_data = self.dbUtils.spanner_client.exec_sql('SELECT * FROM {} LIMIT 1'.format(tblCls)) - - for attr in tbl_data.get('fields', []): - if attr['name'] == 'doc_id': - continue - attr_name = attr['name'] - ind_name = self.get_index_name(attr['name']) - data_type = attr['type'] - - if data_type == 'ARRAY': - # How to index for ARRAY types in spanner? - pass - - elif attr_name in tbl_fields: - sql_cmd = 'CREATE INDEX `{1}_{0}Idx` ON `{1}` (`{2}`)'.format( - ind_name, - tblCls, - attr_name - ) - self.dbUtils.spanner_client.exec_sql(sql_cmd) + for attr in tblObj.__table__.columns: + if attr.name == 'doc_id': + continue + ind_name = self.get_index_name(attr.name) + data_type = self.get_sql_col_type(attr, tblCls) + data_type = data_type.replace('VARCHAR', 'CHAR') - for i, custom_index in enumerate(sql_indexes.get(tblCls, {}).get('custom', [])): - sql_cmd = 'CREATE INDEX `{0}_CustomIdx{1}` ON {0} ({2})'.format( - tblCls, - i+1, - custom_index - ) - self.dbUtils.spanner_client.exec_sql(sql_cmd) + if isinstance(attr.type, self.dbUtils.json_dialects_instance): - else: - for tblCls in self.dbUtils.Base.classes.keys(): - tblObj = self.dbUtils.Base.classes[tblCls]() - tbl_fields = sql_indexes.get(tblCls, {}).get('fields', []) + sql_indexes['__common__']['fields'] - - for attr in tblObj.__table__.columns: - if attr.name == 'doc_id': - continue - ind_name = self.get_index_name(attr.name) - data_type = self.get_sql_col_type(attr, tblCls) - data_type = data_type.replace('VARCHAR', 'CHAR') - - if isinstance(attr.type, self.dbUtils.json_dialects_instance): - - if attr.name in tbl_fields: - for i, ind_str in enumerate(sql_indexes['__common__']['JSON']): - tmp_str = Template(ind_str) - if Config.rdbm_type == 'mysql': - sql_cmd = 'ALTER TABLE {0}.{1} ADD INDEX `{2}_json_{3}`(({4}));'.format( - Config.rdbm_db, - tblCls, - ind_name, - i+1, - tmp_str.safe_substitute({'field':attr.name}) - ) - self.dbUtils.exec_rdbm_query(sql_cmd) - elif Config.rdbm_type == 'pgsql': - sql_cmd ='CREATE INDEX ON "{}" {};'.format( - tblCls, - tmp_str.safe_substitute({'field':attr.name}) - ) - self.dbUtils.exec_rdbm_query(sql_cmd) - - - elif attr.name in tbl_fields: - if Config.rdbm_type == 'mysql': - sql_cmd = 'ALTER TABLE {0}.{1} ADD INDEX `{1}_{2}` (`{3}`);'.format( + if attr.name in tbl_fields: + for i, ind_str in enumerate(sql_indexes['__common__']['JSON']): + tmp_str = Template(ind_str) + if Config.rdbm_type == 'mysql': + sql_cmd = 'ALTER TABLE {0}.{1} ADD INDEX `{2}_json_{3}`(({4}));'.format( Config.rdbm_db, tblCls, ind_name, - attr.name - ) - self.dbUtils.exec_rdbm_query(sql_cmd) - elif Config.rdbm_type == 'pgsql': - sql_cmd = 'CREATE INDEX ON "{}" ("{}");'.format( + i+1, + tmp_str.safe_substitute({'field':attr.name}) + ) + self.dbUtils.exec_rdbm_query(sql_cmd) + elif Config.rdbm_type == 'pgsql': + sql_cmd ='CREATE INDEX ON "{}" {};'.format( tblCls, - attr.name - ) - self.dbUtils.exec_rdbm_query(sql_cmd) + tmp_str.safe_substitute({'field':attr.name}) + ) + self.dbUtils.exec_rdbm_query(sql_cmd) + - for i, custom_index in enumerate(sql_indexes.get(tblCls, {}).get('custom', [])): + elif attr.name in tbl_fields: if Config.rdbm_type == 'mysql': - sql_cmd = 'ALTER TABLE {0}.{1} ADD INDEX `{2}` ({3});'.format( - Config.rdbm_db, - tblCls, - '{}_CustomIdx{}'.format(tblCls, i+1), - custom_index - ) + key_lenght = '' + if self.get_sql_col_type(attr.name, tblCls) == 'TEXT' and attr.name in sql_indexes.get(tblCls, {}).get('fields', []) + sql_indexes['__common__']['fields']: + key_lenght = '(255)' + + sql_cmd = 'ALTER TABLE {0}.{1} ADD INDEX `{1}_{2}` (`{3}`{4});'.format( + Config.rdbm_db, + tblCls, + ind_name, + attr.name, + key_lenght + ) self.dbUtils.exec_rdbm_query(sql_cmd) elif Config.rdbm_type == 'pgsql': - sql_cmd = 'CREATE INDEX ON "{}" {};'.format( + sql_cmd = 'CREATE INDEX ON "{}" ("{}");'.format( tblCls, - custom_index - ) + attr.name + ) self.dbUtils.exec_rdbm_query(sql_cmd) + for i, custom_index in enumerate(sql_indexes.get(tblCls, {}).get('custom', [])): + if Config.rdbm_type == 'mysql': + sql_cmd = 'ALTER TABLE {0}.{1} ADD INDEX `{2}` ({3});'.format( + Config.rdbm_db, + tblCls, + '{}_CustomIdx{}'.format(tblCls, i+1), + custom_index + ) + self.dbUtils.exec_rdbm_query(sql_cmd) + elif Config.rdbm_type == 'pgsql': + sql_cmd = 'CREATE INDEX ON "{}" {};'.format( + tblCls, + custom_index + ) + self.dbUtils.exec_rdbm_query(sql_cmd) + def create_unique_indexes(self): #Create uniqueness for columns jansPerson.uid and jansPerson.mail for table, column in (('jansPerson', 'mail'), ('jansPerson', 'uid')): - if Config.rdbm_type in ('mysql', 'spanner'): + if Config.rdbm_type in ('mysql',): sql_cmd = f'CREATE UNIQUE INDEX `{table.lower()}_{column.lower()}_unique_idx` ON `{table}` (`{column}`)' elif Config.rdbm_type == 'pgsql': sql_cmd = f'CREATE UNIQUE INDEX {table.lower()}_{column.lower()}_unique_idx ON "{table}"("{column}")' @@ -482,8 +422,7 @@ def import_ldif(self): force = BackendTypes.MYSQL elif Config.rdbm_type == 'pgsql': force = BackendTypes.PGSQL - elif Config.rdbm_type == 'spanner': - force = BackendTypes.SPANNER + self.dbUtils.import_ldif([Config.ldif_base], force=force) self.dbUtils.import_ldif(ldif_files) @@ -496,26 +435,10 @@ def rdbmProperties(self): rendered_tmp = self.render_template(src_temp_fn) self.writeFile(targtet_fn, rendered_tmp) - elif Config.rdbm_type == 'spanner': - if Config.spanner_emulator_host: - Config.templateRenderingDict['spanner_creds'] = 'connection.emulator-host={}:9010'.format(Config.spanner_emulator_host) - else: - auth_cred_target_fn = os.path.join(Config.configFolder, 'google_application_credentials.json') - shutil.copy(Config.google_application_credentials, auth_cred_target_fn) - Config.templateRenderingDict['spanner_creds'] = 'connection.credentials-file={}'.format(auth_cred_target_fn) - - self.renderTemplateInOut(Config.jansSpannerProperties, Config.templateFolder, Config.configFolder) def create_folders(self): self.createDirs(Config.static_rdbm_dir) - def extract_libs(self): - self.logIt("Extracting {}".format(self.source_files[0][0])) - if not os.path.exists(self.common_lib_dir): - self.createDirs(self.common_lib_dir) - shutil.unpack_archive(self.source_files[0][0], self.common_lib_dir) - self.chown(os.path.join(Config.jetty_base, 'common'), Config.jetty_user, Config.jetty_user, True) - def installed(self): # to be implemented diff --git a/jans-linux-setup/jans_setup/setup_app/setup_options.py b/jans-linux-setup/jans_setup/setup_app/setup_options.py index 9e51f77027e..c524102e673 100644 --- a/jans-linux-setup/jans_setup/setup_app/setup_options.py +++ b/jans-linux-setup/jans_setup/setup_app/setup_options.py @@ -37,8 +37,7 @@ def get_setup_options(): if base.argsp.remote_rdbm: setupOptions['rdbm_install_type'] = InstallTypes.REMOTE setupOptions['rdbm_type'] = base.argsp.remote_rdbm - if not base.argsp.remote_rdbm == 'spanner': - setupOptions['rdbm_host'] = base.argsp.rdbm_host + setupOptions['rdbm_host'] = base.argsp.rdbm_host else: setupOptions['rdbm_install_type'] = InstallTypes.LOCAL @@ -58,19 +57,6 @@ def get_setup_options(): if base.argsp.rdbm_password: setupOptions['rdbm_password'] = base.argsp.rdbm_password - if base.current_app.profile == 'jans': - if base.argsp.spanner_project: - setupOptions['spanner_project'] = base.argsp.spanner_project - if base.argsp.spanner_instance: - setupOptions['spanner_instance'] = base.argsp.spanner_instance - if base.argsp.spanner_database: - setupOptions['spanner_database'] = base.argsp.spanner_database - if base.argsp.spanner_emulator_host: - setupOptions['spanner_emulator_host'] = base.argsp.spanner_emulator_host - if base.argsp.google_application_credentials: - setupOptions['google_application_credentials'] = base.argsp.google_application_credentials - - if base.current_app.profile == 'jans': if base.argsp.local_couchbase: diff --git a/jans-linux-setup/jans_setup/setup_app/static.py b/jans-linux-setup/jans_setup/setup_app/static.py index d4b1178bb26..ebe63da1a8f 100644 --- a/jans-linux-setup/jans_setup/setup_app/static.py +++ b/jans-linux-setup/jans_setup/setup_app/static.py @@ -20,20 +20,15 @@ class colors: DANGER = '\033[31m' class BackendTypes: - LDAP = 1 COUCHBASE = 2 MYSQL = 3 PGSQL = 4 - SPANNER = 5 class BackendStrings: - REMOTE_OPENDJ = 'Remote OpenDj' LOCAL_COUCHBASE = 'Local Couchbase' REMOTE_COUCHBASE = 'Remote Couchbase' LOCAL_MYSQL = 'Local MySQL' REMOTE_MYSQL = 'Remote MySQL' - CLOUD_SPANNER = 'Cloud Spanner' - SAPNNER_EMULATOR = 'Spanner Emulator' LOCAL_PGSQL = 'Local PgSQL' REMOTE_PGSQL = 'Remote PgSQL' diff --git a/jans-linux-setup/jans_setup/setup_app/test_data_loader.py b/jans-linux-setup/jans_setup/setup_app/test_data_loader.py index 7e22ce02a5e..de610f21674 100644 --- a/jans-linux-setup/jans_setup/setup_app/test_data_loader.py +++ b/jans-linux-setup/jans_setup/setup_app/test_data_loader.py @@ -126,9 +126,6 @@ def load_test_data(self): Config.pbar.progress(self.service_name, "Rendering templates", False) self.logIt("Rendering test templates") - if Config.rdbm_type == 'spanner': - Config.rdbm_password_enc = '' - Config.templateRenderingDict['config_jans_auth_test_ldap'] = '# Not available' Config.templateRenderingDict['config_jans_auth_test_couchbase'] = '# Not available' @@ -146,16 +143,9 @@ def load_test_data(self): if self.getMappingType('rdbm'): - - if Config.rdbm_type == 'spanner': - template_text = self.readFile(os.path.join(self.template_base, 'jans-auth/server/config-jans-auth-test-spanner.properties.nrnd')) - rendered_text = self.fomatWithDict(template_text, self.merge_dicts(Config.__dict__, Config.templateRenderingDict)) - config_jans_auth_test_properties += '\n#spanner\n' + rendered_text - - else: - template_text = self.readFile(os.path.join(self.template_base, 'jans-auth/server/config-jans-auth-test-sql.properties.nrnd')) - rendered_text = self.fomatWithDict(template_text, self.merge_dicts(Config.__dict__, Config.templateRenderingDict)) - config_jans_auth_test_properties += '\n#sql\n' + rendered_text + template_text = self.readFile(os.path.join(self.template_base, 'jans-auth/server/config-jans-auth-test-sql.properties.nrnd')) + rendered_text = self.fomatWithDict(template_text, self.merge_dicts(Config.__dict__, Config.templateRenderingDict)) + config_jans_auth_test_properties += '\n#sql\n' + rendered_text self.logIt("Adding custom attributs and indexes") @@ -193,11 +183,8 @@ def load_test_data(self): json.dump(scim_schema, w, indent=2) self.dbUtils.read_jans_schema(others=jans_schema_json_files) - base.current_app.RDBMInstaller.create_tables(jans_schema_json_files) - - if Config.rdbm_type != 'spanner': - self.dbUtils.rdm_automapper(force=True) + self.dbUtils.rdm_automapper(force=True) self.writeFile( os.path.join(Config.output_dir, 'test/jans-auth/server/config-jans-auth-test.properties'), diff --git a/jans-linux-setup/jans_setup/setup_app/utils/arg_parser.py b/jans-linux-setup/jans_setup/setup_app/utils/arg_parser.py index fcdcda80003..0641fba472f 100644 --- a/jans-linux-setup/jans_setup/setup_app/utils/arg_parser.py +++ b/jans-linux-setup/jans_setup/setup_app/utils/arg_parser.py @@ -28,7 +28,7 @@ parser.add_argument('-encode-salt', help="24 characters length string to be used for encoding passwords") rdbm_group = parser.add_mutually_exclusive_group() -rdbm_group.add_argument('-remote-rdbm', choices=['mysql', 'pgsql', 'spanner'], help="Enables using remote RDBM server") +rdbm_group.add_argument('-remote-rdbm', choices=['mysql', 'pgsql'], help="Enables using remote RDBM server") rdbm_group.add_argument('-local-rdbm', choices=['mysql', 'pgsql'], help="Enables installing/configuring local RDBM server", default='pgsql') parser.add_argument('-ip-address', help="Used primarily by Apache httpd for the Listen directive") parser.add_argument('-host-name', help="Internet-facing FQDN that is used to generate certificates and metadata.") @@ -107,14 +107,6 @@ parser.add_argument('-config-patch-creds', help="password:username for downloading auto test ciba password") - # spanner options - parser.add_argument('-spanner-project', help="Spanner project name") - parser.add_argument('-spanner-instance', help="Spanner instance name") - parser.add_argument('-spanner-database', help="Spanner database name") - spanner_cred_group = parser.add_mutually_exclusive_group() - spanner_cred_group.add_argument('-spanner-emulator-host', help="Use Spanner emulator host") - spanner_cred_group.add_argument('-google-application-credentials', help="Path to Google application credentials json file") - # test-client parser.add_argument('-test-client-id', help="ID of test client which has all available scopes. Must be in UUID format.") parser.add_argument('-test-client-pw', help="Secret for test client") diff --git a/jans-linux-setup/jans_setup/setup_app/utils/collect_properties.py b/jans-linux-setup/jans_setup/setup_app/utils/collect_properties.py index f8469d11705..268d2fb8a44 100644 --- a/jans-linux-setup/jans_setup/setup_app/utils/collect_properties.py +++ b/jans-linux-setup/jans_setup/setup_app/utils/collect_properties.py @@ -41,12 +41,10 @@ def collect(self): jans_auth_ConfigurationEntryDN = jans_prop['jansAuth_ConfigurationEntryDN'] jans_ConfigurationDN = 'ou=configuration,o=jans' - if Config.persistence_type in ('couchbase', 'sql', 'spanner'): - default_storage = Config.persistence_type - elif Config.persistence_type == 'ldap': + if Config.persistence_type in ('couchbase', 'sql'): default_storage = Config.persistence_type - if not Config.persistence_type in ('ldap', 'sql', 'spanner') and os.path.exists(Config.jansCouchebaseProperties): + if os.path.exists(Config.jansCouchebaseProperties): jans_cb_prop = base.read_properties_file(Config.jansCouchebaseProperties) Config.couchebaseClusterAdmin = jans_cb_prop['auth.userName'] @@ -84,22 +82,6 @@ def collect(self): if Config.rdbm_type == 'postgresql': Config.rdbm_type = 'pgsql' - if not Config.persistence_type in ('couchbase', 'ldap') and Config.get('jansSpannerProperties') and os.path.exists(Config.jansSpannerProperties): - Config.rdbm_type = 'spanner' - jans_spanner_prop = base.read_properties_file(Config.jansSpannerProperties) - - Config.spanner_project = jans_spanner_prop['connection.project'] - Config.spanner_instance = jans_spanner_prop['connection.instance'] - Config.spanner_database = jans_spanner_prop['connection.database'] - - if 'connection.emulator-host' in jans_spanner_prop: - Config.spanner_emulator_host = jans_spanner_prop['connection.emulator-host'].split(':')[0] - Config.templateRenderingDict['spanner_creds'] = 'connection.emulator-host={}:9010'.format(Config.spanner_emulator_host) - - elif 'auth.credentials-file' in jans_spanner_prop: - Config.google_application_credentials = jans_spanner_prop['auth.credentials-file'] - Config.templateRenderingDict['spanner_creds'] = 'auth.credentials-file={}'.format(Config.google_application_credentials) - if not Config.get('couchbase_bucket_prefix'): Config.couchbase_bucket_prefix = 'jans' diff --git a/jans-linux-setup/jans_setup/setup_app/utils/db_utils.py b/jans-linux-setup/jans_setup/setup_app/utils/db_utils.py index bb775bac126..f6c7fd90543 100644 --- a/jans-linux-setup/jans_setup/setup_app/utils/db_utils.py +++ b/jans-linux-setup/jans_setup/setup_app/utils/db_utils.py @@ -23,7 +23,6 @@ from setup_app.utils.cbm import CBM from setup_app.utils import ldif_utils from setup_app.utils.attributes import attribDataTypes -from setup_app.utils.spanner_rest_client import SpannerClient my_path = PurePath(os.path.dirname(os.path.realpath(__file__))) sys.path.append(my_path.parent.joinpath('pylib/sqlalchemy')) @@ -42,7 +41,7 @@ class DBUtils: session = None cbm = None mariadb = False - rdbm_json_types = MappingProxyType({ 'mysql': {'type': 'JSON'}, 'pgsql': {'type': 'JSONB'}, 'spanner': {'type': 'ARRAY'} }) + rdbm_json_types = MappingProxyType({ 'mysql': {'type': 'JSON'}, 'pgsql': {'type': 'JSONB'} }) jans_scopes = None def bind(self, force=False): @@ -63,16 +62,6 @@ def bind(self, force=False): self.moddb = BackendTypes.MYSQL elif Config.rdbm_type == 'pgsql': self.moddb = BackendTypes.PGSQL - elif Config.rdbm_type == 'spanner': - self.moddb = BackendTypes.SPANNER - self.spanner_client = SpannerClient( - project_id=Config.spanner_project, - instance_id=Config.spanner_instance, - database_id=Config.spanner_database, - google_application_credentials=Config.google_application_credentials, - emulator_host=Config.spanner_emulator_host, - log_dir=os.path.join(Config.install_dir, 'logs') - ) else: self.moddb = BackendTypes.COUCHBASE @@ -152,18 +141,11 @@ def read_jans_schema(self, others=[]): self.ldap_sql_data_type_mapping = base.readJsonFile(os.path.join(Config.static_rdbm_dir, 'ldap_sql_data_type_mapping.json')) self.sql_data_types = base.readJsonFile(os.path.join(Config.static_rdbm_dir, 'sql_data_types.json')) self.opendj_attributes_syntax = base.readJsonFile(os.path.join(Config.static_rdbm_dir, 'opendj_attributes_syntax.json')) - self.sub_tables = base.readJsonFile(os.path.join(Config.static_rdbm_dir, 'sub_tables.json')) for attr in attribDataTypes.listAttributes: if not attr in self.sql_data_types: self.sql_data_types[attr] = self.rdbm_json_types - def in_subtable(self, table, attr): - if table in self.sub_tables[Config.rdbm_type]: - for stbl in self.sub_tables[Config.rdbm_type][table]: - if stbl[0] == attr: - return True - def exec_rdbm_query(self, query, getresult=False): base.logIt("Executing {} Query: {}".format(Config.rdbm_type, query)) if Config.rdbm_type in ('mysql', 'pgsql'): @@ -178,14 +160,12 @@ def exec_rdbm_query(self, query, getresult=False): return qresult.first() elif getresult: return qresult.fetchall() - elif Config.rdbm_type == 'spanner': - self.spanner_client.exec_sql(query.strip(';')) def set_cbm(self): self.cbm = CBM(Config.get('cb_query_node'), Config.get('couchebaseClusterAdmin'), Config.get('cb_password')) def get_jans_auth_conf_dynamic(self): - if self.moddb in (BackendTypes.MYSQL, BackendTypes.PGSQL, BackendTypes.SPANNER): + if self.moddb in (BackendTypes.MYSQL, BackendTypes.PGSQL): result = self.search(search_base='ou=jans-auth,ou=configuration,o=jans', search_filter='(objectClass=jansAppConf)', search_scope=SearchScopes.BASE) dn = result['dn'] jans_auth_conf_dynamic = json.loads(result['jansConfDyn']) @@ -208,13 +188,6 @@ def set_jans_auth_conf_dynamic(self, entries): sqlalchemyObj.jansConfDyn = json.dumps(jans_auth_conf_dynamic, indent=2) self.session.commit() - elif self.moddb in (BackendTypes.SPANNER,): - dn, jans_auth_conf_dynamic = self.get_jans_auth_conf_dynamic() - jans_auth_conf_dynamic.update(entries) - doc_id = self.get_doc_id_from_dn(dn) - - self.spanner_client.write_data(table='jansAppConf', columns=['doc_id', 'jansConfDyn'], values=[doc_id, json.dumps(jans_auth_conf_dynamic)], mutation='update') - elif self.moddb == BackendTypes.COUCHBASE: for k in entries: n1ql = 'UPDATE `{}` USE KEYS "configuration_jans-auth" SET jansConfDyn.{}={}'.format(self.default_bucket, k, json.dumps(entries[k])) @@ -229,12 +202,6 @@ def enable_script(self, inum, enable=True): sqlalchemyObj.jansEnabled = 1 if enable else 0 self.session.commit() - elif self.moddb == BackendTypes.SPANNER: - dn = SCRIPTS_DN_TMP.format(inum) - table = self.get_spanner_table_for_dn(dn) - if table: - self.spanner_client.write_data(table=table, columns=['doc_id', 'jansEnabled'], values=[inum, enable], mutation='update') - elif self.moddb == BackendTypes.COUCHBASE: n1ql = 'UPDATE `{}` USE KEYS "scripts_{}" SET jansEnabled=true'.format(self.default_bucket, inum) self.cbm.exec_query(n1ql) @@ -245,9 +212,6 @@ def enable_service(self, service): setattr(sqlalchemyObj, service, 1) self.session.commit() - elif self.moddb == BackendTypes.SPANNER: - self.spanner_client.write_data(table='jansAppConf', columns=['doc_id', service], values=["configuration", True], mutation='update') - elif self.moddb == BackendTypes.COUCHBASE: n1ql = 'UPDATE `{}` USE KEYS "configuration" SET {}=true'.format(self.default_bucket, service) self.cbm.exec_query(n1ql) @@ -263,12 +227,6 @@ def set_configuration(self, component, value, dn='ou=configuration,o=jans'): setattr(sqlalchemyObj, component, typed_val) self.session.commit() - elif self.moddb == BackendTypes.SPANNER: - table = self.get_spanner_table_for_dn(dn) - doc_id = self.get_doc_id_from_dn(dn) - typed_val = self.get_rdbm_val(component, value, rdbm_type='spanner') - self.spanner_client.write_data(table=table, columns=['doc_id', component], values=[doc_id, value], mutation='update') - elif self.moddb == BackendTypes.COUCHBASE: key = ldif_utils.get_key_from(dn) n1ql = 'UPDATE `{}` USE KEYS "{}" SET {}={}'.format(self.default_bucket, key, component, value) @@ -285,11 +243,6 @@ def dn_exists(self, dn): return result.__dict__ return - elif mapping_location == BackendTypes.SPANNER: - table = self.get_spanner_table_for_dn(dn) - data = self.dn_exists_rdbm(dn, table) - return data - else: bucket = self.get_bucket_for_dn(dn) key = ldif_utils.get_key_from(dn) @@ -305,14 +258,8 @@ def dn_exists(self, dn): def dn_exists_rdbm(self, dn, table): base.logIt("Checking dn {} exists in table {}".format(dn, table)) backend_location = self.get_backend_location_for_dn(dn) - - if backend_location == BackendTypes.SPANNER: - result = self.spanner_client.get_dict_data('SELECT * from {} WHERE dn="{}"'.format(table, dn)) - if result: - result = result[0] - return result - sqlalchemy_table = self.Base.classes[table].__table__ + return self.session.query(sqlalchemy_table).filter(sqlalchemy_table.columns.dn == dn).first() @@ -320,8 +267,8 @@ def search(self, search_base, search_filter='(objectClass=*)', search_scope=Sear base.logIt("Searching database for dn {} with filter {}".format(search_base, search_filter)) backend_location = self.get_backend_location_for_dn(search_base) - if backend_location in (BackendTypes.MYSQL, BackendTypes.PGSQL, BackendTypes.SPANNER): - if backend_location != BackendTypes.SPANNER and self.Base is None: + if backend_location in (BackendTypes.MYSQL, BackendTypes.PGSQL): + if self.Base is None: self.rdm_automapper() s_table = None @@ -350,41 +297,6 @@ def search(self, search_base, search_filter='(objectClass=*)', search_scope=Sear if not s_table: return - if backend_location == BackendTypes.SPANNER: - - if fetchmany: - retVal = [] - else: - retVal = {} - - for col, val in search_list: - if val == '*': - continue - - if col.lower() == 'objectclass': - s_table = val - else: - val = val.replace('*', '%') - q_operator = 'LIKE' if '%' in val else '=' - where_clause = 'AND {} {} "{}"'.format(col, q_operator, val) - - if not s_table: - return retVal - - if search_scope == SearchScopes.BASE: - dn_clause = 'dn = "{}"'.format(search_base) - else: - dn_clause = 'dn LIKE "%{}"'.format(search_base) - - sql_cmd = 'SELECT * FROM {} WHERE ({}) {}'.format(s_table, dn_clause, where_clause) - - result = self.spanner_client.get_dict_data(sql_cmd) - - if not fetchmany and result: - return result[0] - - return [ (ldif_utils.get_key_from(item['dn']), item) for item in retVal ] - sqlalchemy_table = self.Base.classes[s_table] sqlalchemyQueryObject = self.session.query(sqlalchemy_table) @@ -470,13 +382,6 @@ def delete_dn(self, dn): self.session.delete(sqlalchemy_obj) self.session.commit() - elif backend_location == BackendTypes.SPANNER: - tbl = self.get_spanner_table_for_dn(dn) - data = self.spanner_client.get_dict_data('SELECT doc_id FROM {} WHERE dn="{}"'.format(tbl, dn)) - if data: - doc_id = data[0]['doc_id'] - self.spanner_client.delete_data_data(tbl, doc_id) - elif backend_location == BackendTypes.COUCHBASE: key = ldif_utils.get_key_from(dn) bucket =self.get_bucket_for_key(key) @@ -509,28 +414,6 @@ def add_client2script(self, script_inum, client_id): sqlalchemyObj.jansConfProperty = jans_conf_property self.session.commit() - - elif backend_location == BackendTypes.SPANNER: - spanner_data_list = self.spanner_client.get_dict_data('SELECT jansConfProperty from jansCustomScr WHERE dn="{}"'.format(dn)) - spanner_data = spanner_data_list[0] - jans_conf_property = [] - added = False - jans_conf_property = spanner_data.get('jansConfProperty', []) - - for i, oxconfigprop in enumerate(jans_conf_property): - oxconfigpropjs = json.loads(oxconfigprop) - if oxconfigpropjs.get('value1') == 'allowed_clients': - if client_id in oxconfigpropjs['value2']: - return - oxconfigpropjs['value2'] = self.add2strlist(client_id, oxconfigpropjs['value2']) - jans_conf_property[i] = json.dumps(oxconfigpropjs) - added = True - break - - if not added: - jans_conf_property.append(json.dumps({'value1': 'allowed_clients', 'value2': client_id})) - self.spanner_client.write_data(table='jansCustomScr', columns=['doc_id', 'jansConfProperty'], values=[script_inum, jans_conf_property], mutation='update') - elif backend_location == BackendTypes.COUCHBASE: bucket = self.get_bucket_for_dn(dn) n1ql = 'SELECT jansConfProperty FROM `{}` USE KEYS "scripts_{}"'.format(bucket, script_inum) @@ -622,16 +505,14 @@ def get_sqlalchObj_for_dn(self, dn): return result def table_exists(self, table): - if Config.rdbm_type == 'spanner': - return table in self.spanner_client.get_tables() - else: - metadata = sqlalchemy.MetaData() - try: - metadata.reflect(self.engine, only=[table]) - except: - pass - return table in metadata + metadata = sqlalchemy.MetaData() + try: + metadata.reflect(self.engine, only=[table]) + except: + pass + + return table in metadata def is_schema_rdbm_json(self, attrname): for attr in self.jans_attributes: @@ -666,8 +547,8 @@ def get_rdbm_val(self, key, val, rdbm_type=None): if data_type in ('DATETIME(3)', 'TIMESTAMP'): dval = val_.strip('Z') - sep= 'T' if rdbm_type == 'spanner' else ' ' - postfix = 'Z' if rdbm_type == 'spanner' else '' + sep= ' ' + postfix = '' return "{}-{}-{}{}{}:{}:{}{}{}".format(dval[0:4], dval[4:6], dval[6:8], sep, dval[8:10], dval[10:12], dval[12:14], dval[14:17], postfix) if data_type in ('JSON', 'JSONB'): @@ -705,14 +586,6 @@ def get_doc_id_from_dn(self, dn): doc_id = '_' return doc_id - def get_spanner_table_for_dn(self, dn): - tables = self.spanner_client.get_tables() - - for table in tables: - sql_cmd = 'SELECT doc_id FROM {} WHERE dn="{}"'.format(table, dn) - result = self.spanner_client.get_dict_data(sql_cmd) - if result: - return table def get_sha_digest(self, val): msha = hashlib.sha256() @@ -813,91 +686,6 @@ def import_ldif(self, ldif_files, bucket=None, force=None): self.session.add(sqlalchObj) self.session.commit() - - elif backend_location == BackendTypes.SPANNER: - - if 'add' in entry and 'changetype' in entry: - table = self.get_spanner_table_for_dn(dn) - change_attr = entry['add'][0] - if table: - doc_id = self.get_doc_id_from_dn(dn) - - if self.in_subtable(table, change_attr): - sub_table = '{}_{}'.format(table, change_attr) - for subval in entry[change_attr]: - typed_val = self.get_rdbm_val(change_attr, subval, rdbm_type='spanner') - dict_doc_id = self.get_sha_digest(typed_val) - self.spanner_client.write_data(table=sub_table, columns=['doc_id', 'dict_doc_id', change_attr], values=[doc_id, typed_val, typed_val]) - - else: - data_list = self.spanner_client.get_dict_data('SELECT {} FROM {} WHERE doc_id="{}"'.format(entry['add'][0], table, doc_id)) - cur_data = data_list[0] - if cur_data and change_attr in cur_data: - if not cur_data[change_attr]: - cur_data[change_attr] = [] - for cur_val in entry[change_attr]: - typed_val = self.get_rdbm_val(change_attr, cur_val, rdbm_type='spanner') - cur_data[change_attr].append(typed_val) - - self.spanner_client.write_data(table=table, columns=['doc_id', change_attr], values=[doc_id, cur_data[change_attr]], mutation='update') - - elif 'replace' in entry and 'changetype' in entry: - table = self.get_spanner_table_for_dn(dn) - doc_id = self.get_doc_id_from_dn(dn) - replace_attr = entry['replace'][0] - typed_val = self.get_rdbm_val(replace_attr, entry[replace_attr], rdbm_type='spanner') - - if self.in_subtable(table, replace_attr): - sub_table = '{}_{}'.format(table, replace_attr) - # TODO: how to replace ? - #for subval in typed_val: - # self.spanner_client.write_data(table=sub_table, columns=['doc_id', replace_attr], values=[doc_id, subval], mutation='update') - else: - self.spanner_client.write_data(table=table, columns=['doc_id', replace_attr], values=[doc_id, typed_val], mutation='update') - - else: - vals = {} - dn_parsed = parse_dn(dn) - rdn_name = dn_parsed[0][0] - objectClass = objectClass = self.get_clean_objcet_class(entry) - if objectClass.lower() == 'organizationalunit': - continue - - doc_id = self.get_doc_id_from_dn(dn) - vals['doc_id'] = doc_id - vals['dn'] = dn - vals['objectClass'] = objectClass - - if 'objectClass' in entry: - entry.pop('objectClass') - elif 'objectclass' in entry: - entry.pop('objectclass') - - table_name = objectClass - - subtable_data = [] - - for lkey in entry: - spanner_vals = self.get_rdbm_val(lkey, entry[lkey], rdbm_type='spanner') - if not self.in_subtable(table_name, lkey): - vals[lkey] = spanner_vals - else: - sub_table = '{}_{}'.format(table_name, lkey) - sub_table_columns = ['doc_id', 'dict_doc_id', lkey] - sub_table_values = [] - for subtableval in spanner_vals: - dict_doc_id = self.get_sha_digest(subtableval) - sub_table_values.append([doc_id, dict_doc_id, subtableval]) - subtable_data.append((sub_table, sub_table_columns, sub_table_values)) - - columns = [ *vals.keys() ] - values = [ vals[lkey] for lkey in columns ] - base.logIt("SPANNER:WRITE {} {} {}".format(table_name, columns, values)) - self.spanner_client.write_data(table=table_name, columns=columns, values=values) - - for sdata in subtable_data: - self.spanner_client.write_data(table=sdata[0], columns=sdata[1], values=sdata[2][0]) - elif backend_location == BackendTypes.COUCHBASE: if len(entry) < 3: continue @@ -1058,8 +846,6 @@ def get_backend_location_for_dn(self, dn): return static.BackendTypes.MYSQL elif Config.rdbm_type == 'pgsql': return static.BackendTypes.PGSQL - elif Config.rdbm_type == 'spanner': - return static.BackendTypes.SPANNER if Config.mapping_locations[group] == 'couchbase': return static.BackendTypes.COUCHBASE diff --git a/jans-linux-setup/jans_setup/setup_app/utils/properties_utils.py b/jans-linux-setup/jans_setup/setup_app/utils/properties_utils.py index 037fd65c62a..10fa727451e 100644 --- a/jans-linux-setup/jans_setup/setup_app/utils/properties_utils.py +++ b/jans-linux-setup/jans_setup/setup_app/utils/properties_utils.py @@ -23,9 +23,6 @@ from setup_app.utils.db_utils import dbUtils from setup_app.pylib.jproperties import Properties -if base.current_app.profile == 'jans': - from setup_app.utils.spanner_rest_client import SpannerClient - class PropertiesUtils(SetupUtils): @@ -387,8 +384,6 @@ def set_persistence_type(self): if not Config.rdbm_install and Config.cb_install: Config.persistence_type = 'couchbase' - elif Config.rdbm_type == 'spanner': - Config.persistence_type = 'spanner' elif Config.rdbm_install and (not Config.cb_install): Config.persistence_type = 'sql' elif Config.cb_install: @@ -599,7 +594,7 @@ def prompt_for_backend(self): BackendStrings.REMOTE_MYSQL, ] - backend_types += [BackendStrings.REMOTE_COUCHBASE, BackendStrings.CLOUD_SPANNER] + backend_types += [BackendStrings.REMOTE_COUCHBASE] if 'couchbase' in self.getBackendTypes(): backend_types.insert(2, BackendStrings.LOCAL_COUCHBASE) @@ -690,45 +685,6 @@ def prompt_for_backend(self): except Exception as e: print(" {}Can't connect to {}: {}{}".format(colors.DANGER,Config.rdbm_type.upper(), e, colors.ENDC)) - elif backend_type_str == BackendStrings.CLOUD_SPANNER: - Config.rdbm_type = 'spanner' - Config.rdbm_install_type = InstallTypes.REMOTE - - emulator = self.getPrompt(" Is it emulator?", "N|y")[0].lower() - if emulator == 'y': - Config.spanner_emulator_host = self.getPrompt(" Emulator host", Config.get('spanner_emulator_host')) - - Config.spanner_project = self.getPrompt(" Spanner project", Config.get('spanner_project')) - Config.spanner_instance = self.getPrompt(" Spanner instance", Config.get('spanner_instance')) - Config.spanner_database = self.getPrompt(" Spanner database", Config.get('spanner_database')) - if not Config.get('spanner_emulator_host'): - while True: - cred_fn = self.getPrompt(" Google application creditentals file", Config.get('google_application_credentials')) - if os.path.exists(cred_fn): - try: - with open(cred_fn) as f: - json.load(f) - break - except: - pass - print(" Please enter valid json path") - Config.google_application_credentials = cred_fn - - print(" Checking spanner connection") - try: - SpannerClient( - project_id=Config.spanner_project, - instance_id=Config.spanner_instance, - database_id=Config.spanner_database, - google_application_credentials=Config.google_application_credentials, - emulator_host=Config.spanner_emulator_host, - log_dir=os.path.join(Config.install_dir, 'logs') - ) - print(" {}Spanner connection was successfull{}".format(colors.OKGREEN, colors.ENDC)) - except Exception as e: - print("{}ERROR getting session from spanner: {}{}".format(colors.DANGER, e, colors.ENDC)) - sys.exit() - def openbanking_properties(self): self.prompt_for_rdbm() diff --git a/jans-linux-setup/jans_setup/setup_app/utils/spanner_rest_client.py b/jans-linux-setup/jans_setup/setup_app/utils/spanner_rest_client.py deleted file mode 100644 index d9cffbeb4b2..00000000000 --- a/jans-linux-setup/jans_setup/setup_app/utils/spanner_rest_client.py +++ /dev/null @@ -1,215 +0,0 @@ -import os -import time -import json -import jwt -import requests -import logging - -import http.client -from http.client import HTTPConnection - - -class SpannerClient: - - def __init__(self, project_id, instance_id, database_id, google_application_credentials=None, emulator_host=None, log_dir='.', emulator_port=9020): - self.project_id = project_id - self.instance_id = instance_id - self.database_id = database_id - self.google_application_credentials = google_application_credentials - self.emulator_host = emulator_host - self.log_dir = log_dir - self.emulator_port = emulator_port - self.sessioned_url = None - self.headers = {} - - if emulator_host: - schema = 'http' - self.spanner_base_url = '{}://{}:{}/v1/'.format(schema, emulator_host, emulator_port) - self.set_spanner_database_url() - else: - self.spanner_base_url = 'https://spanner.googleapis.com/v1/' - self.set_spanner_database_url() - with open(self.google_application_credentials) as f: - self.google_creds = json.load(f) - self.get_google_cloud_spanner_id_token() - - - self.set_logging() - self.get_session() - - def set_spanner_database_url(self): - self.spanner_database_url = os.path.join( - self.spanner_base_url, - 'projects/{}/instances/{}/databases/{}/'.format(self.project_id, self.instance_id, self.database_id) - ) - - def get_google_cloud_spanner_id_token(self): - aud = 'https://oauth2.googleapis.com/token' - scopes = ['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/spanner.data'] - grant_type = 'urn:ietf:params:oauth:grant-type:jwt-bearer' - - liftetime = 3600 - iat = int(time.time()) - exp = iat + liftetime - - payload = { - 'iat': iat, - 'exp': exp, - 'iss': self.google_creds['client_email'], - 'aud': aud, - 'scope': ' '.join(scopes) - } - - headers = { - 'typ': 'JWT', - 'alg': 'RS256', - 'kid': self.google_creds['private_key_id'] - } - - assertion = jwt.encode( - payload, - self.google_creds['private_key'], - headers=headers, - algorithm='RS256' - ) - - req = requests.post( - url=aud, - data={ - 'assertion': [assertion], - 'grant_type': [grant_type] - } - ) - - response = req.json() - self.id_token = response['access_token'] - self.headers = {'Authorization': 'Bearer {}'.format(self.id_token)} - - def set_logging(self): - self.logger = logging.getLogger("urllib3") - self.logger.propagate = True - self.logger.setLevel(logging.DEBUG) - http.client.HTTPConnection.debuglevel = 1 - log_fn = os.path.join(self.log_dir, 'spanner-client.log') - file_handler = logging.FileHandler(log_fn) - file_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)-5.5s] %(message)s")) - self.logger.addHandler(file_handler) - - def print_to_log(*args): - self.logger.debug(" ".join(args)) - - http.client.print = print_to_log - - def get_session(self): - session_url = os.path.join(self.spanner_database_url, 'sessions') - request = requests.post(session_url, headers=self.headers) - result = request.json() - self.sessioned_url = os.path.join(self.spanner_base_url, result['name']) - - - def exec_sql(self, sql_cmd): - - if 'select' in sql_cmd.lower().split(): - request = requests.post( - url=self.sessioned_url + ':executeSql', - json={"sql": sql_cmd}, - headers=self.headers - ) - - else: - request = requests.patch( - url=os.path.join(self.spanner_database_url, 'ddl'), - json={"statements": [sql_cmd]}, - headers=self.headers - ) - - return request.json() - - - - def write_data(self, table, columns, values, mutation='insert'): - values = list(values) - for i,value in enumerate(values): - if type(value) is int: - values[i] = str(value) - - data = { - 'singleUseTransaction': {'readWrite': {}}, - "mutations": [ - { - mutation: { - 'table': table, - 'columns': columns, - 'values': [values] - } - } - ] - } - - request = requests.post( - url=self.sessioned_url+':commit', - json=data, - headers=self.headers - ) - - return request.json() - - - def delete_data(self, table, pkey): - - if isinstance(pkey, int): - pkey = str(pkey) - - data = { - 'singleUseTransaction': {'readWrite': {}}, - "mutations": [ - { - 'delete': { - 'table': table, - 'keySet': {'keys': [[pkey]]}, - } - } - ] - } - - request = requests.post( - url=self.sessioned_url+':commit', - json=data, - headers=self.headers - ) - - return request.json() - - - def get_dict_data(self, sql_cmd): - result = self.exec_sql(sql_cmd) - data = [] - if result.get('rows'): - for row in result['rows']: - row_data = {} - for i, field in enumerate(result.get('metadata', {}).get('rowType', {}).get('fields', [])): - row_data[field['name']] = int(row[i]) if row[i] and field['type']['code'] == 'INT64' else row[i] - data.append(row_data) - - return data - - def get_table_columns(self, table): - result = self.exec_sql('SELECT * FROM {} LIMIT 0'.format(table)) - col_list = [col['name'] for col in result.get('metadata', {}).get('rowType', {}).get('fields', [])] - return col_list - - def get_tables(self): - result = self.exec_sql("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE SPANNER_STATE = 'COMMITTED'") - if not result.get('rows'): - return [] - tables = [rowl[0] for rowl in result['rows']] - return tables - - - def __del__(self): - if self.sessioned_url: - try: - requests.delete(self.sessioned_url, headers=self.headers) - except Exception: - pass - diff --git a/jans-linux-setup/jans_setup/static/rdbm/ldap_sql_data_type_mapping.json b/jans-linux-setup/jans_setup/static/rdbm/ldap_sql_data_type_mapping.json index b15d7f471ad..30fe4280ec7 100644 --- a/jans-linux-setup/jans_setup/static/rdbm/ldap_sql_data_type_mapping.json +++ b/jans-linux-setup/jans_setup/static/rdbm/ldap_sql_data_type_mapping.json @@ -3,50 +3,30 @@ "mysql": { "size": 2, "type": "VARCHAR" - }, - "spanner": { - "size": 2, - "type": "STRING" } }, "1.3.6.1.4.1.1466.115.121.1.12": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "1.3.6.1.4.1.1466.115.121.1.14": { "mysql": { "size": 50, "type": "VARCHAR" - }, - "spanner": { - "size": 50, - "type": "STRING" } }, "1.3.6.1.4.1.1466.115.121.1.15": { "mysql": { "size": 64, "type": "VARCHAR" - }, - "spanner": { - "size": 64, - "type": "STRING" } }, "1.3.6.1.4.1.1466.115.121.1.22": { "mysql": { "size": 20, "type": "VARCHAR" - }, - "spanner": { - "size": 20, - "type": "STRING" } }, "1.3.6.1.4.1.1466.115.121.1.24": { @@ -55,27 +35,17 @@ }, "pgsql": { "type": "TIMESTAMP" - }, - "spanner": { - "type": "TIMESTAMP" } }, "1.3.6.1.4.1.1466.115.121.1.26": { "mysql": { "size": 64, "type": "VARCHAR" - }, - "spanner": { - "size": 64, - "type": "STRING" } }, "1.3.6.1.4.1.1466.115.121.1.27": { "mysql": { "type": "INT" - }, - "spanner": { - "type": "INT64" } }, "1.3.6.1.4.1.1466.115.121.1.40": { @@ -84,29 +54,18 @@ }, "pgsql": { "type": "BYTEA" - }, - "spanner": { - "type": "BYTES(MAX)" } }, "1.3.6.1.4.1.1466.115.121.1.41": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "1.3.6.1.4.1.1466.115.121.1.50": { "mysql": { "size": 20, "type": "VARCHAR" - }, - "spanner": { - "size": 20, - "type": "STRING" } }, "1.3.6.1.4.1.1466.115.121.1.7": { @@ -115,9 +74,6 @@ }, "pgsql": { "type": "BOOLEAN" - }, - "spanner": { - "type": "BOOL" } }, "1.3.6.1.4.1.1466.115.121.1.8": { @@ -126,9 +82,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "JSON": { @@ -137,9 +90,6 @@ }, "pgsql": { "type": "JSONB" - }, - "spanner": { - "type": "ARRAY" } } } diff --git a/jans-linux-setup/jans_setup/static/rdbm/sql_data_types.json b/jans-linux-setup/jans_setup/static/rdbm/sql_data_types.json index 754c165cf3c..88f52e7e44d 100644 --- a/jans-linux-setup/jans_setup/static/rdbm/sql_data_types.json +++ b/jans-linux-setup/jans_setup/static/rdbm/sql_data_types.json @@ -2,18 +2,12 @@ "dat": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "description": { "mysql": { "size": 768, "type": "VARCHAR" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansAttr:description": { @@ -29,58 +23,35 @@ "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "givenName": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "sn": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "urn": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "userPassword": { "mysql": { "size": 256, "type": "VARCHAR" - }, - "spanner": { - "size": 100, - "type": "STRING" } }, "jansAttrs": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansUmaResourcePermission:jansAttrs": { @@ -89,109 +60,68 @@ }, "pgsql": { "type": "JSONB" - }, - "spanner": { - "type": "ARRAY" } }, "jansAuthData": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansCacheConf": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansMessageConf": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansConfApp": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansConfDyn": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansConfErrors": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansConfStatic": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansConfWebKeys": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansDocStoreConf": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansId": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "jansScr": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansStatus": { "mysql": { "size": 16, "type": "VARCHAR" - }, - "spanner": { - "size": 16, - "type": "STRING" } }, "member": { @@ -200,29 +130,18 @@ }, "pgsql": { "type": "JSONB" - }, - "spanner": { - "type": "ARRAY" } }, "jansDeviceKeyHandle": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "jansPublicKeyId": { "mysql": { "size": 256, "type": "VARCHAR" - }, - "spanner": { - "size": 256, - "type": "STRING" } }, "jansRegistrationData": { @@ -231,9 +150,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansDeviceRegistrationConf": { @@ -242,9 +158,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansDeviceData": { @@ -253,9 +166,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansDeviceNotificationConf": { @@ -264,9 +174,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansInitiateLoginURI": { @@ -275,9 +182,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansJwksURI": { @@ -286,9 +190,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansLogoURI": { @@ -297,9 +198,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansPolicyURI": { @@ -308,9 +206,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansSectorIdentifierURI": { @@ -319,9 +214,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansClntURI": { @@ -330,9 +222,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansTosURI": { @@ -341,57 +230,36 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansJwt": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansPermissionGrantedMap": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansInvolvedClnts": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansSessState": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jwtReq": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "attr": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "nnc": { @@ -400,17 +268,11 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "scp": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "tknBndCnf": { @@ -419,29 +281,18 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "tknTyp": { "mysql": { "size": 32, "type": "VARCHAR" - }, - "spanner": { - "size": 32, - "type": "STRING" } }, "acr": { "mysql": { "size": 48, "type": "VARCHAR" - }, - "spanner": { - "size": 48, - "type": "STRING" } }, "jansToken:acr": { @@ -453,52 +304,33 @@ "jansJwks": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansUmaScope": { "mysql": { "size": 768, "type": "VARCHAR" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansSoftStatement": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansScopeExpression": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "tknCde": { "mysql": { "size": 80, "type": "VARCHAR" - }, - "spanner": { - "size": 80, - "type": "STRING" } }, "jansScrError": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "doc_id": { @@ -511,16 +343,6 @@ "type": "VARCHAR" } } - }, - "spanner": { - "size": 64, - "type": "STRING", - "tables": { - "jansClntAuthz": { - "size": 100, - "type": "STRING" - } - } } }, "jansMetaLocation": { @@ -529,19 +351,12 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansUsrDN": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "jansResource": { @@ -550,9 +365,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "scimCustomSecond": { @@ -561,9 +373,6 @@ }, "pgsql": { "type": "JSONB" - }, - "spanner": { - "type": "ARRAY" } }, "jansClntIdIssuedAt": { @@ -572,55 +381,34 @@ }, "pgsql": { "type": "TIMESTAMP" - }, - "spanner": { - "type": "TIMESTAMP" } }, "jansData": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansMobileDevices": { "mysql": { "size": 512, "type": "VARCHAR" - }, - "spanner": { - "size": 512, - "type": "STRING" } }, "jansOTPDevices": { "mysql": { "size": 512, "type": "VARCHAR" - }, - "spanner": { - "size": 512, - "type": "STRING" } }, "jansTrustedDevices": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "cn": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "secretAnswer": { @@ -629,9 +417,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "secretQuestion": { @@ -640,9 +425,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "street": { @@ -651,9 +433,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "address": { @@ -662,9 +441,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "picture": { @@ -673,39 +449,24 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "postalCode": { "mysql": { "size": 16, "type": "VARCHAR" - }, - "spanner": { - "size": 16, - "type": "STRING" } }, "mail": { "mysql": { "size": 96, "type": "VARCHAR" - }, - "spanner": { - "size": 96, - "type": "STRING" } }, "gender": { "mysql": { "size": 32, "type": "VARCHAR" - }, - "spanner": { - "size": 32, - "type": "STRING" } }, "jansNameFormatted": { @@ -714,29 +475,18 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansExtId": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "jansProfileURL": { "mysql": { "size": 256, "type": "VARCHAR" - }, - "spanner": { - "size": 256, - "type": "STRING" } }, "jansApp": { @@ -747,10 +497,6 @@ "pgsql": { "size": 96, "type": "VARCHAR" - }, - "spanner": { - "size": 96, - "type": "STRING" } }, "jansReq": { @@ -759,9 +505,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "mobile": { @@ -770,20 +513,14 @@ }, "pgsql": { "type": "JSONB" - }, - "spanner": { - "type": "ARRAY" } }, "agFlowEncCont": { "mysql": { "type": "MEDIUMTEXT" }, - "pgsql": { + "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "agFlowMeta": { @@ -792,9 +529,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "agFlowTrans": { @@ -803,9 +537,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "agFlowSt": { @@ -814,9 +545,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansCustomMessage": { @@ -827,11 +555,7 @@ "pgsql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" - } + } }, "adsPrjAssets": { "mysql": { @@ -839,9 +563,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "adsPrjDeplDetails": { @@ -850,145 +571,88 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "signingCertificate": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "encryptionPublicKey": { "mysql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "singleLogoutServiceUrl": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "nameIDPolicyFormat": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "singleSignOnServiceUrl": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "jansSAMLspMetaDataURL": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "jansSAMLidpMetaDataURL": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "rootUrl": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "baseUrl": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "adminUrl": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "jansSAMLspMetaDataFN": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "jansSAMLidpMetaDataFN": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "jansSAMLspMetaLocation": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "jansSAMLidpMetaLocation": { "mysql": { "size": 128, "type": "VARCHAR" - }, - "spanner": { - "size": 128, - "type": "STRING" } }, "url": { @@ -997,9 +661,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "httpRequestBody": { @@ -1008,9 +669,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "samlMetadata": { @@ -1019,9 +677,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "document": { @@ -1030,9 +685,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } }, "jansValidation": { @@ -1041,9 +693,6 @@ }, "pgsql": { "type": "TEXT" - }, - "spanner": { - "type": "STRING(MAX)" } } -} +} \ No newline at end of file diff --git a/jans-linux-setup/jans_setup/static/rdbm/sub_tables.json b/jans-linux-setup/jans_setup/static/rdbm/sub_tables.json deleted file mode 100644 index 337009f2950..00000000000 --- a/jans-linux-setup/jans_setup/static/rdbm/sub_tables.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "pgsql": {}, - "mysql": {}, - "spanner": { - "jansPerson": [ - [ - "jansExtUid", - "STRING(MAX)" - ] - ] - } -} diff --git a/jans-linux-setup/jans_setup/templates/jans-spanner.properties b/jans-linux-setup/jans_setup/templates/jans-spanner.properties deleted file mode 100644 index 73db25b7d54..00000000000 --- a/jans-linux-setup/jans_setup/templates/jans-spanner.properties +++ /dev/null @@ -1,30 +0,0 @@ -connection.project=%(spanner_project)s -connection.instance=%(spanner_instance)s -connection.database=%(spanner_database)s - -# Prefix connection.client-property.key=value will be coverterd to key=value -# This is reserved for future usage -#connection.client-property=clientPropertyValue - -# spanner creds or emulator -%(spanner_creds)s - -# Password hash method -password.encryption.method=SSHA-256 - -# Connection pool size -#connection.pool.max-sessions=400 -#connection.pool.min-sessions=100 -#connection.pool.inc-step=25 - -# Max time needed to create connection pool in milliseconds -connection.pool.create-max-wait-time-millis=20000 - -# Maximum allowed statement result set size -statement.limit.default-maximum-result-size=1000 - -# Maximum allowed delete statement result set size -statement.limit.maximum-result-delete-size=10000 - -binaryAttributes=objectGUID -certificateAttributes=userCertificate diff --git a/jans-linux-setup/jans_setup/templates/test/jans-auth/server/config-jans-auth-test-spanner.properties.nrnd b/jans-linux-setup/jans_setup/templates/test/jans-auth/server/config-jans-auth-test-spanner.properties.nrnd deleted file mode 100644 index 08307e1ea4e..00000000000 --- a/jans-linux-setup/jans_setup/templates/test/jans-auth/server/config-jans-auth-test-spanner.properties.nrnd +++ /dev/null @@ -1,25 +0,0 @@ -config.spanner.connection.project=%(spanner_project)s -config.spanner.connection.instance=%(spanner_instance)s -config.spanner.connection.database=%(spanner_database)s - -# Prefix connection.client-property.key=value will be coverterd to key=value -# This is reserved for future usage -#config.spanner.connection.client-property=clientPropertyValue - -# spanner creds or emulator -config.spanner.%(spanner_creds)s - -# Password hash method -config.spanner.password.encryption.method=SSHA-256 - -# Max time needed to create connection pool in milliseconds -config.spanner.connection.pool.create-max-wait-time-millis=20000 - -# Maximum allowed statement result set size -config.spanner.statement.limit.default-maximum-result-size=1000 - -# Maximum allowed delete statement result set size -config.spanner.statement.limit.maximum-result-delete-size=10000 - -config.spanner.binaryAttributes=objectGUID -config.spanner.certificateAttributes=userCertificate diff --git a/jans-linux-setup/jans_setup/tests/analyzer.py b/jans-linux-setup/jans_setup/tests/analyzer.py index 30d4844dbeb..e02178eaf70 100644 --- a/jans-linux-setup/jans_setup/tests/analyzer.py +++ b/jans-linux-setup/jans_setup/tests/analyzer.py @@ -70,7 +70,7 @@ def print_result(result, k, heading): columnsl = columns[:] #columnsl.remove('operation') - if backend in ('sql', 'spanner'): + if backend in ('sql',): columnsl.insert(-1, 'table') sort_result(result)