Skip to content

Commit f374831

Browse files
fix: client-name, logout, user (#3122)
* fix: jans-cli-tui issue logout and exit * fix:jans-cli fix error on saving users (ref: #3120) * fix: jans-cli-tui openid client name (ref: #3119) Co-authored-by: AbdelwahabAdam <abdelwahabosama.1@gmail.com>
1 parent 04fbb98 commit f374831

File tree

3 files changed

+28
-26
lines changed

3 files changed

+28
-26
lines changed

jans-cli-tui/cli_tui/cli/config_cli.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,16 @@ def getCredentials(self):
291291
def get_user_info(self):
292292
user_info = {}
293293
if 'user_data' in config['DEFAULT']:
294-
user_info = jwt.decode(config['DEFAULT']['user_data'],
294+
try:
295+
user_info = jwt.decode(config['DEFAULT']['user_data'],
295296
options={
296297
'verify_signature': False,
297298
'verify_exp': True,
298299
'verify_aud': False
299300
}
300301
)
302+
except:
303+
pass
301304
return user_info
302305

303306

jans-cli-tui/cli_tui/plugins/010_oxauth/edit_client_dialog.py

+23-24
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ def __init__(
4747
delete_UMAresource: Callable= None,
4848
)-> Dialog:
4949
"""init for `EditClientDialog`, inherits from two diffrent classes `JansGDialog` and `DialogUtils`
50-
50+
5151
JansGDialog (dialog): This is the main dialog Class Widget for all Jans-cli-tui dialogs except custom dialogs like dialogs with navbar
5252
DialogUtils (methods): Responsable for all `make data from dialog` and `check required fields` in the form for any Edit or Add New
53-
53+
5454
Args:
5555
parent (widget): This is the parent widget for the dialog, to access `Pageup` and `Pagedown`
5656
title (str): The Main dialog title
@@ -100,7 +100,7 @@ def save(self) -> None:
100100
self.data['attributes']={'parLifetime':self.data['parLifetime']}
101101
self.data['attributes']={'requirePar':self.data['requirePar']}
102102
for list_key in (
103-
103+
104104
'backchannelLogoutUri',
105105
'additionalAudience',
106106
'rptClaimsScripts',
@@ -113,7 +113,7 @@ def save(self) -> None:
113113
'introspectionScripts',
114114
'ropcScripts',
115115
'consentGatheringScripts',
116-
116+
117117
):
118118
if self.data[list_key]:
119119
self.data['attributes'][list_key] = self.data[list_key].splitlines()
@@ -190,21 +190,21 @@ def prepare_tabs(self) -> None:
190190
_("Active"),
191191
name='disabled',
192192
checked= not self.data.get('disabled'),
193-
jans_help=self.myparent.get_help_from_schema(schema, 'disabled'),
193+
jans_help=self.myparent.get_help_from_schema(schema, 'disabled'),
194194
style='class:outh-client-checkbox'),
195195

196196
self.myparent.getTitledText(
197197
_("Client Name"),
198-
name='displayName',
199-
value=self.data.get('displayName',''),
200-
jans_help=self.myparent.get_help_from_schema(schema, 'displayName'),
198+
name='clientName',
199+
value=self.data.get('clientName',''),
200+
jans_help=self.myparent.get_help_from_schema(schema, 'clientName'),
201201
style='class:outh-client-text'),
202202

203203
self.myparent.getTitledText(
204204
_("Client Secret"),
205205
name='clientSecret',
206206
value=self.data.get('clientSecret',''),
207-
jans_help=self.myparent.get_help_from_schema(schema, 'clientSecret'),
207+
jans_help=self.myparent.get_help_from_schema(schema, 'clientSecret'),
208208
style='class:outh-client-text'),
209209

210210
self.myparent.getTitledText(
@@ -213,7 +213,7 @@ def prepare_tabs(self) -> None:
213213
value=self.data.get('description',''),
214214
jans_help=self.myparent.get_help_from_schema(schema, 'description'),
215215
style='class:outh-client-text'),
216-
216+
217217
self.myparent.getTitledRadioButton(
218218
_("Authn Method token endpoint"),
219219
name='tokenEndpointAuthMethod',
@@ -236,7 +236,7 @@ def prepare_tabs(self) -> None:
236236
value=self.data.get('sectorIdentifierUri',''),
237237
jans_help=self.myparent.get_help_from_schema(schema, 'sectorIdentifierUri'),
238238
style='class:outh-client-text'),
239-
239+
240240
self.myparent.getTitledCheckBoxList(
241241
_("Grant"),
242242
name='grantTypes',
@@ -268,7 +268,7 @@ def prepare_tabs(self) -> None:
268268
current_value=self.data.get('applicationType'),
269269
jans_help=self.myparent.get_help_from_schema(schema, 'applicationType'),
270270
style='class:outh-client-radiobutton'),
271-
271+
272272
self.myparent.getTitledText(
273273
_("Redirect Uris"),
274274
name='redirectUris',
@@ -366,7 +366,7 @@ def prepare_tabs(self) -> None:
366366
],width=D(),style='class:outh-client-tabs')
367367

368368
self.tabs['Logout'] = HSplit([
369-
369+
370370
self.myparent.getTitledText(
371371
_("Front channel logout URI"),
372372
name='frontChannelLogoutUri',
@@ -390,7 +390,7 @@ def prepare_tabs(self) -> None:
390390
'backchannelLogoutUri'),
391391
height=3, style='class:outh-client-text'
392392
),
393-
393+
394394
self.myparent.getTitledCheckBox(
395395
_("Back channel logout session required"),
396396
name='backchannelLogoutSessionRequired',
@@ -447,7 +447,7 @@ def prepare_tabs(self) -> None:
447447
value=self.data.get('softwareStatement',''),
448448
jans_help=self.myparent.get_help_from_schema(schema, 'softwareStatement'),
449449
style='class:outh-client-text'),
450-
450+
451451
],width=D(),style='class:outh-client-tabs')
452452

453453

@@ -456,7 +456,7 @@ def prepare_tabs(self) -> None:
456456
VSplit([
457457
self.myparent.getButton(text=_("Get Resources"), name='oauth:Resources:get', jans_help=_("Retreive UMA Resources"), handler=self.oauth_get_uma_resources),
458458
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'),
459-
459+
460460
],
461461
padding=3,
462462
width=D(),
@@ -630,7 +630,7 @@ def allow_spontaneous_changed(cb):
630630

631631
style='class:outh-client-checkbox'
632632
),
633-
633+
634634
self.myparent.getTitledCheckBox(
635635
_("Persist Authorizations"),
636636
name='persistClientAuthorizations',
@@ -764,7 +764,7 @@ def allow_spontaneous_changed(cb):
764764
self.myparent.cli_object.get_schema_from_reference('', '#/components/schemas/ClientAttributes'),
765765
'ropcScripts'),
766766
),
767-
767+
768768
self.myparent.getTitledText(_("OAuth Consent"),
769769
name='consentGatheringScripts',
770770
value='\n'.join(self.data.get('attributes', {}).get('consentGatheringScripts',[]) ),
@@ -859,8 +859,7 @@ def oauth_update_uma_resources (
859859
endpoint_args ='limit:10'
860860
if pattern:
861861
endpoint_args +=',pattern:'+pattern
862-
863-
862+
864863
self.myparent.logger.debug('DATA endpoint_args: '+str(endpoint_args))
865864
try :
866865
rsponse = self.myparent.cli_object.process_command_by_id(
@@ -890,7 +889,7 @@ def oauth_update_uma_resources (
890889
for d in result:
891890
scopes_of_resource = []
892891
for scope_dn in d.get('scopes', []):
893-
892+
894893
inum = scope_dn.split(',')[0].split('=')[1]
895894
scope_result = {}
896895
try :
@@ -906,7 +905,7 @@ def oauth_update_uma_resources (
906905
display_name = 'None'
907906
pass
908907
display_name = scope_result.get('displayName') or scope_result.get('inum')
909-
908+
910909
if display_name:
911910
scopes_of_resource.append(display_name)
912911
else:
@@ -959,13 +958,13 @@ def client_dialog_nav_selection_changed(
959958

960959
def view_uma_resources(self, **params: Any) -> None:
961960
"""This method view the UMA resources in a dialog
962-
"""
961+
"""
963962

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

967966
dialog = ViewUMADialog(self.myparent, title=title, data=selected_line_data, deleted_uma=self.delete_UMAresource)
968-
967+
969968
self.myparent.show_jans_dialog(dialog)
970969

971970
def __pt_container__(self)-> Dialog:

jans-cli-tui/cli_tui/plugins/070_users/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def save_user(self, dialog: Dialog) -> None:
180180
_type_: bool value to check the status code response
181181
"""
182182

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

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

0 commit comments

Comments
 (0)