Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: jans-linux-setup agama #1486

Merged
merged 2 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions jans-linux-setup/jans_setup/setup_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ def progress(self, service_name, msg, incr=False):
self.ldif_base = os.path.join(self.output_dir, 'base.ldif')
self.ldif_attributes = os.path.join(self.output_dir, 'attributes.ldif')
self.ldif_scopes = os.path.join(self.output_dir, 'scopes.ldif')
self.ldif_agama = os.path.join(self.output_dir, 'agama.ldif')

self.ldif_metric = os.path.join(self.staticFolder, 'metric/o_metric.ldif')
self.ldif_site = os.path.join(self.install_dir, 'static/cache-refresh/o_site.ldif')
Expand Down Expand Up @@ -316,6 +317,7 @@ def progress(self, service_name, msg, incr=False):
self.ldif_site,
self.ldif_metric,
self.ldif_configuration,
self.ldif_agama,
]


Expand All @@ -327,6 +329,7 @@ def progress(self, service_name, msg, incr=False):
self.ldif_base: False,
self.ldif_attributes: False,
self.ldif_scopes: False,
self.ldif_agama: False,
}

if self.profile != OPENBANKING_PROFILE:
Expand Down Expand Up @@ -360,6 +363,7 @@ def progress(self, service_name, msg, incr=False):
self.ldif_scopes,
self.ldif_configuration,
self.ldif_metric,
self.ldif_agama,
],
'memory_allocation': 100,
'mapping': '',
Expand Down
22 changes: 18 additions & 4 deletions jans-linux-setup/jans_setup/setup_app/installers/jans_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(self):
(os.path.join(Config.dist_jans_dir, 'jans-auth-client-jar-with-dependencies.jar'), os.path.join(base.current_app.app_info['JANS_MAVEN'], 'maven/io/jans/jans-auth-client/{0}/jans-auth-client-{0}-jar-with-dependencies.jar'.format(base.current_app.app_info['ox_version']))),
]

self.jetty_service_webapps = os.path.join(self.jetty_base, self.service_name, 'webapps')
self.templates_folder = os.path.join(Config.templateFolder, self.service_name)
self.output_folder = os.path.join(Config.output_dir, self.service_name)

Expand All @@ -51,10 +52,8 @@ def install(self):
self.logIt("Copying auth.war into jetty webapps folder...")

self.installJettyService(self.jetty_app_configuration[self.service_name], True)

jettyServiceWebapps = os.path.join(self.jetty_base, self.service_name, 'webapps')
self.copyFile(self.source_files[0][0], jettyServiceWebapps)

self.copyFile(self.source_files[0][0], self.jetty_service_webapps)
self.setup_agama()
self.enable()

def generate_configuration(self):
Expand Down Expand Up @@ -184,3 +183,18 @@ def import_openbanking_key(self):

if os.path.isfile(Config.ob_key_fn) and os.path.isfile(Config.ob_cert_fn):
self.import_key_cert_into_keystore('obsigning', self.oxauth_openid_jks_fn, Config.oxauth_openid_jks_pass, Config.ob_key_fn, Config.ob_cert_fn, Config.ob_alias)

def setup_agama(self):
agama_root = os.path.join(self.jetty_base, self.service_name, 'agama')
self.createDirs(agama_root)
for adir in ('fl', 'ftl', 'scripts'):
self.createDirs(os.path.join(agama_root, adir))
base.extract_from_zip(base.current_app.jans_zip, 'agama/misc', agama_root)
self.chown(agama_root, Config.jetty_user, Config.jetty_group, recursive=True)

tmp_dir = os.path.join(Config.templateFolder, 'jetty')
src_xml = os.path.join(tmp_dir, 'agama_web_resources.xml')
self.renderTemplateInOut(src_xml, tmp_dir, self.jetty_service_webapps)
self.chown(os.path.join(self.jetty_service_webapps, os.path.basename(src_xml)), Config.jetty_user, Config.jetty_group)


3 changes: 2 additions & 1 deletion jans-linux-setup/jans_setup/setup_app/utils/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ def extract_from_zip(zip_file, sub_dir, target_dir, remove_target_dir=False):
if remove_target_dir and target_dir_path.exists():
shutil.rmtree(target_dir_path)

target_dir_path.mkdir(parents=True)
if not target_dir_path.exists():
target_dir_path.mkdir(parents=True)

for member in zipobj.infolist():
if member.filename.startswith(parent_sub_dir):
Expand Down
14 changes: 14 additions & 0 deletions jans-linux-setup/jans_setup/templates/agama.ldif
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
dn: ou=agama,o=jans
objectClass: organizationalUnit
objectClass: top
ou: agama

dn: ou=runs,ou=agama,o=jans
objectClass: organizationalUnit
objectClass: top
ou: runs

dn: ou=flows,ou=agama,o=jans
objectClass: organizationalUnit
objectClass: top
ou: flows
16 changes: 16 additions & 0 deletions jans-linux-setup/jans_setup/templates/scripts.ldif
Original file line number Diff line number Diff line change
Expand Up @@ -530,3 +530,19 @@ jansProgLng: java
jansRevision: 11
jansScr::%(discovery_discovery)s
jansScrTyp: discovery

dn: inum=BADA-BADA,ou=scripts,o=jans
objectClass: jansCustomScr
objectClass: top
description: Agama Script
displayName: agama
inum: BADA-BADA
jansConfProperty: {"value1":"cust_param_name","value2":"customParam1","hide":false,"description":""}
jansEnabled: false
jansLevel: 10
jansModuleProperty: {"value1":"usage_type","value2":"interactive","description":""}
jansModuleProperty: {"value1":"location_type","value2":"ldap","description": ""}
jansProgLng: python
jansRevision: 1
jansScr::%(person_authentication_agamabridge)s
jansScrTyp: person_authentication