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: client-name, logout, user #3122

Merged
merged 3 commits into from
Nov 30, 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
5 changes: 4 additions & 1 deletion jans-cli-tui/cli_tui/cli/config_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,16 @@ def getCredentials(self):
def get_user_info(self):
user_info = {}
if 'user_data' in config['DEFAULT']:
user_info = jwt.decode(config['DEFAULT']['user_data'],
try:
user_info = jwt.decode(config['DEFAULT']['user_data'],
options={
'verify_signature': False,
'verify_exp': True,
'verify_aud': False
}
)
except:
pass
return user_info


Expand Down
47 changes: 23 additions & 24 deletions jans-cli-tui/cli_tui/plugins/010_oxauth/edit_client_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def __init__(
delete_UMAresource: Callable= None,
)-> Dialog:
"""init for `EditClientDialog`, inherits from two diffrent classes `JansGDialog` and `DialogUtils`

JansGDialog (dialog): This is the main dialog Class Widget for all Jans-cli-tui dialogs except custom dialogs like dialogs with navbar
DialogUtils (methods): Responsable for all `make data from dialog` and `check required fields` in the form for any Edit or Add New

Args:
parent (widget): This is the parent widget for the dialog, to access `Pageup` and `Pagedown`
title (str): The Main dialog title
Expand Down Expand Up @@ -100,7 +100,7 @@ def save(self) -> None:
self.data['attributes']={'parLifetime':self.data['parLifetime']}
self.data['attributes']={'requirePar':self.data['requirePar']}
for list_key in (

'backchannelLogoutUri',
'additionalAudience',
'rptClaimsScripts',
Expand All @@ -113,7 +113,7 @@ def save(self) -> None:
'introspectionScripts',
'ropcScripts',
'consentGatheringScripts',

):
if self.data[list_key]:
self.data['attributes'][list_key] = self.data[list_key].splitlines()
Expand Down Expand Up @@ -190,21 +190,21 @@ def prepare_tabs(self) -> None:
_("Active"),
name='disabled',
checked= not self.data.get('disabled'),
jans_help=self.myparent.get_help_from_schema(schema, 'disabled'),
jans_help=self.myparent.get_help_from_schema(schema, 'disabled'),
style='class:outh-client-checkbox'),

self.myparent.getTitledText(
_("Client Name"),
name='displayName',
value=self.data.get('displayName',''),
jans_help=self.myparent.get_help_from_schema(schema, 'displayName'),
name='clientName',
value=self.data.get('clientName',''),
jans_help=self.myparent.get_help_from_schema(schema, 'clientName'),
style='class:outh-client-text'),

self.myparent.getTitledText(
_("Client Secret"),
name='clientSecret',
value=self.data.get('clientSecret',''),
jans_help=self.myparent.get_help_from_schema(schema, 'clientSecret'),
jans_help=self.myparent.get_help_from_schema(schema, 'clientSecret'),
style='class:outh-client-text'),

self.myparent.getTitledText(
Expand All @@ -213,7 +213,7 @@ def prepare_tabs(self) -> None:
value=self.data.get('description',''),
jans_help=self.myparent.get_help_from_schema(schema, 'description'),
style='class:outh-client-text'),

self.myparent.getTitledRadioButton(
_("Authn Method token endpoint"),
name='tokenEndpointAuthMethod',
Expand All @@ -236,7 +236,7 @@ def prepare_tabs(self) -> None:
value=self.data.get('sectorIdentifierUri',''),
jans_help=self.myparent.get_help_from_schema(schema, 'sectorIdentifierUri'),
style='class:outh-client-text'),

self.myparent.getTitledCheckBoxList(
_("Grant"),
name='grantTypes',
Expand Down Expand Up @@ -268,7 +268,7 @@ def prepare_tabs(self) -> None:
current_value=self.data.get('applicationType'),
jans_help=self.myparent.get_help_from_schema(schema, 'applicationType'),
style='class:outh-client-radiobutton'),

self.myparent.getTitledText(
_("Redirect Uris"),
name='redirectUris',
Expand Down Expand Up @@ -366,7 +366,7 @@ def prepare_tabs(self) -> None:
],width=D(),style='class:outh-client-tabs')

self.tabs['Logout'] = HSplit([

self.myparent.getTitledText(
_("Front channel logout URI"),
name='frontChannelLogoutUri',
Expand All @@ -390,7 +390,7 @@ def prepare_tabs(self) -> None:
'backchannelLogoutUri'),
height=3, style='class:outh-client-text'
),

self.myparent.getTitledCheckBox(
_("Back channel logout session required"),
name='backchannelLogoutSessionRequired',
Expand Down Expand Up @@ -447,7 +447,7 @@ def prepare_tabs(self) -> None:
value=self.data.get('softwareStatement',''),
jans_help=self.myparent.get_help_from_schema(schema, 'softwareStatement'),
style='class:outh-client-text'),

],width=D(),style='class:outh-client-tabs')


Expand All @@ -456,7 +456,7 @@ def prepare_tabs(self) -> None:
VSplit([
self.myparent.getButton(text=_("Get Resources"), name='oauth:Resources:get', jans_help=_("Retreive UMA Resources"), handler=self.oauth_get_uma_resources),
self.myparent.getTitledText(_("Search"), name='oauth:Resources:search', jans_help=_("Press enter to perform search"), accept_handler=self.search_uma_resources,style='class:outh-client-textsearch'),

],
padding=3,
width=D(),
Expand Down Expand Up @@ -630,7 +630,7 @@ def allow_spontaneous_changed(cb):

style='class:outh-client-checkbox'
),

self.myparent.getTitledCheckBox(
_("Persist Authorizations"),
name='persistClientAuthorizations',
Expand Down Expand Up @@ -764,7 +764,7 @@ def allow_spontaneous_changed(cb):
self.myparent.cli_object.get_schema_from_reference('', '#/components/schemas/ClientAttributes'),
'ropcScripts'),
),

self.myparent.getTitledText(_("OAuth Consent"),
name='consentGatheringScripts',
value='\n'.join(self.data.get('attributes', {}).get('consentGatheringScripts',[]) ),
Expand Down Expand Up @@ -859,8 +859,7 @@ def oauth_update_uma_resources (
endpoint_args ='limit:10'
if pattern:
endpoint_args +=',pattern:'+pattern



self.myparent.logger.debug('DATA endpoint_args: '+str(endpoint_args))
try :
rsponse = self.myparent.cli_object.process_command_by_id(
Expand Down Expand Up @@ -890,7 +889,7 @@ def oauth_update_uma_resources (
for d in result:
scopes_of_resource = []
for scope_dn in d.get('scopes', []):

inum = scope_dn.split(',')[0].split('=')[1]
scope_result = {}
try :
Expand All @@ -906,7 +905,7 @@ def oauth_update_uma_resources (
display_name = 'None'
pass
display_name = scope_result.get('displayName') or scope_result.get('inum')

if display_name:
scopes_of_resource.append(display_name)
else:
Expand Down Expand Up @@ -959,13 +958,13 @@ def client_dialog_nav_selection_changed(

def view_uma_resources(self, **params: Any) -> None:
"""This method view the UMA resources in a dialog
"""
"""

selected_line_data = params['data'] ##self.uma_result
title = _("Edit user Data (Clients)")

dialog = ViewUMADialog(self.myparent, title=title, data=selected_line_data, deleted_uma=self.delete_UMAresource)

self.myparent.show_jans_dialog(dialog)

def __pt_container__(self)-> Dialog:
Expand Down
2 changes: 1 addition & 1 deletion jans-cli-tui/cli_tui/plugins/070_users/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def save_user(self, dialog: Dialog) -> None:
_type_: bool value to check the status code response
"""

raw_data = self.make_data_from_dialog(tabs={'user': dialog.edit_user_container})
raw_data = self.make_data_from_dialog(tabs={'user': dialog.edit_user_container.content})

if not (raw_data['userId'].strip() and raw_data['mail'].strip()):
self.app.show_message(_("Please fix!"), _("Username and/or Email is empty"))
Expand Down