ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilOpenIdConnectSettingsGUI Class Reference
+ Collaboration diagram for ilOpenIdConnectSettingsGUI:

Public Member Functions

 __construct (int $a_ref_id)
 
 executeCommand ()
 

Private Member Functions

 checkAccess (string $a_permission)
 
 checkAccessBool (string $a_permission)
 
 settings (?ilPropertyFormGUI $form=null)
 
 initSettingsForm ()
 
 saveSettings ()
 
 saveImageFromHttpRequest ()
 
 prepareRoleSelection (bool $a_with_select_option=true)
 
 profile ()
 
 scopes ()
 
 discoverScopesFromServer ()
 
 buildScopeSelection (array $ui_container)
 
 saveScopes ()
 
 validateDiscoveryUrl (int $type, ?string $url, array $scopes)
 
 saveProfileMapping ()
 
 updateProfileMappingFieldValue (string $field)
 
 roles (?ilPropertyFormGUI $form=null)
 
 initRolesForm ()
 
 saveRoles ()
 
 setSubTabs (string $active_tab)
 
 chooseMapping ()
 
 showInfoMessage ()
 
 initAttributeMapping ()
 
 buildUserMappingInputFormUDF ($definition, array $ui_container)
 
 buildUserMappingInputForUserData (string $lang, string $mapping, array $ui_container)
 
 initUserDefinedFields ()
 
 userMapping ()
 
 redirectToSettingsScreenIfNoURLIsConfigured ()
 
 saniziteArrayElementsTrafo ()
 
 trimIfStringTrafo ()
 

Private Attributes

const STAB_SETTINGS = 'settings'
 
const STAB_SCOPES = 'scopes'
 
const STAB_PROFILE = 'profile'
 
const STAB_ROLES = 'roles'
 
const VALUE_STRING = '_value'
 
const UPDATE_STRING = '_update'
 
const UDF_STRING = 'udf_'
 
const DEFAULT_CMD = 'settings'
 
const DEFAULT_VALUES = 1
 
const SAVED_VALUES = 2
 
const POST_VALUE = 'Mode'
 
const VIEW_TAB_PRE_FILED = 1
 
const VIEW_TAB_EFFECTIVE_MAPPING = 2
 
const URL_VALIDATION_PROVIDER_STRING = '/.well-known/openid-configuration'
 
const EFFECTIVE_ATTRIBUTE_MAPPING_TAB = 2
 
int $ref_id
 
 $body
 
readonly ilOpenIdConnectSettings $settings
 
readonly ilLanguage $lng
 
readonly ilCtrl $ctrl
 
readonly ilLogger $logger
 
readonly ilAccessHandler $access
 
readonly ilRbacReview $review
 
readonly ilErrorHandling $error
 
readonly ilGlobalTemplateInterface $mainTemplate
 
readonly ilTabsGUI $tabs
 
readonly FileUpload $upload
 
ilToolbarGUI $toolbar
 
ilUserDefinedFields $udf = null
 
ilGlobalTemplateInterface $tpl
 
int $mapping_template = self::VIEW_TAB_EFFECTIVE_MAPPING
 
ServerRequestInterface $request
 
ilOpenIdAttributeMappingTemplate $attribute_mapping_template
 
Factory $ui
 
Renderer $renderer
 
Services $http
 
Factory $factory
 
ILIAS Refinery Factory $refinery
 
string $failed_validation_messages = ''
 

Detailed Description

Definition at line 29 of file class.ilOpenIdConnectSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilOpenIdConnectSettingsGUI::__construct ( int  $a_ref_id)

Definition at line 73 of file class.ilOpenIdConnectSettingsGUI.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), factory(), ilOpenIdConnectSettings\getInstance(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), mainTemplate(), ILIAS\Repository\refinery(), renderer(), settings(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\upload().

74  {
75  global $DIC;
76 
77  $this->ref_id = $a_ref_id;
78 
79  $this->lng = $DIC->language();
80  $this->lng->loadLanguageModule('auth');
81 
82  $this->mainTemplate = $DIC->ui()->mainTemplate();
83  $this->tabs = $DIC->tabs();
84  $this->ctrl = $DIC->ctrl();
85  $this->logger = $DIC->logger()->auth();
86  $this->access = $DIC->access();
87  $this->review = $DIC->rbac()->review();
88  $this->error = $DIC['ilErr'];
89  $this->upload = $DIC->upload();
90  $this->body = $DIC->http()->request()->getParsedBody();
92  $http_wrapper = $DIC->http()->wrapper();
93  $this->toolbar = $DIC->toolbar();
94  $refinery = $DIC->refinery();
95  $this->tpl = $DIC->ui()->mainTemplate();
96  $this->http = $DIC->http();
97  $this->ui = $DIC->ui()->factory();
98  $this->renderer = $DIC->ui()->renderer();
99  $this->refinery = $DIC->refinery();
100  $this->factory = $DIC->ui()->factory();
101  $this->request = $DIC->http()->request();
102  $this->attribute_mapping_template = new ilOpenIdAttributeMappingTemplate();
103 
104  if ($http_wrapper->query()->has(self::POST_VALUE) && $http_wrapper->query()->retrieve(
105  self::POST_VALUE,
106  $refinery->kindlyTo()->int()
107  )) {
108  $this->mapping_template = $http_wrapper->query()->retrieve(self::POST_VALUE, $refinery->kindlyTo()->int());
109  }
110  }
factory()
renderer()
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26
settings(?ilPropertyFormGUI $form=null)
mainTemplate()
+ Here is the call graph for this function:

Member Function Documentation

◆ buildScopeSelection()

ilOpenIdConnectSettingsGUI::buildScopeSelection ( array  $ui_container)
private
Parameters
list<FormInput>$ui_container
Returns
list<FormInput>

Definition at line 490 of file class.ilOpenIdConnectSettingsGUI.php.

References ilOpenIdConnectSettings\DEFAULT_SCOPE, ILIAS\Repository\lng(), settings(), trimIfStringTrafo(), ILIAS\Repository\ui(), ilOpenIdConnectSettings\URL_VALIDATION_CUSTOM, ilOpenIdConnectSettings\URL_VALIDATION_NONE, ilOpenIdConnectSettings\URL_VALIDATION_PROVIDER, ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by scopes().

490  : array
491  {
492  $disabled_input = $this->ui
493  ->input()
494  ->field()
495  ->text($this->lng->txt('auth_oidc_settings_default_scopes'), '')
498  ->withDedicatedName('default_scope')
499  ->withDisabled(true);
500 
501  $scopeValues = $this->settings->getAdditionalScopes();
502 
503  $tag_input = $this->ui
504  ->input()
505  ->field()
506  ->tag(
507  $this->lng->txt('auth_oidc_settings_additional_scopes'),
508  $scopeValues
509  )->withValue($scopeValues)
510  ->withDedicatedName('custom_scope')
511  ->withByline($this->lng->txt('auth_oidc_settings_additional_scopes_info'));
512  $group1 = $this->ui->input()->field()->group(
513  [],
514  $this->lng->txt('auth_oidc_settings_validate_scope_default')
515  );
516  $group2 = $this->ui->input()->field()->group(
517  [
518  $this->lng->txt('auth_oidc_settings_discovery_url') => $this->ui
519  ->input()
520  ->field()
521  ->text(
522  $this->lng->txt('auth_oidc_settings_discovery_url')
523  )
525  ->withValue(
526  $this->settings->getCustomDiscoveryUrl() ?? ''
527  )
528  ],
529  $this->lng->txt('auth_oidc_settings_validate_scope_custom')
530  );
531  $group3 = $this->ui->input()->field()->group(
532  [],
533  $this->lng->txt('auth_oidc_settings_validate_scope_none')
534  );
535  $url_validation = $this->ui->input()->field()->switchableGroup(
536  [
540  ],
541  $this->lng->txt('auth_oidc_settings_validate_scopes')
542  )->withDedicatedName('validate_scopes')->withValue($this->settings->getValidateScopes());
543  $group = $this->ui->input()->field()->group(
544  [$disabled_input, $tag_input, $url_validation]
545  );
546  $ui_container[] = $group;
547 
548  return $ui_container;
549  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildUserMappingInputFormUDF()

ilOpenIdConnectSettingsGUI::buildUserMappingInputFormUDF (   $definition,
array  $ui_container 
)
private
Parameters
array{"field_id"int, "field_name": string} $definition
list<FormInput>$ui_container
Returns
list<FormInput>

Definition at line 947 of file class.ilOpenIdConnectSettingsGUI.php.

References ILIAS\Repository\lng(), settings(), trimIfStringTrafo(), ILIAS\Repository\ui(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by initAttributeMapping().

947  : array
948  {
949  $value = $this->settings->getProfileMappingFieldValue(self::UDF_STRING . $definition['field_id']);
950  $update = $this->settings->getProfileMappingFieldUpdate(self::UDF_STRING . $definition['field_id']);
951 
952  $text_input = $this->ui
953  ->input()
954  ->field()
955  ->text($definition['field_name'], '')
956  ->withAdditionalTransformation($this->trimIfStringTrafo())
957  ->withValue($value)
958  ->withDedicatedName(self::UDF_STRING . $definition['field_id'] . self::VALUE_STRING);
959  $checkbox_input = $this->ui
960  ->input()
961  ->field()->checkbox('', $this->lng->txt('auth_oidc_update_field_info'))
962  ->withValue($update)
963  ->withDedicatedName(
964  self::UDF_STRING . $definition['field_id'] . self::UPDATE_STRING
965  );
966  $group = $this->ui->input()->field()->group(
967  [$text_input, $checkbox_input]
968  );
969  $ui_container[] = $group;
970 
971  return $ui_container;
972  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildUserMappingInputForUserData()

ilOpenIdConnectSettingsGUI::buildUserMappingInputForUserData ( string  $lang,
string  $mapping,
array  $ui_container 
)
private
Parameters
list<FormInput>$ui_container
Returns
list<FormInput>

Definition at line 978 of file class.ilOpenIdConnectSettingsGUI.php.

References ILIAS\Repository\lng(), settings(), trimIfStringTrafo(), ILIAS\Repository\ui(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by initAttributeMapping().

978  : array
979  {
980  $value = $this->settings->getProfileMappingFieldValue($mapping);
981  $update = $this->settings->getProfileMappingFieldUpdate($mapping);
982 
983  $text_input = $this->ui
984  ->input()
985  ->field()
986  ->text($lang, '')
987  ->withAdditionalTransformation($this->trimIfStringTrafo())
988  ->withValue($value)
989  ->withDedicatedName($mapping . self::VALUE_STRING);
990  $checkbox_input = $this->ui
991  ->input()
992  ->field()
993  ->checkbox('', $this->lng->txt('auth_oidc_update_field_info'))
994  ->withValue($update)
995  ->withDedicatedName($mapping . self::UPDATE_STRING);
996  $group = $this->ui->input()->field()->group(
997  [
998  $text_input,
999  $checkbox_input
1000  ]
1001  );
1002  $ui_container[] = $group;
1003 
1004  return $ui_container;
1005  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
$lang
Definition: xapiexit.php:25
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccess()

ilOpenIdConnectSettingsGUI::checkAccess ( string  $a_permission)
private

Definition at line 112 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccessBool(), and ILIAS\Repository\lng().

Referenced by executeCommand(), profile(), roles(), saveRoles(), saveScopes(), saveSettings(), scopes(), and settings().

112  : void
113  {
114  if (!$this->checkAccessBool($a_permission)) {
115  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->WARNING);
116  }
117  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessBool()

ilOpenIdConnectSettingsGUI::checkAccessBool ( string  $a_permission)
private

Definition at line 119 of file class.ilOpenIdConnectSettingsGUI.php.

References ILIAS\Repository\access().

Referenced by checkAccess(), initRolesForm(), initSettingsForm(), and saveProfileMapping().

119  : bool
120  {
121  return $this->access->checkAccess($a_permission, '', $this->ref_id);
122  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chooseMapping()

ilOpenIdConnectSettingsGUI::chooseMapping ( )
private

Definition at line 852 of file class.ilOpenIdConnectSettingsGUI.php.

References initAttributeMapping(), setSubTabs(), showInfoMessage(), and userMapping().

Referenced by profile().

852  : void
853  {
854  $this->showInfoMessage();
855 
856  $this->setSubTabs(self::STAB_PROFILE);
857 
858  if ((int) $this->mapping_template === self::VIEW_TAB_EFFECTIVE_MAPPING) {
859  $this->userMapping();
860  return;
861  }
862 
863  $this->initAttributeMapping();
864  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ discoverScopesFromServer()

ilOpenIdConnectSettingsGUI::discoverScopesFromServer ( )
private

Definition at line 466 of file class.ilOpenIdConnectSettingsGUI.php.

References $url, ILIAS\Repository\lng(), mainTemplate(), scopes(), settings(), ilOpenIdConnectSettings\URL_VALIDATION_CUSTOM, and ilOpenIdConnectSettings\URL_VALIDATION_PROVIDER.

466  : void
467  {
468  $url = '';
469  $type = $this->settings->getValidateScopes();
471  $url = $this->settings->getProvider() . self::URL_VALIDATION_PROVIDER_STRING;
473  $url = $this->settings->getCustomDiscoveryUrl();
474  }
475 
476  if ($url !== '') {
477  $found_scopes = $this->settings->getSupportedScopesFromUrl($url);
478  if ($found_scopes === true) {
479  $this->mainTemplate->setOnScreenMessage('success', $this->lng->txt('auth_oidc_discover_scopes_info'));
480  }
481  }
482 
483  $this->scopes();
484  }
$url
Definition: shib_logout.php:68
settings(?ilPropertyFormGUI $form=null)
mainTemplate()
+ Here is the call graph for this function:

◆ executeCommand()

ilOpenIdConnectSettingsGUI::executeCommand ( )

Definition at line 124 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess(), and ILIAS\Repository\ctrl().

124  : void
125  {
126  $this->checkAccess('read');
127 
128  switch ($this->ctrl->getNextClass()) {
129  default:
130  $cmd = $this->ctrl->getCmd(self::DEFAULT_CMD);
131  $this->$cmd();
132  break;
133  }
134  }
+ Here is the call graph for this function:

◆ initAttributeMapping()

ilOpenIdConnectSettingsGUI::initAttributeMapping ( )
private

Definition at line 890 of file class.ilOpenIdConnectSettingsGUI.php.

References $lang, buildUserMappingInputFormUDF(), buildUserMappingInputForUserData(), ILIAS\Repository\ctrl(), initUserDefinedFields(), saniziteArrayElementsTrafo(), settings(), ILIAS\Repository\ui(), userMapping(), and ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation().

Referenced by chooseMapping().

890  : void
891  {
892  $mapping = $this->attribute_mapping_template->getMappingRulesByAdditionalScopes(
893  $this->settings->getAdditionalScopes()
894  );
895 
896  if (count($mapping) > 0) {
897  $this->settings->clearProfileMaps();
898  }
899 
900  foreach ($mapping as $field => $item) {
901  $this->settings->setProfileMappingFieldValue(
902  $field,
903  $item
904  );
905  }
906 
907  $this->userMapping();
908  }
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRolesForm()

ilOpenIdConnectSettingsGUI::initRolesForm ( )
private

Definition at line 737 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccessBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), prepareRoleSelection(), and settings().

Referenced by roles(), and saveRoles().

738  {
739  $form = new ilPropertyFormGUI();
740  $form->setTitle($this->lng->txt('auth_oidc_role_mapping_table'));
741  $form->setFormAction($this->ctrl->getFormAction($this, self::STAB_ROLES));
742 
743  foreach ($this->prepareRoleSelection(false) as $role_id => $role_title) {
744  $role_map = new ilTextInputGUI(
745  $role_title,
746  'role_map_' . $role_id
747  );
748  $role_map->setInfo($this->lng->txt('auth_oidc_role_info'));
749  $role_map->setValue($this->settings->getRoleMappingValueForId((int) $role_id));
750  $form->addItem($role_map);
751 
752  $update = new ilCheckboxInputGUI(
753  '',
754  'role_map_update_' . $role_id
755  );
756  $update->setOptionTitle($this->lng->txt('auth_oidc_update_role_info'));
757  $update->setValue('1');
758  $update->setChecked(!$this->settings->getRoleMappingUpdateForId((int) $role_id));
759  $form->addItem($update);
760  }
761 
762  if ($this->checkAccessBool('write')) {
763  $form->addCommandButton('saveRoles', $this->lng->txt('save'));
764  }
765 
766  return $form;
767  }
prepareRoleSelection(bool $a_with_select_option=true)
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSettingsForm()

ilOpenIdConnectSettingsGUI::initSettingsForm ( )
private

Definition at line 149 of file class.ilOpenIdConnectSettingsGUI.php.

References $client_id, $provider, checkAccessBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilOpenIdConnectSettings\LOGIN_ELEMENT_TYPE_IMG, ilOpenIdConnectSettings\LOGIN_ELEMENT_TYPE_TXT, ilOpenIdConnectSettings\LOGIN_ENFORCE, ilOpenIdConnectSettings\LOGIN_STANDARD, ilOpenIdConnectSettings\LOGOUT_SCOPE_GLOBAL, ilOpenIdConnectSettings\LOGOUT_SCOPE_LOCAL, prepareRoleSelection(), ilFormPropertyGUI\setRequired(), ilPasswordInputGUI\setSkipSyntaxCheck(), settings(), ilRadioGroupInputGUI\setValue(), ilNumberInputGUI\setValue(), and ilSelectInputGUI\setValue().

Referenced by saveSettings(), and settings().

150  {
151  $form = new ilPropertyFormGUI();
152  $form->setTitle($this->lng->txt('auth_oidc_settings_title'));
153  $form->setFormAction($this->ctrl->getFormAction($this));
154 
155  $activation = new ilCheckboxInputGUI(
156  $this->lng->txt('auth_oidc_settings_activation'),
157  'activation'
158  );
159  $activation->setChecked($this->settings->getActive());
160  $form->addItem($activation);
161 
163  $this->lng->txt('auth_oidc_settings_provider'),
164  'provider'
165  );
166  $provider->setRequired(true);
167  $provider->setValue($this->settings->getProvider());
168  $form->addItem($provider);
169 
171  $this->lng->txt('auth_oidc_settings_client_id'),
172  'client_id'
173  );
174  $client_id->setRequired(true);
175  $client_id->setValue($this->settings->getClientId());
176  $form->addItem($client_id);
177 
178  $secret = new ilPasswordInputGUI(
179  $this->lng->txt('auth_oidc_settings_secret'),
180  'secret'
181  );
182  $secret->setSkipSyntaxCheck(true);
183  $secret->setRetype(false);
184  $secret->setRequired(false);
185  if ($this->settings->getSecret() !== '') {
186  $secret->setValue('******');
187  }
188  $form->addItem($secret);
189 
190  $login_element = new ilRadioGroupInputGUI(
191  $this->lng->txt('auth_oidc_settings_le'),
192  'le'
193  );
194  $login_element->setRequired(true);
195  $login_element->setValue((string) $this->settings->getLoginElementType());
196  $form->addItem($login_element);
197 
198  $text_option = new ilRadioOption(
199  $this->lng->txt('auth_oidc_settings_txt'),
201  );
202  $login_element->addOption($text_option);
203 
204  $text = new ilTextInputGUI(
205  '',
206  'le_text'
207  );
208  $text->setValue($this->settings->getLoginElemenText());
209  $text->setMaxLength(120);
210  $text->setInfo($this->lng->txt('auth_oidc_settings_txt_val_info'));
211  $text_option->addSubItem($text);
212 
213  $img_option = new ilRadioOption(
214  $this->lng->txt('auth_oidc_settings_img'),
216  );
217  $login_element->addOption($img_option);
218 
219  $image = new ilImageFileInputGUI(
220  '',
221  'le_img'
222  );
223  $image->setAllowDeletion(false);
224 
225  if ($this->settings->hasImageFile()) {
226  $image->setImage($this->settings->getImageFilePath());
227  }
228  $image->setInfo($this->lng->txt('auth_oidc_settings_img_file_info'));
229  $img_option->addSubItem($image);
230 
231  $login_options = new ilRadioGroupInputGUI(
232  $this->lng->txt('auth_oidc_settings_login_options'),
233  'login_prompt'
234  );
235  $login_options->setValue((string) $this->settings->getLoginPromptType());
236 
237  $enforce = new ilRadioOption(
238  $this->lng->txt('auth_oidc_settings_login_option_enforce'),
240  );
241  $enforce->setInfo($this->lng->txt('auth_oidc_settings_login_option_enforce_info'));
242  $login_options->addOption($enforce);
243 
244  $default = new ilRadioOption(
245  $this->lng->txt('auth_oidc_settings_login_option_default'),
247  );
248  $default->setInfo($this->lng->txt('auth_oidc_settings_login_option_default_info'));
249  $login_options->addOption($default);
250 
251  $form->addItem($login_options);
252 
253  $logout_scope = new ilRadioGroupInputGUI(
254  $this->lng->txt('auth_oidc_settings_logout_scope'),
255  'logout_scope'
256  );
257  $logout_scope->setValue((string) $this->settings->getLogoutScope());
258 
259  $global_scope = new ilRadioOption(
260  $this->lng->txt('auth_oidc_settings_logout_scope_global'),
262  );
263  $global_scope->setInfo($this->lng->txt('auth_oidc_settings_logout_scope_global_info'));
264  $logout_scope->addOption($global_scope);
265 
266  $ilias_scope = new ilRadioOption(
267  $this->lng->txt('auth_oidc_settings_logout_scope_local'),
269  );
270  $ilias_scope->setInfo($this->lng->txt('auth_oidc_settings_logout_scope_local_info'));
271  $logout_scope->addOption($ilias_scope);
272 
273  $form->addItem($logout_scope);
274 
275  $use_custom_session = new ilCheckboxInputGUI(
276  $this->lng->txt('auth_oidc_settings_custom_session_duration_type'),
277  'custom_session'
278  );
279  $use_custom_session->setOptionTitle(
280  $this->lng->txt('auth_oidc_settings_custom_session_duration_option')
281  );
282  $use_custom_session->setChecked($this->settings->isCustomSession());
283  $form->addItem($use_custom_session);
284 
285  $session = new ilNumberInputGUI(
286  $this->lng->txt('auth_oidc_settings_session_duration'),
287  'session_duration'
288  );
289  $session->setValue((string) $this->settings->getSessionDuration());
290  $session->setSuffix($this->lng->txt('minutes'));
291  $session->setMinValue(5);
292  $session->setMaxValue(1440);
293  $session->setRequired(true);
294  $use_custom_session->addSubItem($session);
295 
296  if ($this->checkAccessBool('write')) {
297  $form->addCommandButton('saveSettings', $this->lng->txt('save'));
298  }
299 
300  $user_sync = new ilFormSectionHeaderGUI();
301  $user_sync->setTitle($this->lng->txt('auth_oidc_settings_section_user_sync'));
302  $form->addItem($user_sync);
303 
304  $sync = new ilCheckboxInputGUI(
305  $this->lng->txt('auth_oidc_settings_user_sync'),
306  'sync'
307  );
308  $sync->setChecked($this->settings->isSyncAllowed());
309  $sync->setInfo($this->lng->txt('auth_oidc_settings_user_sync_info'));
310  $sync->setValue('1');
311  $form->addItem($sync);
312 
313  $roles = new ilSelectInputGUI(
314  $this->lng->txt('auth_oidc_settings_default_role'),
315  'role'
316  );
317  $roles->setValue((string) $this->settings->getRole());
318  $roles->setInfo($this->lng->txt('auth_oidc_settings_default_role_info'));
319  $roles->setOptions($this->prepareRoleSelection());
320  $roles->setRequired(true);
321  $sync->addSubItem($roles);
322 
323  $user_attr = new ilTextInputGUI(
324  $this->lng->txt('auth_oidc_settings_user_attr'),
325  'username'
326  );
327  $user_attr->setValue($this->settings->getUidField());
328  $user_attr->setRequired(true);
329  $form->addItem($user_attr);
330 
331  return $form;
332  }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
prepareRoleSelection(bool $a_with_select_option=true)
$provider
Definition: ltitoken.php:80
This class represents a property in a property form.
setValue($a_value)
Set Value.
This class represents a number property in a property form.
setValue(?string $a_value)
This class represents a password property in a property form.
setRequired(bool $a_required)
This class represents an image file property in a property form.
$client_id
Definition: ltiauth.php:66
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initUserDefinedFields()

ilOpenIdConnectSettingsGUI::initUserDefinedFields ( )
private

Definition at line 1007 of file class.ilOpenIdConnectSettingsGUI.php.

References ilUserDefinedFields\_getInstance(), and null.

Referenced by initAttributeMapping().

1007  : void
1008  {
1009  if ($this->udf === null) {
1010  $this->udf = ilUserDefinedFields::_getInstance();
1011  }
1012  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareRoleSelection()

ilOpenIdConnectSettingsGUI::prepareRoleSelection ( bool  $a_with_select_option = true)
private
Returns
array<string, string>

Definition at line 400 of file class.ilOpenIdConnectSettingsGUI.php.

References ilObject\_lookupTitle(), ilUtil\_sortIds(), ANONYMOUS_ROLE_ID, and ILIAS\Repository\lng().

Referenced by initRolesForm(), initSettingsForm(), and saveRoles().

400  : array
401  {
402  $global_roles = ilUtil::_sortIds(
403  $this->review->getGlobalRoles(),
404  'object_data',
405  'title',
406  'obj_id'
407  );
408 
409  $select = [];
410  if ($a_with_select_option) {
411  $select[0] = $this->lng->txt('links_select_one');
412  }
413  foreach ($global_roles as $role_id) {
414  if ($role_id === ANONYMOUS_ROLE_ID) {
415  continue;
416  }
417  $select[(string) $role_id] = ilObject::_lookupTitle((int) $role_id);
418  }
419 
420  return $select;
421  }
static _lookupTitle(int $obj_id)
static _sortIds(array $a_ids, string $a_table, string $a_field, string $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),&#39;usr_data&#39;,&#39;lastname&#39;,&#39;usr_id&#39;) => sorts by lastname.
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ profile()

ilOpenIdConnectSettingsGUI::profile ( )
private

Definition at line 423 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess(), chooseMapping(), redirectToSettingsScreenIfNoURLIsConfigured(), and userMapping().

Referenced by saveProfileMapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToSettingsScreenIfNoURLIsConfigured()

ilOpenIdConnectSettingsGUI::redirectToSettingsScreenIfNoURLIsConfigured ( )
private

Definition at line 1046 of file class.ilOpenIdConnectSettingsGUI.php.

References $url, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and settings().

Referenced by profile(), roles(), and scopes().

1046  : void
1047  {
1048  $url = $this->settings->getProvider();
1049  if ($url === '') {
1050  $this->tpl->setOnScreenMessage(
1051  $this->tpl::MESSAGE_TYPE_FAILURE,
1052  $this->lng->txt('permission_denied'),
1053  true
1054  );
1055  $this->ctrl->redirect($this, 'settings');
1056  }
1057  }
$url
Definition: shib_logout.php:68
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ roles()

ilOpenIdConnectSettingsGUI::roles ( ?ilPropertyFormGUI  $form = null)
private

Definition at line 722 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess(), initRolesForm(), mainTemplate(), redirectToSettingsScreenIfNoURLIsConfigured(), and setSubTabs().

Referenced by saveRoles().

722  : void
723  {
724  $this->checkAccess('read');
725 
727 
728  $this->setSubTabs(self::STAB_ROLES);
729 
730  if (!$form instanceof ilPropertyFormGUI) {
731  $form = $this->initRolesForm();
732  }
733 
734  $this->mainTemplate->setContent($form->getHTML());
735  }
mainTemplate()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saniziteArrayElementsTrafo()

ilOpenIdConnectSettingsGUI::saniziteArrayElementsTrafo ( )
private

Definition at line 1059 of file class.ilOpenIdConnectSettingsGUI.php.

References ILIAS\Repository\refinery(), and ilArrayUtil\stripSlashesRecursive().

Referenced by initAttributeMapping(), and scopes().

1059  : \ILIAS\Refinery\Transformation
1060  {
1061  return $this->refinery->custom()->transformation(static function (array $values): array {
1062  return ilArrayUtil::stripSlashesRecursive($values);
1063  });
1064  }
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveImageFromHttpRequest()

ilOpenIdConnectSettingsGUI::saveImageFromHttpRequest ( )
private

Definition at line 375 of file class.ilOpenIdConnectSettingsGUI.php.

References Vendor\Package\$e, ilOpenIdConnectSettings\FILE_STORAGE, ILIAS\Repository\logger(), settings(), and ILIAS\Repository\upload().

Referenced by saveSettings().

375  : void
376  {
377  try {
378  if (!$this->upload->hasBeenProcessed()) {
379  $this->upload->process();
380  }
381 
382  foreach ($this->upload->getResults() as $single_file_upload) {
383  if ($single_file_upload->isOK()) {
384  $this->settings->deleteImageFile();
385  $this->upload->moveFilesTo(
387  \ILIAS\FileUpload\Location::WEB
388  );
389  $this->settings->setLoginElementImage($single_file_upload->getName());
390  }
391  }
392  } catch (\ILIAS\Filesystem\Exception\IllegalStateException $e) {
393  $this->logger->warning('Upload failed with message: ' . $e->getMessage());
394  }
395  }
Interface Observer Contains several chained tasks and infos about them.
Class FileUpload.
Definition: FileUpload.php:37
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveProfileMapping()

ilOpenIdConnectSettingsGUI::saveProfileMapping ( )
private

Definition at line 666 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccessBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), mainTemplate(), null, profile(), settings(), and updateProfileMappingFieldValue().

666  : void
667  {
668  $this->checkAccessBool('write');
669 
670  $form = $this->initUserMappingForm();
671  if ($this->request->getMethod() === 'POST' &&
672  $this->request->getQueryParams()['opic'] === 'opic_user_data_mapping') {
673  $request_form = $form->withRequest($this->request);
674  $result = $request_form->getData();
675  if ($result === null) {
676  $this->mainTemplate->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
677  $this->profile();
678  return;
679  }
680 
681  foreach ($this->settings->getProfileMappingFields() as $field => $lng_key) {
682  $this->updateProfileMappingFieldValue($field);
683  }
684 
685  foreach ($this->udf->getDefinitions() as $definition) {
686  $field = self::UDF_STRING . $definition['field_id'];
687  $this->updateProfileMappingFieldValue($field);
688  }
689  }
690 
691  $this->settings->save();
692 
693  $this->mainTemplate->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
694  $this->ctrl->redirect($this, self::STAB_PROFILE);
695  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
settings(?ilPropertyFormGUI $form=null)
mainTemplate()
+ Here is the call graph for this function:

◆ saveRoles()

ilOpenIdConnectSettingsGUI::saveRoles ( )
private

Definition at line 769 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess(), ILIAS\Repository\ctrl(), ilLogLevel\DEBUG, initRolesForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), mainTemplate(), prepareRoleSelection(), roles(), and settings().

769  : void
770  {
771  $this->checkAccess('write');
772 
773  $form = $this->initRolesForm();
774  if ($form->checkInput()) {
775  $this->logger->dump($this->body, ilLogLevel::DEBUG);
776 
777  $role_settings = [];
778  $role_valid = true;
779  foreach ($this->prepareRoleSelection(false) as $role_id => $role_title) {
780  $role_settings[(int) $role_id]['update'] = !$form->getInput('role_map_update_' . $role_id);
781  $role_settings[(int) $role_id]['value'] = '';
782 
783  $input_role = trim($form->getInput('role_map_' . $role_id));
784  if ($input_role === '') {
785  continue;
786  }
787 
788  $role_params = explode('::', $input_role);
789  $this->logger->dump($role_params, ilLogLevel::DEBUG);
790 
791  if (count($role_params) !== 2) {
792  if ($form->getItemByPostVar('role_map_' . $role_id)) {
793  $form->getItemByPostVar('role_map_' . $role_id)->setAlert($this->lng->txt('msg_wrong_format'));
794  }
795  $role_valid = false;
796  continue;
797  }
798  $role_settings[(int) $role_id]['value'] = $input_role;
799  }
800 
801  if (!$role_valid) {
802  $form->setValuesByPost();
803  $this->mainTemplate->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
804  $this->roles($form);
805  return;
806  }
807 
808  $this->settings->setRoleMappings($role_settings);
809  $this->settings->save();
810  $this->mainTemplate->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
811  $this->ctrl->redirect($this, 'roles');
812  }
813 
814  $form->setValuesByPost();
815 
816  $this->mainTemplate->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
817 
818  $this->roles($form);
819  }
prepareRoleSelection(bool $a_with_select_option=true)
roles(?ilPropertyFormGUI $form=null)
settings(?ilPropertyFormGUI $form=null)
mainTemplate()
+ Here is the call graph for this function:

◆ saveScopes()

ilOpenIdConnectSettingsGUI::saveScopes ( )
private

Definition at line 551 of file class.ilOpenIdConnectSettingsGUI.php.

References $failed_validation_messages, $url, checkAccess(), ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), mainTemplate(), null, scopes(), settings(), ilOpenIdConnectSettings\URL_VALIDATION_CUSTOM, ilOpenIdConnectSettings\URL_VALIDATION_PROVIDER, and validateDiscoveryUrl().

551  : void
552  {
553  $this->checkAccess('write');
554 
555  $validation = false;
556  $type = null;
557  $url = null;
558  $custom_scopes = [];
559 
560  $form = $this->initScopesForm();
561  if ($this->request->getMethod() === 'POST') {
562  $request_form = $form->withRequest($this->request);
563  $result = $request_form->getData();
564  if ($result === null) {
565  $this->mainTemplate->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
566  $this->scopes();
567  return;
568  }
569 
570  foreach ($form->getInputs() as $group => $groups) {
571  foreach ($groups->getInputs() as $key => $input) {
572  $dedicated_name = $input->getDedicatedName();
573  $result_data = $result[$group][$key];
574  if ($dedicated_name === 'validate_scopes') {
575  $type = (int) $result_data[0];
576  $url = array_pop($result_data[1]);
577  } elseif ($dedicated_name === 'custom_scope') {
578  $custom_scopes = $result_data;
579  }
580  }
581  }
582 
584  $url = $this->settings->getProvider();
585  }
586  $validation = $this->validateDiscoveryUrl($type, $url, $custom_scopes);
587  }
588 
589  if ($validation) {
590  $this->settings->setAdditionalScopes((array) $custom_scopes);
591  $this->settings->setValidateScopes((int) $type);
592  if (ilOpenIdConnectSettings::URL_VALIDATION_CUSTOM === $this->settings->getValidateScopes()) {
593  $this->settings->setCustomDiscoveryUrl($url);
594  }
595  $this->settings->save();
596  $this->mainTemplate->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
597  $this->ctrl->redirect($this, 'scopes');
598  }
599 
600  if ($this->failed_validation_messages !== '') {
601  $this->failed_validation_messages = $this->lng->txt(
602  'err_check_input'
603  ) . '<br/>' . $this->failed_validation_messages;
604  } else {
605  $this->failed_validation_messages = $this->lng->txt('err_check_input');
606  }
607 
608  $this->mainTemplate->setOnScreenMessage('failure', $this->failed_validation_messages, true);
609  $this->ctrl->redirect($this, 'scopes');
610  }
$url
Definition: shib_logout.php:68
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
settings(?ilPropertyFormGUI $form=null)
validateDiscoveryUrl(int $type, ?string $url, array $scopes)
mainTemplate()
+ Here is the call graph for this function:

◆ saveSettings()

ilOpenIdConnectSettingsGUI::saveSettings ( )
private

Definition at line 334 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess(), ILIAS\Repository\ctrl(), initSettingsForm(), ILIAS\Repository\lng(), mainTemplate(), saveImageFromHttpRequest(), and settings().

334  : void
335  {
336  $this->checkAccess('write');
337 
338  $form = $this->initSettingsForm();
339  if (!$form->checkInput()) {
340  $this->mainTemplate->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
341  $form->setValuesByPost();
342  $this->settings($form);
343  return;
344  }
345 
346  $this->settings->setActive((bool) $form->getInput('activation'));
347  $this->settings->setProvider((string) $form->getInput('provider'));
348  $this->settings->setClientId((string) $form->getInput('client_id'));
349  if ((string) $form->getInput('secret') !== '' && strcmp($form->getInput('secret'), '******') !== 0) {
350  $this->settings->setSecret((string) $form->getInput('secret'));
351  }
352 
353  $this->settings->setLoginElementType((int) $form->getInput('le'));
354  $this->settings->setLoginElementText((string) $form->getInput('le_text'));
355  $this->settings->setLoginPromptType((int) $form->getInput('login_prompt'));
356  $this->settings->setLogoutScope((int) $form->getInput('logout_scope'));
357  $this->settings->useCustomSession((bool) $form->getInput('custom_session'));
358  $this->settings->setSessionDuration((int) $form->getInput('session_duration'));
359  $this->settings->allowSync((bool) $form->getInput('sync'));
360  $this->settings->setRole((int) $form->getInput('role'));
361  $this->settings->setUidField((string) $form->getInput('username'));
362 
363  $fileData = (array) $form->getInput('le_img');
364 
365  if ((string) ($fileData['tmp_name'] ?? '') !== '') {
366  $this->saveImageFromHttpRequest();
367  }
368 
369  $this->settings->save();
370 
371  $this->mainTemplate->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
372  $this->ctrl->redirect($this, 'settings');
373  }
settings(?ilPropertyFormGUI $form=null)
mainTemplate()
+ Here is the call graph for this function:

◆ scopes()

ilOpenIdConnectSettingsGUI::scopes ( )
private

Definition at line 433 of file class.ilOpenIdConnectSettingsGUI.php.

References $url, buildScopeSelection(), checkAccess(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), redirectToSettingsScreenIfNoURLIsConfigured(), renderer(), saniziteArrayElementsTrafo(), setSubTabs(), settings(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation().

Referenced by discoverScopesFromServer(), saveScopes(), and validateDiscoveryUrl().

433  : void
434  {
435  $this->checkAccess('read');
436 
438 
439  $this->setSubTabs(self::STAB_SCOPES);
440  $url = $this->settings->getProvider();
441  if ($url !== '') {
442  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
443  $this->toolbar->addFormButton($this->lng->txt('auth_oidc_discover_scopes'), 'discoverScopesFromServer');
444  }
445 
446  $form = $this->initScopesForm();
447  $this->tpl->setContent($this->renderer->render($form));
448  }
renderer()
$url
Definition: shib_logout.php:68
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubTabs()

ilOpenIdConnectSettingsGUI::setSubTabs ( string  $active_tab)
private

Definition at line 821 of file class.ilOpenIdConnectSettingsGUI.php.

References $url, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), settings(), and ILIAS\Repository\tabs().

Referenced by chooseMapping(), roles(), scopes(), and settings().

821  : void
822  {
823  $this->tabs->addSubTab(
824  self::STAB_SETTINGS,
825  $this->lng->txt('auth_oidc_' . self::STAB_SETTINGS),
826  $this->ctrl->getLinkTarget($this, self::STAB_SETTINGS)
827  );
828 
829  $url = $this->settings->getProvider();
830  if ($url !== '') {
831  $this->tabs->addSubTab(
832  self::STAB_SCOPES,
833  $this->lng->txt('auth_oidc_' . self::STAB_SCOPES),
834  $this->ctrl->getLinkTarget($this, self::STAB_SCOPES)
835  );
836 
837  $this->tabs->addSubTab(
838  self::STAB_PROFILE,
839  $this->lng->txt('auth_oidc_' . self::STAB_PROFILE),
840  $this->ctrl->getLinkTarget($this, self::STAB_PROFILE)
841  );
842  $this->tabs->addSubTab(
843  self::STAB_ROLES,
844  $this->lng->txt('auth_oidc_' . self::STAB_ROLES),
845  $this->ctrl->getLinkTarget($this, self::STAB_ROLES)
846  );
847  }
848 
849  $this->tabs->activateSubTab($active_tab);
850  }
$url
Definition: shib_logout.php:68
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ settings()

ilOpenIdConnectSettingsGUI::settings ( ?ilPropertyFormGUI  $form = null)
private

Definition at line 136 of file class.ilOpenIdConnectSettingsGUI.php.

References checkAccess(), initSettingsForm(), mainTemplate(), and setSubTabs().

Referenced by __construct(), buildScopeSelection(), buildUserMappingInputFormUDF(), buildUserMappingInputForUserData(), discoverScopesFromServer(), initAttributeMapping(), initRolesForm(), initSettingsForm(), redirectToSettingsScreenIfNoURLIsConfigured(), saveImageFromHttpRequest(), saveProfileMapping(), saveRoles(), saveScopes(), saveSettings(), scopes(), setSubTabs(), updateProfileMappingFieldValue(), and validateDiscoveryUrl().

136  : void
137  {
138  $this->checkAccess('read');
139 
140  $this->setSubTabs(self::STAB_SETTINGS);
141 
142  if (!$form instanceof ilPropertyFormGUI) {
143  $form = $this->initSettingsForm();
144  }
145 
146  $this->mainTemplate->setContent($form->getHTML());
147  }
mainTemplate()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showInfoMessage()

ilOpenIdConnectSettingsGUI::showInfoMessage ( )
private

Definition at line 866 of file class.ilOpenIdConnectSettingsGUI.php.

References $message, $url, ILIAS\Repository\ctrl(), factory(), ILIAS\Repository\lng(), mainTemplate(), renderer(), and ILIAS\GlobalScreen\Scope\Footer\Factory\withOpenInNewViewport().

Referenced by chooseMapping().

866  : void
867  {
868  if ($this->mapping_template === self::VIEW_TAB_EFFECTIVE_MAPPING) {
869  $url = $this->renderer->render(
870  $this->factory->link()->standard(
871  $this->lng->txt('auth_oidc_here'),
872  'https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims'
873  )->withOpenInNewViewport(true)
874  );
875  $message = sprintf($this->lng->txt('auth_odic_scope_tab_info'), $url);
876  } else {
877  $url = $this->renderer->render(
878  $this->factory->link()->standard(
879  $this->lng->txt('auth_oidc_here'),
880  $this->ctrl->getLinkTarget($this, self::STAB_SCOPES)
881  )
882  );
883  $tab_name = $this->lng->txt('auth_oidc_configured_scopes');
884  $message = sprintf($this->lng->txt('auth_odic_scope_info'), $url, $tab_name);
885  }
886 
887  $this->mainTemplate->setOnScreenMessage('info', $message);
888  }
factory()
renderer()
$url
Definition: shib_logout.php:68
$message
Definition: xapiexit.php:31
mainTemplate()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ trimIfStringTrafo()

ilOpenIdConnectSettingsGUI::trimIfStringTrafo ( )
private

Definition at line 1066 of file class.ilOpenIdConnectSettingsGUI.php.

References ILIAS\Repository\refinery().

Referenced by buildScopeSelection(), buildUserMappingInputFormUDF(), and buildUserMappingInputForUserData().

1066  : \ILIAS\Refinery\Transformation
1067  {
1068  return $this->refinery->custom()->transformation(static function ($value) {
1069  if (is_string($value)) {
1070  $value = trim($value);
1071  }
1072 
1073  return $value;
1074  });
1075  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateProfileMappingFieldValue()

ilOpenIdConnectSettingsGUI::updateProfileMappingFieldValue ( string  $field)
private

Definition at line 697 of file class.ilOpenIdConnectSettingsGUI.php.

References settings().

Referenced by saveProfileMapping().

697  : void
698  {
699  $form = $this->initUserMappingForm();
700  $request_form = $form->withRequest($this->request);
701  $result = $request_form->getData();
702  foreach ($form->getInputs() as $group => $groups) {
703  foreach ($groups->getInputs() as $key => $input) {
704  $dedicated_name = $input->getDedicatedName();
705  $result_data = $result[$group][$key];
706 
707  if ($dedicated_name === $field . self::VALUE_STRING) {
708  $this->settings->setProfileMappingFieldValue(
709  $field,
710  $result_data
711  );
712  } elseif ($dedicated_name === $field . self::UPDATE_STRING) {
713  $this->settings->setProfileMappingFieldUpdate(
714  $field,
715  (bool) $result_data
716  );
717  }
718  }
719  }
720  }
settings(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userMapping()

ilOpenIdConnectSettingsGUI::userMapping ( )
private

Definition at line 1014 of file class.ilOpenIdConnectSettingsGUI.php.

References ILIAS\UI\examples\Layout\Page\Standard\$request_wrapper, factory(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilOpenIdAttributeMappingTemplate\OPEN_ID_CONFIGURED_SCOPES, ILIAS\Repository\refinery(), and renderer().

Referenced by chooseMapping(), initAttributeMapping(), and profile().

1014  : void
1015  {
1016  $form = $this->initUserMappingForm();
1017 
1018  $request_wrapper = $this->http->wrapper()->query();
1019  $active = self::EFFECTIVE_ATTRIBUTE_MAPPING_TAB;
1020 
1021  $target = $this->http->request()->getRequestTarget();
1022  if ($request_wrapper->has(self::POST_VALUE) && $request_wrapper->retrieve(
1023  self::POST_VALUE,
1024  $this->refinery->kindlyTo()->int()
1025  )) {
1026  $active = $request_wrapper->retrieve(self::POST_VALUE, $this->refinery->kindlyTo()->int());
1027  }
1028 
1029  $actions = [
1030  $this->lng->txt('auth_oidc_saved_values') => "$target&" . self::POST_VALUE . '=' . self::SAVED_VALUES,
1031  $this->lng->txt(
1033  ) => "$target&" . self::POST_VALUE . '=' . self::DEFAULT_VALUES,
1034  ];
1035 
1036  $aria_label = 'change_the_currently_displayed_mode';
1037  $active_label = $this->lng->txt('auth_oidc_saved_values');
1038  if ($active !== self::EFFECTIVE_ATTRIBUTE_MAPPING_TAB) {
1040  }
1041  $view_control = $this->factory->viewControl()->mode($actions, $aria_label)->withActive($active_label);
1042 
1043  $this->tpl->setContent($this->renderer->render([$view_control, $form]));
1044  }
factory()
renderer()
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateDiscoveryUrl()

ilOpenIdConnectSettingsGUI::validateDiscoveryUrl ( int  $type,
?string  $url,
array  $scopes 
)
private
Parameters
list<string>$scopes

Definition at line 615 of file class.ilOpenIdConnectSettingsGUI.php.

References Vendor\Package\$e, $url, ILIAS\Repository\lng(), mainTemplate(), null, scopes(), settings(), ilOpenIdConnectSettings\URL_VALIDATION_CUSTOM, ilOpenIdConnectSettings\URL_VALIDATION_PROVIDER, and ilOpenIdConnectSettings\VALIDATION_ISSUE_INVALID_SCOPE.

Referenced by saveScopes().

615  : bool
616  {
617  try {
618  switch ($type) {
620  $discoveryURL = $url . self::URL_VALIDATION_PROVIDER_STRING;
621  break;
623  $discoveryURL = $url;
624  break;
625  default:
626  $discoveryURL = null;
627  break;
628  }
629 
630  $validation_result = $discoveryURL !== null ? $this->settings->validateScopes(
631  $discoveryURL,
632  $scopes
633  ) : [];
634  if (!empty($validation_result)) {
635  if (ilOpenIdConnectSettings::VALIDATION_ISSUE_INVALID_SCOPE === $validation_result[0]) {
636  $this->failed_validation_messages =
637  sprintf(
638  $this->lng->txt('auth_oidc_settings_invalid_scopes'),
639  implode(',', $validation_result[1])
640  );
641  } else {
642  $this->failed_validation_messages = sprintf(
643  $this->lng->txt('auth_oidc_settings_discovery_error'),
644  $validation_result[1]
645  );
646  }
647  $this->scopes();
648 
649  return false;
650  }
651  } catch (ilCurlConnectionException $e) {
652  $this->mainTemplate->setOnScreenMessage(
653  'failure',
654  $e->getMessage(),
655  true
656  );
657  $this->failed_validation_messages = $e->getMessage();
658  $this->scopes();
659 
660  return false;
661  }
662 
663  return true;
664  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$scopes
Definition: ltitoken.php:96
$url
Definition: shib_logout.php:68
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
settings(?ilPropertyFormGUI $form=null)
mainTemplate()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

readonly ilAccessHandler ilOpenIdConnectSettingsGUI::$access
private

Definition at line 54 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $attribute_mapping_template

ilOpenIdAttributeMappingTemplate ilOpenIdConnectSettingsGUI::$attribute_mapping_template
private

Definition at line 65 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $body

ilOpenIdConnectSettingsGUI::$body
private

Definition at line 49 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $ctrl

readonly ilCtrl ilOpenIdConnectSettingsGUI::$ctrl
private

Definition at line 52 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $error

readonly ilErrorHandling ilOpenIdConnectSettingsGUI::$error
private

Definition at line 56 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $factory

Factory ilOpenIdConnectSettingsGUI::$factory
private

Definition at line 69 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $failed_validation_messages

string ilOpenIdConnectSettingsGUI::$failed_validation_messages = ''
private

Definition at line 71 of file class.ilOpenIdConnectSettingsGUI.php.

Referenced by saveScopes().

◆ $http

Services ilOpenIdConnectSettingsGUI::$http
private

Definition at line 68 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $lng

readonly ilLanguage ilOpenIdConnectSettingsGUI::$lng
private

Definition at line 51 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $logger

readonly ilLogger ilOpenIdConnectSettingsGUI::$logger
private

Definition at line 53 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $mainTemplate

readonly ilGlobalTemplateInterface ilOpenIdConnectSettingsGUI::$mainTemplate
private

Definition at line 57 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $mapping_template

int ilOpenIdConnectSettingsGUI::$mapping_template = self::VIEW_TAB_EFFECTIVE_MAPPING
private

Definition at line 63 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $ref_id

int ilOpenIdConnectSettingsGUI::$ref_id
private

Definition at line 47 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $refinery

ILIAS Refinery Factory ilOpenIdConnectSettingsGUI::$refinery
private

Definition at line 70 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $renderer

Renderer ilOpenIdConnectSettingsGUI::$renderer
private

Definition at line 67 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $request

ServerRequestInterface ilOpenIdConnectSettingsGUI::$request
private

Definition at line 64 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $review

readonly ilRbacReview ilOpenIdConnectSettingsGUI::$review
private

Definition at line 55 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $settings

readonly ilOpenIdConnectSettings ilOpenIdConnectSettingsGUI::$settings
private

Definition at line 50 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $tabs

readonly ilTabsGUI ilOpenIdConnectSettingsGUI::$tabs
private

Definition at line 58 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $toolbar

ilToolbarGUI ilOpenIdConnectSettingsGUI::$toolbar
private

Definition at line 60 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilOpenIdConnectSettingsGUI::$tpl
private

Definition at line 62 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $udf

ilUserDefinedFields ilOpenIdConnectSettingsGUI::$udf = null
private

Definition at line 61 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $ui

Factory ilOpenIdConnectSettingsGUI::$ui
private

Definition at line 66 of file class.ilOpenIdConnectSettingsGUI.php.

◆ $upload

readonly FileUpload ilOpenIdConnectSettingsGUI::$upload
private

Definition at line 59 of file class.ilOpenIdConnectSettingsGUI.php.

◆ DEFAULT_CMD

const ilOpenIdConnectSettingsGUI::DEFAULT_CMD = 'settings'
private

Definition at line 38 of file class.ilOpenIdConnectSettingsGUI.php.

◆ DEFAULT_VALUES

const ilOpenIdConnectSettingsGUI::DEFAULT_VALUES = 1
private

Definition at line 39 of file class.ilOpenIdConnectSettingsGUI.php.

◆ EFFECTIVE_ATTRIBUTE_MAPPING_TAB

const ilOpenIdConnectSettingsGUI::EFFECTIVE_ATTRIBUTE_MAPPING_TAB = 2
private

Definition at line 45 of file class.ilOpenIdConnectSettingsGUI.php.

◆ POST_VALUE

const ilOpenIdConnectSettingsGUI::POST_VALUE = 'Mode'
private

Definition at line 41 of file class.ilOpenIdConnectSettingsGUI.php.

◆ SAVED_VALUES

const ilOpenIdConnectSettingsGUI::SAVED_VALUES = 2
private

Definition at line 40 of file class.ilOpenIdConnectSettingsGUI.php.

◆ STAB_PROFILE

const ilOpenIdConnectSettingsGUI::STAB_PROFILE = 'profile'
private

Definition at line 33 of file class.ilOpenIdConnectSettingsGUI.php.

◆ STAB_ROLES

const ilOpenIdConnectSettingsGUI::STAB_ROLES = 'roles'
private

Definition at line 34 of file class.ilOpenIdConnectSettingsGUI.php.

◆ STAB_SCOPES

const ilOpenIdConnectSettingsGUI::STAB_SCOPES = 'scopes'
private

Definition at line 32 of file class.ilOpenIdConnectSettingsGUI.php.

◆ STAB_SETTINGS

const ilOpenIdConnectSettingsGUI::STAB_SETTINGS = 'settings'
private

Definition at line 31 of file class.ilOpenIdConnectSettingsGUI.php.

◆ UDF_STRING

const ilOpenIdConnectSettingsGUI::UDF_STRING = 'udf_'
private

Definition at line 37 of file class.ilOpenIdConnectSettingsGUI.php.

◆ UPDATE_STRING

const ilOpenIdConnectSettingsGUI::UPDATE_STRING = '_update'
private

Definition at line 36 of file class.ilOpenIdConnectSettingsGUI.php.

◆ URL_VALIDATION_PROVIDER_STRING

const ilOpenIdConnectSettingsGUI::URL_VALIDATION_PROVIDER_STRING = '/.well-known/openid-configuration'
private

Definition at line 44 of file class.ilOpenIdConnectSettingsGUI.php.

◆ VALUE_STRING

const ilOpenIdConnectSettingsGUI::VALUE_STRING = '_value'
private

Definition at line 35 of file class.ilOpenIdConnectSettingsGUI.php.

◆ VIEW_TAB_EFFECTIVE_MAPPING

const ilOpenIdConnectSettingsGUI::VIEW_TAB_EFFECTIVE_MAPPING = 2
private

Definition at line 43 of file class.ilOpenIdConnectSettingsGUI.php.

◆ VIEW_TAB_PRE_FILED

const ilOpenIdConnectSettingsGUI::VIEW_TAB_PRE_FILED = 1
private

Definition at line 42 of file class.ilOpenIdConnectSettingsGUI.php.


The documentation for this class was generated from the following file: