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

refactor(jans-linux-setup): rename cache-refresh to jans-link #5474

Merged
merged 6 commits into from Jul 12, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions jans-linux-setup/jans_setup/jans_setup.py
Expand Up @@ -132,7 +132,7 @@ def ami_packaged():
from setup_app.installers.scim import ScimInstaller
from setup_app.installers.fido import FidoInstaller
from setup_app.installers.eleven import ElevenInstaller
from setup_app.installers.cache_refresh import CacheRefreshInstaller
from setup_app.installers.jans_link import JansLinkInstaller

from setup_app.installers.config_api import ConfigApiInstaller
from setup_app.installers.jans_cli import JansCliInstaller
Expand Down Expand Up @@ -251,7 +251,7 @@ def ami_packaged():
fidoInstaller = FidoInstaller()
scimInstaller = ScimInstaller()
elevenInstaller = ElevenInstaller()
cache_refresh_installer = CacheRefreshInstaller()
jans_link_installer = JansLinkInstaller()

jansCliInstaller = JansCliInstaller()

Expand Down Expand Up @@ -429,9 +429,9 @@ def do_installation():
not Config.installed_instance and Config.get(elevenInstaller.install_var)):
elevenInstaller.start_installation()

if (Config.installed_instance and cache_refresh_installer.install_var in Config.addPostSetupService) or (
not Config.installed_instance and Config.get(cache_refresh_installer.install_var)):
cache_refresh_installer.start_installation()
if (Config.installed_instance and jans_link_installer.install_var in Config.addPostSetupService) or (
not Config.installed_instance and Config.get(jans_link_installer.install_var)):
jans_link_installer.start_installation()

if Config.install_jans_cli:
jansCliInstaller.start_installation()
Expand Down
8 changes: 4 additions & 4 deletions jans-linux-setup/jans_setup/setup_app/config.py
Expand Up @@ -203,7 +203,7 @@ def progress(self, service_name, msg, incr=False):
self.installOxd = False
self.installEleven = False
self.install_jans_cli = True
self.install_cache_refresh = True
self.install_jans_link = True
self.loadTestData = False
self.allowPreReleasedFeatures = False

Expand Down Expand Up @@ -296,7 +296,7 @@ def progress(self, service_name, msg, incr=False):
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')
self.ldif_site = os.path.join(self.install_dir, 'static/jans-link/o_site.ldif')
self.ldif_configuration = os.path.join(self.output_dir, 'configuration.ldif')

self.system_profile_update_init = os.path.join(self.output_dir, 'system_profile_init')
Expand Down Expand Up @@ -389,8 +389,8 @@ def progress(self, service_name, msg, incr=False):

('site', { 'ldif': [self.ldif_site],
'memory_allocation': 100,
'mapping': 'cache-refresh',
'document_key_prefix': ['site_', 'cache-refresh_'],
'mapping': 'jans-link',
'document_key_prefix': ['site_', 'jans-link_'],
}),

('cache', { 'ldif': [],
Expand Down
Expand Up @@ -59,7 +59,7 @@
"installed": false,
"name": "jans-config-api"
},
"jans-cache-refresh": {
"jans-link": {
"memory": {
"max_allowed_mb": 1024,
"jvm_heap_ration": 0.7,
Expand All @@ -69,6 +69,6 @@
"modules": "server,deploy,resources,http,http-forwarded,console-capture,jsp,websocket"
},
"installed": false,
"name": "jans-cache-refresh"
"name": "jans-link"
}
}
Expand Up @@ -24,7 +24,7 @@ class ConfigApiInstaller(JettyInstaller):
(os.path.join(Config.dist_jans_dir, 'scim-plugin.jar'), os.path.join(base.current_app.app_info['JANS_MAVEN'], 'maven/io/jans/jans-config-api/plugins/scim-plugin/{0}/scim-plugin-{0}-distribution.jar').format(base.current_app.app_info['ox_version'])),
(os.path.join(Config.dist_jans_dir, 'user-mgt-plugin.jar'), os.path.join(base.current_app.app_info['JANS_MAVEN'], 'maven/io/jans/jans-config-api/plugins/user-mgt-plugin/{0}/user-mgt-plugin-{0}-distribution.jar').format(base.current_app.app_info['ox_version'])),
(os.path.join(Config.dist_jans_dir, 'fido2-plugin.jar'), os.path.join(base.current_app.app_info['JANS_MAVEN'], 'maven/io/jans/jans-config-api/plugins/fido2-plugin/{0}/fido2-plugin-{0}-distribution.jar').format(base.current_app.app_info['ox_version'])),
(os.path.join(Config.dist_jans_dir, 'cache-refresh-plugin.jar'), os.path.join(base.current_app.app_info['JANS_MAVEN'], 'maven/io/jans/jans-config-api/plugins/cache-refresh-plugin/{0}/cache-refresh-plugin-{0}-distribution.jar').format(base.current_app.app_info['ox_version'])),
(os.path.join(Config.dist_jans_dir, 'jans-link-plugin.jar'), os.path.join(base.current_app.app_info['JANS_MAVEN'], 'maven/io/jans/jans-config-api/plugins/jans-link-plugin/{0}/jans-link-plugin-{0}-distribution.jar').format(base.current_app.app_info['ox_version'])),
]

def __init__(self):
Expand Down Expand Up @@ -67,8 +67,8 @@ def install(self):
if Config.installFido2:
self.install_plugin('fido2-plugin')

if Config.install_cache_refresh:
self.install_plugin('cache-refresh-plugin')
if Config.install_jans_link:
self.install_plugin('jans-link-plugin')

self.enable()

Expand Down
4 changes: 2 additions & 2 deletions jans-linux-setup/jans_setup/setup_app/installers/jans.py
Expand Up @@ -75,7 +75,7 @@ def __repr__(self):
if Config.profile == 'jans':
txt += 'Install Fido2 Server'.ljust(30) + repr(Config.installFido2).rjust(35) + (' *' if 'installFido2' in Config.addPostSetupService else '') + "\n"
txt += 'Install Scim Server'.ljust(30) + repr(Config.install_scim_server).rjust(35) + (' *' if 'install_scim_server' in Config.addPostSetupService else '') + "\n"
txt += 'Install Cache Refresh Server'.ljust(30) + repr(Config.install_cache_refresh).rjust(35) + (' *' if 'install_cache_refresh' in Config.addPostSetupService else '') + "\n"
txt += 'Install Jans Link Server'.ljust(30) + repr(Config.install_jans_link).rjust(35) + (' *' if 'install_jans_link' in Config.addPostSetupService else '') + "\n"
#txt += 'Install Oxd '.ljust(30) + repr(Config.installOxd).rjust(35) + (' *' if 'installOxd' in Config.addPostSetupService else '') + "\n"

if Config.profile == 'jans' and Config.installEleven:
Expand Down Expand Up @@ -631,7 +631,7 @@ def order_services(self):
('jans-auth', 'installOxAuth'),
('jans-config-api', 'install_config_api'),
('jans-fido2', 'installFido2'),
('jans-cache-refresh', 'install_cache_refresh'),
('jans-link', 'install_jans_link'),
('jans-scim', 'install_scim_server'),
]
service_listr = service_list[:]
Expand Down
Expand Up @@ -82,8 +82,8 @@ def install(self):
base.extract_file(base.current_app.jans_zip, 'jans-config-api/docs/jans-config-api-swagger.yaml', os.path.join(ops_dir, 'jca', 'jans-config-api-swagger.yaml'), ren=True)
plugin_yamls = ['fido2-plugin-swagger.yaml', 'jans-admin-ui-plugin-swagger.yaml', 'scim-plugin-swagger.yaml', 'user-mgt-plugin-swagger.yaml']

if Config.install_cache_refresh:
plugin_yamls.append('cache-refresh-plugin-swagger.yaml')
if Config.install_jans_link:
plugin_yamls.append('jans-link-plugin-swagger.yaml')

for plugin_yaml_file in plugin_yamls:
base.extract_file(base.current_app.jans_zip, 'jans-config-api/plugins/docs/'+plugin_yaml_file, os.path.join(ops_dir, 'jca', plugin_yaml_file), ren=True)
Expand Down
Expand Up @@ -10,29 +10,29 @@
from setup_app.installers.jetty import JettyInstaller


class CacheRefreshInstaller(JettyInstaller):
class JansLinkInstaller(JettyInstaller):

source_files = [
(os.path.join(Config.dist_jans_dir, 'jans-cache-refresh.war'), os.path.join(base.current_app.app_info['JANS_MAVEN'], 'maven/io/jans/jans-cache-refresh/{0}/jans-cache-refresh-{0}.war').format(base.current_app.app_info['ox_version']))
(os.path.join(Config.dist_jans_dir, 'jans-link.war'), os.path.join(base.current_app.app_info['JANS_MAVEN'], 'maven/io/jans/jans-link/{0}/jans-link-{0}.war').format(base.current_app.app_info['ox_version']))
]

def __init__(self):
setattr(base.current_app, self.__class__.__name__, self)
self.service_name = 'jans-cache-refresh'
self.service_name = 'jans-link'
self.needdb = True
self.app_type = AppType.SERVICE
self.install_type = InstallOption.OPTONAL
self.install_var = 'install_cache_refresh'
self.install_var = 'install_jans_link'
self.register_progess()

self.jetty_service_webapps = os.path.join(self.jetty_base, self.service_name, 'webapps')
self.output_folder = os.path.join(Config.output_dir, self.service_name)
self.templates_folder = os.path.join(Config.templateFolder, self.service_name)
self.ldif_config_fn = os.path.join(self.output_folder, 'configuration.ldif')
self.config_json_fn = os.path.join(self.templates_folder, 'jans-cache-refresh-config.json')
self.static_config_json_fn = os.path.join(self.templates_folder, 'jans-cache-refresh-static-config.json')
self.config_json_fn = os.path.join(self.templates_folder, 'jans-link-config.json')
self.static_config_json_fn = os.path.join(self.templates_folder, 'jans-link-static-config.json')
self.vendor_dir = '/var/jans/'
self.snapshots_dir = os.path.join(self.vendor_dir, 'cr-snapshots')
self.snapshots_dir = os.path.join(self.vendor_dir, 'link-snapshots')

def install(self):
self.installJettyService(self.jetty_app_configuration[self.service_name], True)
Expand All @@ -42,13 +42,13 @@ def install(self):
def render_import_templates(self):
self.logIt("Preparing base64 encodings configuration files")
self.renderTemplateInOut(self.config_json_fn, self.templates_folder, self.output_folder)
Config.templateRenderingDict['cache_refresh_config_base64'] = self.generate_base64_ldap_file(
Config.templateRenderingDict['jans_link_config_base64'] = self.generate_base64_ldap_file(
os.path.join(
self.output_folder,
os.path.basename(self.config_json_fn)
)
)
Config.templateRenderingDict['cache_refresh_static_conf_base64'] = self.generate_base64_ldap_file(self.static_config_json_fn)
Config.templateRenderingDict['jans_link_static_conf_base64'] = self.generate_base64_ldap_file(self.static_config_json_fn)

self.renderTemplateInOut(self.ldif_config_fn, self.templates_folder, self.output_folder)

Expand Down
6 changes: 3 additions & 3 deletions jans-linux-setup/jans_setup/setup_app/setup_options.py
Expand Up @@ -18,7 +18,7 @@ def get_setup_options():
'installOxd': False,
'installFido2': True,
'installEleven': False,
'install_cache_refresh': True,
'install_jans_link': True,
'loadTestData': False,
'allowPreReleasedFeatures': False,
'listenAllInterfaces': False,
Expand Down Expand Up @@ -102,8 +102,8 @@ def get_setup_options():
if base.argsp.install_eleven:
setupOptions['installEleven'] = True

if base.argsp.install_cache_refresh:
setupOptions['install_cache_refresh'] = True
if base.argsp.install_jans_link:
setupOptions['install_jans_link'] = True


if base.argsp.jans_max_mem:
Expand Down
Expand Up @@ -93,7 +93,7 @@
parser.add_argument('--no-scim', help="Do not install Scim Server", action='store_true')
parser.add_argument('--no-fido2', help="Do not install Fido2 Server", action='store_true')
parser.add_argument('--install-eleven', help="Install Eleven Server", action='store_true')
parser.add_argument('--install-cache-refresh', help="Install Cache Refresh Server", action='store_true')
parser.add_argument('--install-jans-link', help="Install Link Server", action='store_true')

#parser.add_argument('--oxd-use-jans-storage', help="Use Jans Storage for Oxd Server", action='store_true')
parser.add_argument('--load-config-api-test', help="Load Config Api Test Data", action='store_true')
Expand Down
Expand Up @@ -105,7 +105,7 @@ def collect(self):
Config.mapping_locations = {'default': jans_hybrid_properties['storage.default']}
storages = [ storage.strip() for storage in jans_hybrid_properties['storages'].split(',') ]

for ml, m in (('user', 'people'), ('cache', 'cache'), ('site', 'cache-refresh'), ('token', 'tokens')):
for ml, m in (('user', 'people'), ('cache', 'cache'), ('site', 'link'), ('token', 'tokens')):
for storage in storages:
if m in jans_hybrid_properties.get('storage.{}.mapping'.format(storage),[]):
Config.mapping_locations[ml] = storage
Expand Down Expand Up @@ -238,7 +238,7 @@ def collect(self):
Config.installFido2 = os.path.exists(os.path.join(Config.jetty_base, 'jans-fido2/start.ini'))
Config.installEleven = os.path.exists(os.path.join(Config.jetty_base, 'jans-eleven/start.ini'))
Config.install_config_api = os.path.exists(os.path.join(Config.jansOptFolder, 'jans-config-api'))
Config.install_cache_refresh = os.path.exists(os.path.join(Config.jansOptFolder, 'jans-cache-refresh'))
Config.install_jans_link = os.path.exists(os.path.join(Config.jansOptFolder, 'jans-link'))

def save(self):
if os.path.exists(Config.setup_properties_fn):
Expand Down
Expand Up @@ -597,18 +597,18 @@ def promptForEleven(self):
Config.addPostSetupService.append('installEleven')


def prompt_for_cache_refresh(self):
if Config.installed_instance and Config.install_cache_refresh:
def prompt_for_jans_link(self):
if Config.installed_instance and Config.install_jans_link:
return

promp_cache_refresh = self.getPrompt("Install Cache Refresh Server?",
self.getDefaultOption(Config.install_cache_refresh)
prompt_jans_link = self.getPrompt("Install Jans Link Server?",
self.getDefaultOption(Config.install_jans_link)
)[0].lower()

Config.install_cache_refresh = promp_cache_refresh == 'y'
Config.install_jans_link = prompt_jans_link == 'y'

if Config.installed_instance and Config.install_cache_refresh:
Config.addPostSetupService.append('install_cache_refresh')
if Config.installed_instance and Config.install_jans_link:
Config.addPostSetupService.append('install_jans_link')


def promptForConfigApi(self):
Expand Down Expand Up @@ -956,7 +956,7 @@ def promptForProperties(self):
self.promptForConfigApi()
self.promptForScimServer()
self.promptForFido2Server()
self.prompt_for_cache_refresh()
self.prompt_for_jans_link()
#self.promptForEleven()
#if (not Config.installOxd) and Config.oxd_package:
# self.promptForOxd()
Expand Down

This file was deleted.

@@ -0,0 +1,13 @@
[Unit]
Description=Janssen Link Server
After=%(order_jans_link_service)s

[Service]
Type=forking
ExecStart=/opt/dist/scripts/jans-link start
ExecStop=/opt/dist/scripts/jans-link stop
User=jetty
Group=jetty

[Install]
WantedBy=multi-user.target

This file was deleted.

Expand Up @@ -38,20 +38,20 @@
"userPassword"
],
"userMandatoryAttributes": [
"mail",
"displayName",
"jansStatus",
"userPassword",
"givenName"
"mail",
"displayName",
"jansStatus",
"userPassword",
"givenName"
],
"agamaConfiguration": {
"mandatoryAttributes": [
"qname",
"source"
"mandatoryAttributes": [
"qname",
"source"
],
"optionalAttributes": [
"serialVersionUID",
"enabled"
"optionalAttributes": [
"serialVersionUID",
"enabled"
]
},
"auditLogConf": {
Expand Down Expand Up @@ -89,9 +89,9 @@
"className": "io.jans.configapi.plugin.mgt.rest.ApiApplication"
},
{
"name": "cache-refresh",
"description": "cache-refresh plugin",
"className": "io.jans.configapi.plugin.cacherefresh.rest.ApiApplication"
"name": "jans-link",
"description": "jans-link plugin",
"className": "io.jans.configapi.plugin.janslink.rest.ApiApplication"
}
]
}
Expand Down
@@ -0,0 +1,8 @@
dn: ou=jans-link,ou=configuration,o=jans
jansConfDyn::%(jans_link_config_base64)s
jansConfStatic::%(jans_link_static_conf_base64)s
jansRevision: 1
objectClass: top
objectClass: jansAppConf
ou: jans-link

2 changes: 1 addition & 1 deletion jans-linux-setup/jans_setup/templates/jans.properties
Expand Up @@ -4,7 +4,7 @@ jansAuth_ConfigurationEntryDN=ou=jans-auth,ou=configuration,o=jans
fido2_ConfigurationEntryDN=ou=jans-fido2,ou=configuration,o=jans
scim_ConfigurationEntryDN=ou=jans-scim,ou=configuration,o=jans
configApi_ConfigurationEntryDN=ou=jans-config-api,ou=configuration,o=jans
cacheRefresh_ConfigurationEntryDN=ou=jans-cache-refresh,ou=configuration,o=jans
cacheRefresh_ConfigurationEntryDN=ou=jans-link,ou=configuration,o=jans

certsDir=%(certFolder)s
confDir=
Expand Down
11 changes: 0 additions & 11 deletions jans-linux-setup/jans_setup/templates/jetty/jans-cache-refresh

This file was deleted.

11 changes: 11 additions & 0 deletions jans-linux-setup/jans_setup/templates/jetty/jans-link
@@ -0,0 +1,11 @@
JAVA_HOME=%(jre_home)s
JAVA=$JAVA_HOME/bin/java
JAVA_OPTIONS="-server -Xms%(jans-link_min_heap_mem)sm -Xmx%(jans-link_max_heap_mem)sm -XX:+DisableExplicitGC -Djans.base=%(jansBaseFolder)s -Dserver.base=%(jetty_base)s/jans-link -Dlog.base=%(jetty_base)s/jans-link -Dpython.home=%(jython_home)s"

JETTY_HOME=%(jetty_home)s
JETTY_BASE=%(jetty_base)s/jans-link
JETTY_USER=%(jetty_user)s
JETTY_ARGS="jetty.http.host=localhost jetty.http.port=9091"
TMPDIR=%(jetty_dist)s/temp

export PYTHON_HOME=%(jython_home)s