diff --git a/jans-cli/Makefile b/jans-cli/Makefile index f8a5ba016b6..5a916486caa 100644 --- a/jans-cli/Makefile +++ b/jans-cli/Makefile @@ -1,7 +1,7 @@ .DEFAULT_GOAL := develop develop: - /usr/bin/env python3 setup.py develop + pip3 install -e . install: pip3 install . @@ -10,4 +10,4 @@ uninstall: pip3 uninstall jans-cli -y zipapp: - shiv --compressed -o jans-cli.pyz -p '/usr/bin/env python3' -e cli.config_cli:main . --no-cache + shiv --compressed -o config-cli.pyz -p '/usr/bin/env python3' -e cli.config_cli:main . --no-cache diff --git a/jans-cli/README.md b/jans-cli/README.md index b80584001c5..41877831b2e 100644 --- a/jans-cli/README.md +++ b/jans-cli/README.md @@ -65,7 +65,7 @@ If you would like to build `jans-cli` manually, you can go through the following You can verify with the following command line if everything is done successfully. ``` -python3 jans-cli.pyz -h +python3 config-cli.pyz -h ``` diff --git a/jans-cli/cli/config_cli.py b/jans-cli/cli/config_cli.py index 90ca490f8f5..b19463d4030 100644 --- a/jans-cli/cli/config_cli.py +++ b/jans-cli/cli/config_cli.py @@ -22,7 +22,8 @@ from pathlib import Path from urllib.parse import urlencode from collections import OrderedDict - +from prompt_toolkit import prompt, HTML +from prompt_toolkit.completion import WordCompleter home_dir = Path.home() config_dir = home_dir.joinpath('.config') @@ -47,6 +48,7 @@ swagger_client.models = importlib.import_module(my_op_mode + '.swagger_client.models') swagger_client.api = importlib.import_module(my_op_mode + '.swagger_client.api') swagger_client.rest = importlib.import_module(my_op_mode + '.swagger_client.rest') +plugins = [] warning_color = 214 error_color = 196 @@ -100,6 +102,7 @@ def join(self): parser.add_argument("--host", help="Hostname of server") parser.add_argument("--client-id", help="Jans Config Api Client ID") parser.add_argument("--client_secret", help="Jans Config Api Client ID secret") +parser.add_argument("--plugins", help="Available plugins separated by comma") parser.add_argument("-debug", help="Run in debug mode", action='store_true') parser.add_argument("--debug-log-file", default='swagger.log', help="Log file name when run in debug mode") parser.add_argument("--operation-id", help="Operation ID to be done") @@ -126,6 +129,9 @@ def join(self): ################## end of arguments ################# +if args.plugins: + for plugin in args.plugins.split(','): + plugins.append(plugin.strip()) def write_config(): with open(config_ini_fn, 'w') as w: @@ -247,6 +253,12 @@ def __init__(self, host, client_id, client_secret): self.swagger_configuration = swagger_client.Configuration() self.swagger_configuration.host = 'https://{}'.format(self.host) self.access_token = config['DEFAULT'].get('access_token') + + for plugin_s in config['DEFAULT'].get(my_op_mode + '_plugins', '').split(','): + plugin = plugin_s.strip() + if plugin: + plugins.append(plugin) + if not self.access_token and config['DEFAULT'].get('access_token_enc'): self.access_token = encode_decode(config['DEFAULT']['access_token_enc'], decode=True) @@ -352,11 +364,16 @@ def make_menu(self): menu.add_child(m) for path in self.cfg_yml['paths']: for method in self.cfg_yml['paths'][path]: + if 'tags' in self.cfg_yml['paths'][path][method] and m.name in \ self.cfg_yml['paths'][path][method]['tags'] and 'operationId' in \ self.cfg_yml['paths'][path][method]: - # if isinstance(self.cfg_yml['paths'][path][method], dict) and self.cfg_yml['paths'][path][method].get('x-cli-ignore'): - # continue + + if isinstance(self.cfg_yml['paths'][path][method], dict) and self.cfg_yml['paths'][path][method].get('x-cli-plugin') and not self.cfg_yml['paths'][path][method]['x-cli-plugin'] in plugins: + if m in menu.children: + menu.children.remove(m) + continue + menu_name = self.cfg_yml['paths'][path][method].get('summary') or \ self.cfg_yml['paths'][path][method].get('description') @@ -576,6 +593,8 @@ def get_input(self, values=[], text='Selection', default=None, itype=None, default = False else: type_text = "Type: " + itype + if values: + type_text += ', Valid values: {}'.format(self.colored_text(', '.join(values), bold_color)) if help_text: help_text = help_text.strip('.') + '. ' + type_text @@ -594,7 +613,7 @@ def get_input(self, values=[], text='Selection', default=None, itype=None, if not default is None: default_text = str(default).lower() if itype == 'boolean' else str(default) - text += self.colored_text(' [' + default_text + ']', 11) + text += ' [' + default_text + ']' if itype == 'integer': default = int(default) @@ -605,7 +624,9 @@ def get_input(self, values=[], text='Selection', default=None, itype=None, values = ['_true', '_false'] while True: - selection = input(' ' * spacing + self.colored_text(text, 20) + ' ') + #selection = input(' ' * spacing + self.colored_text(text, 20) + ' ') + html_completer = WordCompleter(values) + selection = prompt(HTML(' ' * spacing + text + ' '), completer=html_completer) selection = selection.strip() if selection.startswith('_file '): fname = selection.split()[1] @@ -1529,7 +1550,6 @@ def print_fields(): def display_menu(self, menu): clear() - print(self.colored_text("*** WARNING! This software is experimental ***", warning_color)) self.current_menu = menu self.print_underlined(menu.name) diff --git a/jans-cli/cli/jca.yaml b/jans-cli/cli/jca.yaml index dc3a15e923a..7cd9bebbe00 100644 --- a/jans-cli/cli/jca.yaml +++ b/jans-cli/cli/jca.yaml @@ -16,15 +16,15 @@ tags: - name: Attribute - name: Default Authentication Method - name: Cache Configuration - - name: Cache Configuration – Memcached - - name: Cache Configuration – Redis - - name: Cache Configuration – in-Memory - - name: Cache Configuration – Native-Persistence - - name: Configuration – Properties - - name: Configuration – Fido2 - - name: Configuration – SMTP - - name: Configuration – Logging - - name: Configuration – JWK - JSON Web Key (JWK) + - name: Cache Configuration - Memcached + - name: Cache Configuration - Redis + - name: Cache Configuration - in-Memory + - name: Cache Configuration - Native-Persistence + - name: Configuration - Properties + - name: Configuration - Fido2 + - name: Configuration - SMTP + - name: Configuration - Logging + - name: Configuration - JWK - JSON Web Key (JWK) - name: Custom Scripts - name: Database - LDAP configuration - name: Database - Couchbase configuration @@ -51,7 +51,7 @@ paths: security: - oauth2: [https://jans.io/oauth/jans-auth-server/config/properties.readonly] tags: - - Configuration – Properties + - Configuration - Properties responses: '200': description: OK @@ -72,7 +72,7 @@ paths: security: - oauth2: [https://jans.io/oauth/jans-auth-server/config/properties.write] tags: - - Configuration – Properties + - Configuration - Properties requestBody: content: application/json-patch+json: @@ -103,7 +103,7 @@ paths: security: - oauth2: [https://jans.io/oauth/jans-auth-server/config/properties.readonly] tags: - - Configuration – Properties + - Configuration - Properties responses: '200': description: OK @@ -123,7 +123,7 @@ paths: description: Gets Jans Authorization Server Fido2 configuration properties. operationId: get-properties-fido2 tags: - - Configuration – Fido2 + - Configuration - Fido2 responses: '200': description: OK @@ -142,7 +142,7 @@ paths: description: Updates Fido2 configuration properties. operationId: put-properties-fido2 tags: - - Configuration – Fido2 + - Configuration - Fido2 requestBody: content: application/json: @@ -1158,7 +1158,7 @@ paths: description: Returns Memcached cache configuration. operationId: get-config-cache-memcached tags: - - Cache Configuration – Memcached + - Cache Configuration - Memcached responses: '200': description: OK @@ -1177,7 +1177,7 @@ paths: description: Updates Memcached cache configuration. operationId: put-config-cache-memcached tags: - - Cache Configuration – Memcached + - Cache Configuration - Memcached requestBody: content: application/json: @@ -1204,7 +1204,7 @@ paths: description: Partially modifies Memcached cache configuration. operationId: patch-config-cache-memcached tags: - - Cache Configuration – Memcached + - Cache Configuration - Memcached requestBody: content: application/json-patch+json: @@ -1233,7 +1233,7 @@ paths: description: Returns Redis cache configuration. operationId: get-config-cache-redis tags: - - Cache Configuration – Redis + - Cache Configuration - Redis responses: '200': description: OK @@ -1252,7 +1252,7 @@ paths: description: Updates Redis cache configuration. operationId: put-config-cache-redis tags: - - Cache Configuration – Redis + - Cache Configuration - Redis requestBody: content: application/json: @@ -1277,7 +1277,7 @@ paths: description: Partially modifies Redis cache configuration. operationId: patch-config-cache-redis tags: - - Cache Configuration – Redis + - Cache Configuration - Redis requestBody: content: application/json-patch+json: @@ -1306,7 +1306,7 @@ paths: description: Returns in-Memory cache configuration. operationId: get-config-cache-in-memory tags: - - Cache Configuration – in-Memory + - Cache Configuration - in-Memory responses: '200': description: OK @@ -1325,7 +1325,7 @@ paths: description: Updates in-Memory cache configuration. operationId: put-config-cache-in-memory tags: - - Cache Configuration – in-Memory + - Cache Configuration - in-Memory requestBody: content: application/json: @@ -1350,7 +1350,7 @@ paths: description: Partially modifies In-Memory cache configuration. operationId: patch-config-cache-in-memory tags: - - Cache Configuration – in-Memory + - Cache Configuration - in-Memory requestBody: content: application/json-patch+json: @@ -1379,7 +1379,7 @@ paths: description: Returns native persistence cache configuration. operationId: get-config-cache-native-persistence tags: - - Cache Configuration – Native-Persistence + - Cache Configuration - Native-Persistence responses: '200': description: OK @@ -1398,7 +1398,7 @@ paths: description: Updates native persistence cache configuration. operationId: put-config-cache-native-persistence tags: - - Cache Configuration – Native-Persistence + - Cache Configuration - Native-Persistence requestBody: content: application/json: @@ -1423,7 +1423,7 @@ paths: description: Partially modifies Native Persistence cache configuration. operationId: patch-config-cache-native-persistence tags: - - Cache Configuration – Native-Persistence + - Cache Configuration - Native-Persistence requestBody: content: application/json-patch+json: @@ -1452,7 +1452,7 @@ paths: description: Returns SMTP server configuration. operationId: get-config-smtp tags: - - Configuration – SMTP + - Configuration - SMTP responses: '200': description: OK @@ -1471,7 +1471,7 @@ paths: description: Adds SMTP server configuration. operationId: post-config-smtp tags: - - Configuration – SMTP + - Configuration - SMTP requestBody: content: application/json: @@ -1495,7 +1495,7 @@ paths: description: Updates SMTP server configuration. operationId: put-config-smtp tags: - - Configuration – SMTP + - Configuration - SMTP requestBody: content: application/json: @@ -1521,7 +1521,7 @@ paths: description: Deletes SMTP server configuration. operationId: delete-config-smtp tags: - - Configuration – SMTP + - Configuration - SMTP responses: '204': description: No Content @@ -1540,7 +1540,7 @@ paths: description: Test SMTP server configuration. operationId: test-config-smtp tags: - - Configuration – SMTP + - Configuration - SMTP responses: '200': description: OK @@ -1558,7 +1558,7 @@ paths: /jans-config-api/api/v1/logging: get: tags: - - Configuration – Logging + - Configuration - Logging summary: Returns Jans Authorization Server logging settings. description: Returns Jans Authorization Server logging settings. operationId: get-config-logging @@ -1577,7 +1577,7 @@ paths: - oauth2: [https://jans.io/oauth/config/logging.readonly] put: tags: - - Configuration – Logging + - Configuration - Logging summary: Updates Jans Authorization Server logging settings. description: Updates Jans Authorization Server logging settings. operationId: put-config-logging @@ -1605,7 +1605,7 @@ paths: /jans-config-api/api/v1/config/jwks: get: tags: - - Configuration – JWK - JSON Web Key (JWK) + - Configuration - JWK - JSON Web Key (JWK) summary: Gets list of JSON Web Key (JWK) used by server. description: 'Gets list of JSON Web Key (JWK) used by server. JWK is a JSON data structure that represents a set of public keys as a JSON object [RFC4627].' operationId: get-config-jwks @@ -1624,7 +1624,7 @@ paths: - oauth2: [https://jans.io/oauth/config/jwks.readonly] put: tags: - - Configuration – JWK - JSON Web Key (JWK) + - Configuration - JWK - JSON Web Key (JWK) summary: Puts/replaces JWKS description: Puts/replaces JSON Web Keys (JWKS). operationId: put-config-jwks @@ -1648,7 +1648,7 @@ paths: - oauth2: [https://jans.io/oauth/config/jwks.write] patch: tags: - - Configuration – JWK - JSON Web Key (JWK) + - Configuration - JWK - JSON Web Key (JWK) summary: Patch JWKS description: Patch JSON Web Keys (JWKS). operationId: patch-config-jwks @@ -1677,7 +1677,7 @@ paths: /jans-config-api/api/v1/config/jwks/key: post: tags: - - Configuration – JWK - JSON Web Key (JWK) + - Configuration - JWK - JSON Web Key (JWK) summary: Adds a new key to JSON Web Keys (JWKS) description: Adds a new key to JSON Web Keys (JWKS). operationId: post-config-jwks-key @@ -1709,7 +1709,7 @@ paths: required: true get: tags: - - Configuration – JWK - JSON Web Key (JWK) + - Configuration - JWK - JSON Web Key (JWK) summary: Get a JSON Web Key based on kid description: Get a JSON Web Key based on kid operationId: put-config-jwk-kid @@ -1728,7 +1728,7 @@ paths: - oauth2: [https://jans.io/oauth/config/jwks.readonly] patch: tags: - - Configuration – JWK - JSON Web Key (JWK) + - Configuration - JWK - JSON Web Key (JWK) summary: Patch a specific JSON Web Key based on kid description: Patch a specific JSON Web Key based on kid operationId: patch-config-jwk-kid @@ -1758,7 +1758,7 @@ paths: - oauth2: [https://jans.io/oauth/config/jwks.write] delete: tags: - - Configuration – JWK - JSON Web Key (JWK) + - Configuration - JWK - JSON Web Key (JWK) summary: Delete a JSON Web Key based on kid description: Delete a JSON Web Key based on kid operationId: delete-config-jwk-kid @@ -2401,6 +2401,7 @@ paths: get: tags: - SCIM - User Management + x-cli-plugin: scim summary: Gets list of SCIM users description: Gets list of SCIM users operationId: get-scim-users @@ -2480,6 +2481,7 @@ paths: post: tags: - SCIM - User Management + x-cli-plugin: scim operationId: post-create-user summary: Create a SCIM user. description: Allows creating a User resource via POST (see section 3.3 of RFC 7644) @@ -2549,6 +2551,7 @@ paths: get: tags: - SCIM - User Management + x-cli-plugin: scim operationId: get-user-by-id summary: Retrieves SCIM user by Id. description: Retrieves a User resource by Id (see section 3.4.1 of RFC 7644) @@ -2601,6 +2604,7 @@ paths: put: tags: - SCIM - User Management + x-cli-plugin: scim operationId: put-update-user-by-id summary: Updates an SCIM user. description: "Updates a User resource (see section 3.5.1 of RFC 7644). Update\ @@ -2687,6 +2691,7 @@ paths: delete: tags: - SCIM - User Management + x-cli-plugin: scim operationId: delete-user-by-id summary: Deletes a SCIM user. description: Deletes a user resource @@ -2724,6 +2729,7 @@ paths: patch: tags: - SCIM - User Management + x-cli-plugin: scim operationId: patch-user-by-id summary: Patches SCIM User attributes. description: "Updates one or more attributes of a User resource using a sequence\ @@ -2796,6 +2802,7 @@ paths: post: tags: - SCIM - User Management + x-cli-plugin: scim summary: Search SCIM user. description: Gets list of users operationId: post-search-scim-users @@ -2835,6 +2842,7 @@ paths: - oauth2: [https://jans.io/scim/config.readonly] tags: - SCIM - Config Management + x-cli-plugin: scim responses: '200': description: OK @@ -2856,6 +2864,7 @@ paths: - oauth2: [https://jans.io/scim/config.write] tags: - SCIM - Config Management + x-cli-plugin: scim requestBody: content: application/json-patch+json: @@ -2953,6 +2962,7 @@ paths: get: tags: - Admin UI - Role + x-cli-plugin: admin-ui summary: Get all admin ui roles. description: Get all admin ui roles. operationId: get-adminui-roles @@ -2978,6 +2988,7 @@ paths: post: tags: - Admin UI - Role + x-cli-plugin: admin-ui summary: Add admin ui role. description: Add admin ui role. operationId: add-adminui-role @@ -3010,6 +3021,7 @@ paths: put: tags: - Admin UI - Role + x-cli-plugin: admin-ui summary: Edit admin ui role. description: Edit admin ui role. operationId: edit-adminui-role @@ -3040,6 +3052,7 @@ paths: delete: tags: - Admin UI - Role + x-cli-plugin: admin-ui summary: Delete admin ui role. description: Delete admin ui role. operationId: delete-adminui-role @@ -3071,6 +3084,7 @@ paths: get: tags: - Admin UI - Permission + x-cli-plugin: admin-ui summary: Get admin ui permissions. description: Get admin ui permissions. operationId: get-adminui-permissions @@ -3096,6 +3110,7 @@ paths: post: tags: - Admin UI - Permission + x-cli-plugin: admin-ui summary: Add admin ui permission. description: Add admin ui permission. operationId: add-adminui-permission @@ -3128,6 +3143,7 @@ paths: put: tags: - Admin UI - Permission + x-cli-plugin: admin-ui summary: Edit admin ui permission. description: Edit admin ui permission. operationId: edit-adminui-permission @@ -3158,6 +3174,7 @@ paths: delete: tags: - Admin UI - Permission + x-cli-plugin: admin-ui summary: Delete admin ui permission. description: Delete admin ui permission. operationId: delete-adminui-permission @@ -3189,6 +3206,7 @@ paths: get: tags: - Admin UI - Role-Permissions Mapping + x-cli-plugin: admin-ui summary: Get admin ui role-permissions mapping. description: Get admin ui role-permissions mapping. operationId: get-adminui-role-permissions @@ -3214,6 +3232,7 @@ paths: post: tags: - Admin UI - Role-Permissions Mapping + x-cli-plugin: admin-ui summary: Add role-permissions mapping. description: Add role-permissions mapping. operationId: Add role-permissions mapping. @@ -3244,6 +3263,7 @@ paths: put: tags: - Admin UI - Role-Permissions Mapping + x-cli-plugin: admin-ui summary: Map permissions to role. description: Map permissions to role. operationId: map-permissions-to-role @@ -3274,6 +3294,7 @@ paths: delete: tags: - Admin UI - Role-Permissions Mapping + x-cli-plugin: admin-ui summary: Remove role-permissions mapping. description: Remove role-permissions mapping. operationId: remove-role-permissions-permission @@ -3305,6 +3326,7 @@ paths: get: tags: - Admin UI - License + x-cli-plugin: admin-ui summary: Get admin ui license details. description: Get admin ui license details. operationId: get-adminui-license @@ -3328,6 +3350,7 @@ paths: put: tags: - Admin UI - License + x-cli-plugin: admin-ui summary: Edit admin ui license details. description: Edit admin ui license details. operationId: edit-adminui-license diff --git a/jans-cli/docs/cli/cli-index.md b/jans-cli/docs/cli/cli-index.md index fd0a290937a..87307156798 100644 --- a/jans-cli/docs/cli/cli-index.md +++ b/jans-cli/docs/cli/cli-index.md @@ -9,7 +9,7 @@ It will print all information about how to configure Janssen Server using CLI mo ``` usage: config-cli.py [-h] [--host HOST] [--client-id CLIENT_ID] - [--client_secret CLIENT_SECRET] [-debug] + [--client_secret CLIENT_SECRET] [--plugins PLUGINS] [-debug] [--debug-log-file DEBUG_LOG_FILE] [--operation-id OPERATION_ID] [--url-suffix URL_SUFFIX] [--info {Attribute,CacheConfiguration,CacheConfigurationInMemory,CacheConfigurationMemcached,CacheConfigurationNativePersistence,CacheConfigurationRedis,ConfigurationFido2,ConfigurationJWKJSONWebKeyJWK,ConfigurationLogging,ConfigurationProperties,ConfigurationSMTP,CustomScripts,DatabaseCouchbaseConfiguration,DatabaseLDAPConfiguration,DefaultAuthenticationMethod,OAuthOpenIDConnectClients,OAuthScopes,OAuthUMAResources}] @@ -27,6 +27,7 @@ optional arguments: Jans Config Api Client ID --client_secret CLIENT_SECRET Jans Config Api Client ID secret + --plugins PLUGINS Available plugins separated by comma -debug Run in debug mode --debug-log-file DEBUG_LOG_FILE Log file name when run in debug mode diff --git a/jans-cli/docs/im/im-index.md b/jans-cli/docs/im/im-index.md index 3397f2d4baa..a6bb0ac103b 100644 --- a/jans-cli/docs/im/im-index.md +++ b/jans-cli/docs/im/im-index.md @@ -12,5 +12,20 @@ You will see the main menu as below: ![jans-cli Main Menu](../img/im-main.png) -Using IM is very simple and intuitive. Just make a selection and answer questions. There is a special option to read value for a question from a file using **_file** tag. This option is the most suitable choice to input the large text (e.g., interception script source code or JSON file content). To use this option input **_file /path/of/file** e.g. **_file /home/user/interceptionscript.py**. From the following menu, you can choose an option by selecting its number. Let's start from the beginning. +Using IM is very simple and intuitive. Just make a selection and answer questions. +There is a special option to read value for a question from a file using **_file** tag. +This option is the most suitable choice to input the large text (e.g., interception +script source code or JSON file content). To use this option input +**_file /path/of/file** e.g. **_file /home/user/interceptionscript.py**. +From the following menu, you can choose an option by selecting its number. + + +IM uses auto-filler for user inputs. When you type, it displays available values. +To see all values, press **space** button. For example: + +![jans-cli Auto Fill](../img/im-auto-fill.png) + + + +Let's start from the beginning. diff --git a/jans-cli/docs/img/im-auto-fill.png b/jans-cli/docs/img/im-auto-fill.png new file mode 100644 index 00000000000..e4494933e4f Binary files /dev/null and b/jans-cli/docs/img/im-auto-fill.png differ diff --git a/jans-cli/setup.py b/jans-cli/setup.py index ea3c950f3c6..f769117490c 100644 --- a/jans-cli/setup.py +++ b/jans-cli/setup.py @@ -40,6 +40,7 @@ def find_version(*file_paths): "PyJWT==2.3.0", "certifi", "six", + "prompt_toolkit", "jca-swagger-client @ https://ox.gluu.org/icrby8xcvbcv/cli-swagger/jca_swagger_client.zip", "scim_swagger_client @ https://ox.gluu.org/icrby8xcvbcv/cli-swagger/scim_swagger_client.zip", diff --git a/jans-linux-setup/jans_setup/setup_app/data/package_list.json b/jans-linux-setup/jans_setup/setup_app/data/package_list.json index dc3a517075a..e81c7f905d1 100644 --- a/jans-linux-setup/jans_setup/setup_app/data/package_list.json +++ b/jans-linux-setup/jans_setup/setup_app/data/package_list.json @@ -26,22 +26,22 @@ }, "debian 10": { "optional": "", - "mondatory": "apache2 libapache2-mod-auth-openidc curl wget tar xz-utils unzip rsyslog bzip2", - "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto"} + "mondatory": "apache2 curl wget tar xz-utils unzip rsyslog bzip2", + "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto", "distutils.util": "python3-distutils"} }, "debian 9": { "optional": "", - "mondatory": "apache2 libapache2-mod-auth-openidc curl wget tar xz-utils unzip rsyslog bzip2", - "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto"} + "mondatory": "apache2 curl wget tar xz-utils unzip rsyslog bzip2", + "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto", "distutils.util": "python3-distutils"} }, "ubuntu 18": { "optional": "", - "mondatory": "apache2 libapache2-mod-auth-openidc curl wget xz-utils unzip rsyslog net-tools bzip2", - "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto"} + "mondatory": "apache2 curl wget xz-utils unzip rsyslog net-tools bzip2", + "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto", "distutils.util": "python3-distutils"} }, "ubuntu 20": { "optional": "", - "mondatory": "apache2 libapache2-mod-auth-openidc curl wget xz-utils unzip rsyslog bzip2", - "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto"} + "mondatory": "apache2 curl wget xz-utils unzip rsyslog bzip2", + "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto", "distutils.util": "python3-distutils"} } } diff --git a/jans-linux-setup/jans_setup/setup_app/installers/jans_cli.py b/jans-linux-setup/jans_setup/setup_app/installers/jans_cli.py index 9d8a2e5fad8..89dee4e112c 100644 --- a/jans-linux-setup/jans_setup/setup_app/installers/jans_cli.py +++ b/jans-linux-setup/jans_setup/setup_app/installers/jans_cli.py @@ -89,6 +89,8 @@ def configure(self, options={}): config['DEFAULT']['scim_client_id'] = Config.scim_client_id config['DEFAULT']['scim_client_secret_enc'] = Config.scim_client_encoded_pw + config['DEFAULT']['jca_plugins'] = ','.join(base.current_app.ConfigApiInstaller.get_plugins()) + config.write(self.config_ini_fn.open('w')) self.config_ini_fn.chmod(0o600) 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 81de18220c0..a899425ad78 100644 --- a/jans-linux-setup/jans_setup/setup_app/installers/jetty.py +++ b/jans-linux-setup/jans_setup/setup_app/installers/jetty.py @@ -383,5 +383,23 @@ def add_extra_class(self, class_path, xml_fn=None): f.write(b'\n') f.write(ET.tostring(root, method='xml')) + def get_plugins(self): + plugins = [] + webapps_xml_fn = os.path.join(self.jetty_base, self.service_name, 'webapps', self.service_name+'.xml') + + if os.path.exists(webapps_xml_fn): + + tree = ET.parse(webapps_xml_fn) + root = tree.getroot() + + for app_set in root.findall("Set"): + if app_set.get('name') == 'extraClasspath': + for plugin_path in app_set.text.split(','): + base_name = os.path.basename(plugin_path) + n = base_name.rfind('plugin') + plugins.append(base_name[:n].rstrip('-')) + + return plugins + def installed(self): return os.path.exists(os.path.join(Config.jetty_base, self.service_name, 'start.ini')) or os.path.exists(os.path.join(Config.jetty_base, self.service_name, 'start.d/server.ini'))