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

fix(jans-linux-setup): KC setup - providerId UserStorageProvider #8880

Merged
merged 1 commit into from
Jul 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import socket
import tempfile
import uuid
import json

from setup_app import paths
from setup_app.utils import base
Expand Down Expand Up @@ -194,7 +195,7 @@ def config_api_idp_plugin_config(self):
jans_execution_config_jans_fn = 'jans.execution-config-jans.json'
jans_userstorage_provider_component_fn = 'jans.userstorage-provider-component.json'

for tmp_fn in (jans_api_openid_client_fn, jans_api_realm_fn, jans_api_user_fn, jans_browser_auth_flow_fn, jans_userstorage_provider_component_fn):
for tmp_fn in (jans_api_openid_client_fn, jans_api_realm_fn, jans_api_user_fn, jans_browser_auth_flow_fn):
self.renderTemplateInOut(os.path.join(jans_api_tmp_dir, tmp_fn), jans_api_tmp_dir, jans_api_output_dir, pystring=True)

self.logIt("Starting KC for config api idp plugin configurations")
Expand Down Expand Up @@ -230,6 +231,11 @@ def config_api_idp_plugin_config(self):
# create realm
self.run([kcadm_cmd, 'create', 'realms', '-f', os.path.join(jans_api_output_dir, jans_api_realm_fn),'--config', kc_tmp_config], env=env)

# get realm id
realm_result = self.run([kcadm_cmd, 'get', f'realms/{Config.jans_idp_realm}', '--fields', 'id', '--config', kc_tmp_config], env=env)
realm_data = json.loads(realm_result)
Config.jans_idp_realm_id = realm_data['id']

# disable keycloak required action verify_profile
self.run([kcadm_cmd, 'update', 'authentication/required-actions/VERIFY_PROFILE', '-r', Config.jans_idp_realm,'-f', os.path.join(jans_api_output_dir, 'jans.disable-required-action-verify-profile.json'),'--config', kc_tmp_config], env=env)

Expand Down Expand Up @@ -263,6 +269,7 @@ def config_api_idp_plugin_config(self):
self.run([kcadm_cmd, 'create', f'authentication/executions/{jans_execution_auth_jans_id}/config', '-r', Config.jans_idp_realm, '-f', os.path.join(jans_api_output_dir, jans_execution_config_jans_fn), '--config', kc_tmp_config], env=env)

# create userstorage provider component
self.renderTemplateInOut(os.path.join(jans_api_tmp_dir, jans_userstorage_provider_component_fn), jans_api_tmp_dir, jans_api_output_dir, pystring=True)
self.run([kcadm_cmd, 'create', 'components', '-r', Config.jans_idp_realm, '-f', os.path.join(jans_api_output_dir, jans_userstorage_provider_component_fn), '--config', kc_tmp_config], env=env)

def install_keycloak_scheduler(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name":"jans-user-federation",
"providerId": "kc-jans-user-storage",
"providerType": "org.keycloak.storage.UserStorageProvider",
"parentId": "${jans_idp_realm}",
"parentId": "${jans_idp_realm_id}",
"config": {
"cachePolicy": ["DEFAULT"],
"enabled": ["true"]
Expand Down