Skip to content

Commit

Permalink
feat: jans-linux-setup load pure java sample custom script (#1335)
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar authored May 16, 2022
1 parent bb0c885 commit 60cb36c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 deletions.
4 changes: 4 additions & 0 deletions jans-linux-setup/jans_setup/setup_app/installers/jans.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def __repr__(self):
txt += 'Install Scim Server'.ljust(30) + repr(Config.install_scim_server).rjust(35) + (' *' if 'install_scim_server' in Config.addPostSetupService else '') + "\n"
txt += 'Install Eleven Server'.ljust(30) + repr(Config.installEleven).rjust(35) + (' *' if 'installEleven' in Config.addPostSetupService else '') + "\n"
#txt += 'Install Oxd '.ljust(30) + repr(Config.installOxd).rjust(35) + (' *' if 'installOxd' in Config.addPostSetupService else '') + "\n"

if base.argsp.t:
txt += 'Load Test Data '.ljust(30) + repr( base.argsp.t).rjust(35) + "\n"

return txt

except Exception as e:
Expand Down
15 changes: 9 additions & 6 deletions jans-linux-setup/jans_setup/setup_app/test_data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ def create_test_client_keystore(self):
self.copyFile(client_keystore_fn, os.path.join(Config.output_dir, 'test/jans-auth/server'))
self.copyFile(keys_json_fn, os.path.join(Config.output_dir, 'test/jans-auth/server'))


def enable_cusom_scripts(self):
self.logIt("Enabling custom scripts")
custom_scripts = ('2DAF-F995', '2DAF-F996', '4BBE-C6A8', 'A51E-76DA', '0300-BA90')
for inum in custom_scripts:
self.dbUtils.enable_script(inum)


def load_test_data(self):
Config.pbar.progress(self.service_name, "Loading Test Data", False)
self.logIt("Re-binding database")
Expand Down Expand Up @@ -265,14 +273,9 @@ def load_test_data(self):
oxAuthConfDynamic_changes.update(datajs)
self.logIt("oxAuthConfDynamic was updated with auto test ciba patch")

custom_scripts = ('2DAF-F995', '2DAF-F996', '4BBE-C6A8', 'A51E-76DA')

self.dbUtils.set_oxAuthConfDynamic(oxAuthConfDynamic_changes)


# Enable custom scripts
for inum in custom_scripts:
self.dbUtils.enable_script(inum)
self.enable_cusom_scripts()

if self.dbUtils.moddb == static.BackendTypes.LDAP:
# Update LDAP schema
Expand Down
2 changes: 1 addition & 1 deletion jans-linux-setup/jans_setup/setup_app/utils/crypto64.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def prepare_base64_extension_scripts(self, extensions=[]):
self.logIt("Preparing scripts")
extension_path = Path(Config.extensionFolder)
for ep in extension_path.glob("**/*"):
if ep.is_file() and ep.suffix in ['.py']:
if ep.is_file() and ep.suffix.lower() in ['.py', '.java']:
extension_type = ep.parent.name.lower()
extension_name = ep.stem.lower()
extension_script_name = '{}_{}'.format(extension_type, extension_name)
Expand Down
1 change: 1 addition & 0 deletions jans-linux-setup/jans_setup/setup_app/utils/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def set_oxAuthConfDynamic(self, entries):


def enable_script(self, inum):
base.logIt("Enabling script {}".format(inum))
if self.moddb == BackendTypes.LDAP:
ldap_operation_result = self.ldap_conn.modify(
'inum={},ou=scripts,o=jans'.format(inum),
Expand Down
14 changes: 14 additions & 0 deletions jans-linux-setup/jans_setup/templates/scripts.ldif
Original file line number Diff line number Diff line change
Expand Up @@ -516,3 +516,17 @@ jansRevision: 1
jansProgLng: python
jansScrTyp: config_api_auth
jansScr::%(config_api_config_api_interception)s

dn: inum=0300-BA90,ou=scripts,o=jans
objectClass: jansCustomScr
objectClass: top
description: Java Custom Sample Script
displayName: discovery_java_params
inum: 0300-BA90
jansEnabled: FALSE
jansLevel: 1
jansModuleProperty: {"value1":"location_type","value2":"ldap","description":""}
jansProgLng: java
jansRevision: 11
jansScr::%(discovery_discovery)s
jansScrTyp: discovery

0 comments on commit 60cb36c

Please sign in to comment.