Skip to content

Commit

Permalink
fix: jans-linux-setup remove dependency to removed dependency yaml (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar committed Dec 26, 2022
1 parent b235fee commit 8385c96
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
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

0 comments on commit 8385c96

Please sign in to comment.