77 $this->ref_id = $a_ref_id;
79 $this->lng = $DIC->language();
80 $this->lng->loadLanguageModule(
'auth');
82 $this->mainTemplate = $DIC->ui()->mainTemplate();
83 $this->tabs = $DIC->tabs();
84 $this->ctrl = $DIC->ctrl();
85 $this->logger = $DIC->logger()->auth();
87 $this->access = $DIC->access();
88 $this->review = $DIC->rbac()->review();
89 $this->error = $DIC[
'ilErr'];
101 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->WARNING);
111 return $this->access->checkAccess($a_permission,
'', $this->ref_id);
122 switch ($this->ctrl->getNextClass()) {
124 $cmd = $this->ctrl->getCmd(self::DEFAULT_CMD);
143 $this->mainTemplate->setContent(
$form->getHTML());
152 $form->setTitle($this->lng->txt(
'auth_oidc_settings_title'));
153 $form->setFormAction($this->ctrl->getFormAction($this));
157 $this->lng->txt(
'auth_oidc_settings_activation'),
161 $form->addItem($activation);
165 $this->lng->txt(
'auth_oidc_settings_provider'),
173 $this->lng->txt(
'auth_oidc_settings_client_id'),
182 $this->lng->txt(
'auth_oidc_settings_secret'),
186 $secret->setRetype(
false);
187 $secret->setRequired(
false);
188 if (strlen($this->
settings->getSecret())) {
189 $secret->setValue(
'******');
191 $form->addItem($secret);
195 $this->lng->txt(
'auth_oidc_settings_le'),
199 $login_element->setValue($this->
settings->getLoginElementType());
200 $form->addItem($login_element);
204 $this->lng->txt(
'auth_oidc_settings_txt'),
207 $login_element->addOption($text_option);
215 $text->setMaxLength(120);
216 $text->setInfo($this->lng->txt(
'auth_oidc_settings_txt_val_info'));
217 $text_option->addSubItem(
$text);
221 $this->lng->txt(
'auth_oidc_settings_img'),
224 $login_element->addOption($img_option);
230 $image->setALlowDeletion(
false);
232 if ($this->
settings->hasImageFile()) {
233 $image->setImage($this->
settings->getImageFilePath());
235 $image->setInfo($this->lng->txt(
'auth_oidc_settings_img_file_info'));
236 $img_option->addSubItem($image);
240 $this->lng->txt(
'auth_oidc_settings_login_options'),
247 $this->lng->txt(
'auth_oidc_settings_login_option_enforce'),
250 $enforce->
setInfo($this->lng->txt(
'auth_oidc_settings_login_option_enforce_info'));
251 $login_options->addOption($enforce);
255 $this->lng->txt(
'auth_oidc_settings_login_option_default'),
258 $default->setInfo($this->lng->txt(
'auth_oidc_settings_login_option_default_info'));
259 $login_options->addOption(
$default);
261 $form->addItem($login_options);
265 $this->lng->txt(
'auth_oidc_settings_logout_scope'),
272 $this->lng->txt(
'auth_oidc_settings_logout_scope_global'),
275 $global_scope->
setInfo($this->lng->txt(
'auth_oidc_settings_logout_scope_global_info'));
276 $logout_scope->addOption($global_scope);
280 $this->lng->txt(
'auth_oidc_settings_logout_scope_local'),
283 $logout_scope->addOption($ilias_scope);
285 $form->addItem($logout_scope);
288 $this->lng->txt(
'auth_oidc_settings_custom_session_duration_type'),
292 $this->lng->txt(
'auth_oidc_settings_custom_session_duration_option')
294 $use_custom_session->setChecked($this->
settings->isCustomSession());
295 $form->addItem($use_custom_session);
299 $this->lng->txt(
'auth_oidc_settings_session_duration'),
303 $session->setSuffix($this->lng->txt(
'minutes'));
307 $use_custom_session->addSubItem(
$session);
311 $form->addCommandButton(
'saveSettings', $this->lng->txt(
'save'));
317 $user_sync->setTitle($this->lng->txt(
'auth_oidc_settings_section_user_sync'));
318 $form->addItem($user_sync);
321 $this->lng->txt(
'auth_oidc_settings_user_sync'),
325 $sync->setInfo($this->lng->txt(
'auth_oidc_settings_user_sync_info'));
330 $this->lng->txt(
'auth_oidc_settings_default_role'),
334 $roles->setInfo($this->lng->txt(
'auth_oidc_settings_default_role_info'));
336 $roles->setRequired(
true);
337 $sync->addSubItem($roles);
340 $this->lng->txt(
'auth_oidc_settings_user_attr'),
344 $user_attr->setRequired(
true);
345 $form->addItem($user_attr);
358 if (!
$form->checkInput()) {
360 $this->lng->txt(
'err_check_input')
362 $form->setValuesByPost();
367 $this->
settings->setActive((
bool)
$form->getInput(
'activation'));
368 $this->
settings->setProvider((
string)
$form->getInput(
'provider'));
369 $this->
settings->setClientId((
string)
$form->getInput(
'client_id'));
370 if (strlen(
$form->getInput(
'secret')) && strcmp(
$form->getInput(
'secret'),
'******') !== 0) {
371 $this->
settings->setSecret((
string)
$form->getInput(
'secret'));
373 $this->
settings->setLoginElementType((
int)
$form->getInput(
'le'));
374 $this->
settings->setLoginElementText((
string)
$form->getInput(
'le_text'));
375 $this->
settings->setLoginPromptType((
int)
$form->getInput(
'login_prompt'));
376 $this->
settings->setLogoutScope((
int)
$form->getInput(
'logout_scope'));
377 $this->
settings->useCustomSession((
bool)
$form->getInput(
'custom_session'));
378 $this->
settings->setSessionDuration((
int)
$form->getInput(
'session_duration'));
381 $this->
settings->setUidField((
string)
$form->getInput(
'username'));
383 $fileData = (array)
$form->getInput(
'le_img');
385 if (strlen($fileData[
'tmp_name'])) {
391 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
392 $this->ctrl->redirect($this,
'settings');
403 $upload = $DIC->upload();
404 if (!$upload->hasBeenProcessed()) {
407 foreach ($upload->getResults() as $single_file_upload) {
410 $upload->moveFilesTo(
412 \
ILIAS\FileUpload\Location::WEB
414 $this->
settings->setLoginElementImage($single_file_upload->getName());
418 $this->logger->warning(
'Upload failed with message: ' . $e->getMessage());
429 $this->review->getGlobalRoles(),
436 if ($a_with_select_option) {
437 $select[0] = $this->lng->txt(
'links_select_one');
439 foreach ($global_roles as $role_id) {
440 if ($role_id == ANONYMOUS_ROLE_ID) {
460 $this->mainTemplate->setContent(
$form->getHTML());
469 $form->setTitle($this->lng->txt(
'auth_oidc_mapping_table'));
470 $form->setFormAction($this->ctrl->getFormAction($this,
'saveProfile'));
472 foreach ($this->
settings->getProfileMappingFields() as $field => $lng_key) {
475 $text_form->setValue($this->
settings->getProfileMappingFieldValue($field));
476 $form->addItem($text_form);
479 $checkbox_form->setValue(1);
480 $checkbox_form->setPostVar($field .
"_update");
481 $checkbox_form->setChecked($this->
settings->getProfileMappingFieldUpdate($field));
482 $checkbox_form->setOptionTitle($this->lng->txt(
'auth_oidc_update_field_info'));
483 $form->addItem($checkbox_form);
487 $form->addCommandButton(
'saveProfile', $this->lng->txt(
'save'));
500 if (!
$form->checkInput()) {
502 $form->setValuesByPost();
507 foreach ($this->
settings->getProfileMappingFields() as $field => $lng_key) {
508 $this->
settings->setProfileMappingFieldValue(
510 $form->getInput($field .
'_value')
512 $this->
settings->setProfileMappingFieldUpdate(
514 $form->getInput($field .
'_update')
518 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
519 $this->ctrl->redirect($this, self::STAB_PROFILE);
533 $this->mainTemplate->setContent(
$form->getHTML());
542 $form->setTitle($this->lng->txt(
'auth_oidc_role_mapping_table'));
543 $form->setFormAction($this->ctrl->getFormAction($this, self::STAB_ROLES));
548 'role_map_' . $role_id
550 $role_map->setInfo($this->lng->txt(
'auth_oidc_role_info'));
551 $role_map->setValue($this->
settings->getRoleMappingValueForId($role_id));
552 $form->addItem($role_map);
556 'role_map_update_' . $role_id
558 $update->setOptionTitle($this->lng->txt(
'auth_oidc_update_role_info'));
559 $update->setValue(1);
560 $update->setChecked(!$this->
settings->getRoleMappingUpdateForId($role_id));
561 $form->addItem($update);
565 $form->addCommandButton(
'saveRoles', $this->lng->txt(
'save'));
577 if (
$form->checkInput()) {
584 if (!strlen(trim(
$form->getInput(
'role_map_' . $role_id)))) {
588 $role_params = explode(
'::',
$form->getInput(
'role_map_' . $role_id));
591 if (count($role_params) !== 2) {
592 $form->getItemByPostVar(
'role_map_' . $role_id)->setAlert($this->lng->txt(
'msg_wrong_format'));
596 $role_settings[$role_id][
'update'] = (bool) !
$form->getInput(
'role_map_update_' . $role_id);
597 $role_settings[$role_id][
'value'] = (string)
$form->getInput(
'role_map_' . $role_id);
601 $form->setValuesByPost();
607 $this->
settings->setRoleMappings($role_settings);
609 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
610 $this->ctrl->redirect($this,
'roles');
613 $form->setValuesByPost();
623 $this->tabs->addSubTab(
625 $this->lng->txt(
'auth_oidc_' . self::STAB_SETTINGS),
626 $this->ctrl->getLinkTarget($this, self::STAB_SETTINGS)
628 $this->tabs->addSubTab(
630 $this->lng->txt(
'auth_oidc_' . self::STAB_PROFILE),
631 $this->ctrl->getLinkTarget($this, self::STAB_PROFILE)
633 $this->tabs->addSubTab(
635 $this->lng->txt(
'auth_oidc_' . self::STAB_ROLES),
636 $this->ctrl->getLinkTarget($this, self::STAB_ROLES)
639 $this->tabs->activateSubTab($active_tab);
settings(ilPropertyFormGUI $form=null)
setSubTabs(string $active_tab)
Set sub tabs.
This class represents an option in a radio group.
const LOGOUT_SCOPE_GLOBAL
saveImageFromHttpRequest()
Save image from http request.
Class ilOpenIdConnectSettingsGUI.
prepareRoleSelection($a_with_select_option=true)
checkAccessBool($a_permission)
static _lookupTitle($a_id)
lookup object title
const LOGIN_ELEMENT_TYPE_TXT
saveSettings()
Save settings.
setInfo($a_info)
Set Info.
static getInstance()
Get singleton instance.
checkAccess($a_permission)
initSettingsForm()
Init general settings form.
profile(ilPropertyFormGUI $form=null)
if(isset($_POST['submit'])) $form
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.
__construct($a_ref_id)
ilOpenIdConnectSettingsGUI constructor.
roles(\ilPropertyFormGUI $form=null)
executeCommand()
Execute command.
This class represents a text property in a property form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const LOGIN_ELEMENT_TYPE_IMG
setValue($a_value)
Set Value.
saveRoles()
save role selection
Class FlySystemFileAccessTest.