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 remove dependency to removed dependency yaml #3422

Merged
merged 1 commit into from
Dec 26, 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
14 changes: 5 additions & 9 deletions jans-linux-setup/jans_setup/setup_app/installers/config_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,14 @@ def create_folders(self):
self.run([paths.cmd_chown, '-R', 'jetty:jetty', os.path.join(Config.jetty_base, self.service_name)])


def read_config_api_swagger(self):
config_api_swagger_yaml_fn = os.path.join(Config.data_dir, 'jans-config-api-swagger.yaml')
yml_str = self.readFile(config_api_swagger_yaml_fn)
yml_str = yml_str.replace('\t', ' ')
cfg_yml = ruamel.yaml.load(yml_str, ruamel.yaml.RoundTripLoader)
return cfg_yml

def get_scope_defs(self):
config_api_rs_protect_fn = os.path.join(Config.data_dir, 'config-api-rs-protect.json')
scopes_def = base.readJsonFile(config_api_rs_protect_fn)
return scopes_def

def generate_configuration(self):

config_api_rs_protect_fn = os.path.join(Config.data_dir, 'config-api-rs-protect.json')
scopes_def = base.readJsonFile(config_api_rs_protect_fn)
scopes_def = self.get_scope_defs()

scope_type = 'oauth'
self.check_clients([('jca_client_id', '1800.')])
Expand Down
15 changes: 8 additions & 7 deletions jans-linux-setup/jans_setup/setup_app/installers/jans_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ def generate_configuration(self):


def get_config_api_scopes(self):
data = base.current_app.ConfigApiInstaller.read_config_api_swagger()
scopes_def = base.current_app.ConfigApiInstaller.get_scope_defs()
scope_list = []

for epath in data['paths']:
for m in data['paths'][epath]:
if 'security' in data['paths'][epath][m]:
scope_items = [item['oauth2'] for item in data['paths'][epath][m]['security']]
for scopes in scope_items:
scope_list += scopes
for resource in scopes_def['resources']:

for condition in resource.get('conditions', []):

for scope in condition.get('scopes', []):
if scope.get('inum') and scope.get('name'):
scope_list.append(scope['name'])

return scope_list

Expand Down