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'),
 
  160        $activation->setChecked($this->
settings->getActive());
 
  161        $form->addItem($activation);
 
  165            $this->lng->txt(
'auth_oidc_settings_provider'),
 
  168        $provider->setRequired(
true);
 
  169        $provider->setValue($this->
settings->getProvider());
 
  170        $form->addItem($provider);
 
  173            $this->lng->txt(
'auth_oidc_settings_client_id'),
 
  182            $this->lng->txt(
'auth_oidc_settings_secret'),
 
  185        $secret->setSkipSyntaxCheck(
true);
 
  186        $secret->setRetype(
false);
 
  187        $secret->setRequired(
false);
 
  188        if (strlen($this->
settings->getSecret())) {
 
  189            $secret->setValue(
'******');
 
  191        $form->addItem($secret);
 
  194            $this->lng->txt(
'auth_oidc_settings_additional_scopes'),
 
  198        $default_scope->setDisabled(
true);
 
  199        $form->addItem($default_scope);
 
  205        $scopes->setMulti(
true);
 
  206        $scopeValues = $this->
settings->getAdditionalScopes();
 
  207        $scopes->setValue($scopeValues[0]);
 
  208        $scopes->setMultiValues($scopeValues);
 
  209        $form->addItem($scopes);
 
  213            $this->lng->txt(
'auth_oidc_settings_validate_scopes'),
 
  216        $validation_options->setValue((
string) $this->
settings->getValidateScopes());
 
  217        $form->addItem($validation_options);
 
  220            $this->lng->txt(
'auth_oidc_settings_validate_scope_default'),
 
  224        $validation_options->addOption($base_valid_url_option);
 
  228            'custom_discovery_url' 
  232            $this->lng->txt(
'auth_oidc_settings_validate_scope_custom'),
 
  235        $validation_options->addOption($custom_valid_url_option);
 
  236        $custom_validation_url->setValue($this->
settings->getCustomDiscoveryUrl() ?? 
'');
 
  237        $custom_validation_url->setMaxLength(120);
 
  238        $custom_validation_url->setInfo($this->lng->txt(
'auth_oidc_settings_discovery_url'));
 
  239        $custom_valid_url_option->addSubItem($custom_validation_url);
 
  241            $this->lng->txt(
'auth_oidc_settings_validate_scope_none'),
 
  244        $validation_options->addOption($no_validation_option);
 
  248            $this->lng->txt(
'auth_oidc_settings_le'),
 
  251        $login_element->setRequired(
true);
 
  252        $login_element->setValue($this->
settings->getLoginElementType());
 
  253        $form->addItem($login_element);
 
  257            $this->lng->txt(
'auth_oidc_settings_txt'),
 
  260        $login_element->addOption($text_option);
 
  267        $text->setValue($this->
settings->getLoginElemenText());
 
  268        $text->setMaxLength(120);
 
  269        $text->setInfo($this->lng->txt(
'auth_oidc_settings_txt_val_info'));
 
  270        $text_option->addSubItem($text);
 
  274            $this->lng->txt(
'auth_oidc_settings_img'),
 
  277        $login_element->addOption($img_option);
 
  283        $image->setALlowDeletion(
false);
 
  285        if ($this->
settings->hasImageFile()) {
 
  286            $image->setImage($this->
settings->getImageFilePath());
 
  288        $image->setInfo($this->lng->txt(
'auth_oidc_settings_img_file_info'));
 
  289        $img_option->addSubItem($image);
 
  293            $this->lng->txt(
'auth_oidc_settings_login_options'),
 
  296        $login_options->setValue($this->
settings->getLoginPromptType());
 
  300            $this->lng->txt(
'auth_oidc_settings_login_option_enforce'),
 
  303        $enforce->setInfo($this->lng->txt(
'auth_oidc_settings_login_option_enforce_info'));
 
  304        $login_options->addOption($enforce);
 
  308            $this->lng->txt(
'auth_oidc_settings_login_option_default'),
 
  311        $default->setInfo($this->lng->txt(
'auth_oidc_settings_login_option_default_info'));
 
  312        $login_options->addOption($default);
 
  314        $form->addItem($login_options);
 
  318            $this->lng->txt(
'auth_oidc_settings_logout_scope'),
 
  321        $logout_scope->setValue($this->
settings->getLogoutScope());
 
  325            $this->lng->txt(
'auth_oidc_settings_logout_scope_global'),
 
  328        $global_scope->setInfo($this->lng->txt(
'auth_oidc_settings_logout_scope_global_info'));
 
  329        $logout_scope->addOption($global_scope);
 
  333            $this->lng->txt(
'auth_oidc_settings_logout_scope_local'),
 
  336        $logout_scope->addOption($ilias_scope);
 
  338        $form->addItem($logout_scope);
 
  341            $this->lng->txt(
'auth_oidc_settings_custom_session_duration_type'),
 
  344        $use_custom_session->setOptionTitle(
 
  345            $this->lng->txt(
'auth_oidc_settings_custom_session_duration_option')
 
  347        $use_custom_session->setChecked($this->
settings->isCustomSession());
 
  348        $form->addItem($use_custom_session);
 
  352            $this->lng->txt(
'auth_oidc_settings_session_duration'),
 
  356        $session->setSuffix($this->lng->txt(
'minutes'));
 
  360        $use_custom_session->addSubItem(
$session);
 
  364            $form->addCommandButton(
'saveSettings', $this->lng->txt(
'save'));
 
  370        $user_sync->setTitle($this->lng->txt(
'auth_oidc_settings_section_user_sync'));
 
  371        $form->addItem($user_sync);
 
  374            $this->lng->txt(
'auth_oidc_settings_user_sync'),
 
  377        $sync->setChecked($this->
settings->isSyncAllowed());
 
  378        $sync->setInfo($this->lng->txt(
'auth_oidc_settings_user_sync_info'));
 
  380        $form->addItem($sync);
 
  383            $this->lng->txt(
'auth_oidc_settings_default_role'),
 
  386        $roles->setValue($this->
settings->getRole());
 
  387        $roles->setInfo($this->lng->txt(
'auth_oidc_settings_default_role_info'));
 
  389        $roles->setRequired(
true);
 
  390        $sync->addSubItem($roles);
 
  393            $this->lng->txt(
'auth_oidc_settings_user_attr'),
 
  396        $user_attr->setValue($this->
settings->getUidField());
 
  397        $user_attr->setRequired(
true);
 
  398        $form->addItem($user_attr);
 
  411        if (!$form->checkInput()) {
 
  413                $this->lng->txt(
'err_check_input')
 
  415            $form->setValuesByPost();
 
  420        if (!empty($form->getInput(
'scopes'))) {
 
  421            $scopes = $form->getInput(
'scopes');
 
  422            foreach ($scopes as $key => $value) {
 
  424                    array_splice($scopes, $key, 1);
 
  429        switch ((
int) $form->getInput(
'validate_scopes')) {
 
  431                $discoveryURL = $form->getInput(
'provider') . 
'/.well-known/openid-configuration';
 
  434                $discoveryURL = $form->getInput(
'custom_discovery_url');
 
  437                $discoveryURL = 
null;
 
  440        $validation_result = !is_null($discoveryURL) ? $this->
settings->validateScopes($discoveryURL, (array) $scopes) : [];
 
  441        if (!empty($validation_result)) {
 
  443                $this->mainTemplate->setOnScreenMessage(
 
  445                    sprintf($this->lng->txt(
'auth_oidc_settings_invalid_scopes'), implode(
",", $validation_result[1]))
 
  448                $this->mainTemplate->setOnScreenMessage(
 
  450                    sprintf($this->lng->txt(
'auth_oidc_settings_discovery_error'), $validation_result[1])
 
  453            $form->setValuesByPost();
 
  458        $this->
settings->setActive((
bool) $form->getInput(
'activation'));
 
  459        $this->
settings->setProvider((
string) $form->getInput(
'provider'));
 
  460        $this->
settings->setClientId((
string) $form->getInput(
'client_id'));
 
  461        if (strlen($form->getInput(
'secret')) && strcmp($form->getInput(
'secret'), 
'******') !== 0) {
 
  462            $this->
settings->setSecret((
string) $form->getInput(
'secret'));
 
  464        $this->
settings->setAdditionalScopes((array) $scopes);
 
  465        $this->
settings->setLoginElementType((
int) $form->getInput(
'le'));
 
  466        $this->
settings->setLoginElementText((
string) $form->getInput(
'le_text'));
 
  467        $this->
settings->setLoginPromptType((
int) $form->getInput(
'login_prompt'));
 
  468        $this->
settings->setLogoutScope((
int) $form->getInput(
'logout_scope'));
 
  469        $this->
settings->useCustomSession((
bool) $form->getInput(
'custom_session'));
 
  470        $this->
settings->setSessionDuration((
int) $form->getInput(
'session_duration'));
 
  471        $this->
settings->allowSync((
bool) $form->getInput(
'sync'));
 
  472        $this->
settings->setRole((
int) $form->getInput(
'role'));
 
  473        $this->
settings->setUidField((
string) $form->getInput(
'username'));
 
  475        $fileData = (array) $form->getInput(
'le_img');
 
  477        if (strlen($fileData[
'tmp_name'])) {
 
  480        $this->
settings->setValidateScopes((
int) $form->getInput(
'validate_scopes'));
 
  482            $this->
settings->setCustomDiscoveryUrl($form->getInput(
'custom_discovery_url'));
 
  487        ilUtil::sendSuccess($this->lng->txt(
'settings_saved'), 
true);
 
  488        $this->ctrl->redirect($this, 
'settings');
 
  499            $upload = 
$DIC->upload();
 
  500            if (!$upload->hasBeenProcessed()) {
 
  503            foreach ($upload->getResults() as $single_file_upload) {
 
  504                if ($single_file_upload->getStatus() == \
ILIAS\FileUpload\DTO\ProcessingStatus::OK) {
 
  506                    $upload->moveFilesTo(
 
  508                        \
ILIAS\FileUpload\Location::WEB
 
  510                    $this->
settings->setLoginElementImage($single_file_upload->getName());
 
  514            $this->logger->warning(
'Upload failed with message: ' . 
$e->getMessage());
 
  525            $this->review->getGlobalRoles(),
 
  532        if ($a_with_select_option) {
 
  533            $select[0] = $this->lng->txt(
'links_select_one');
 
  535        foreach ($global_roles as $role_id) {
 
  556        $this->mainTemplate->setContent($form->getHTML());
 
  565        $form->setTitle($this->lng->txt(
'auth_oidc_mapping_table'));
 
  566        $form->setFormAction($this->ctrl->getFormAction($this, 
'saveProfile'));
 
  568        foreach ($this->
settings->getProfileMappingFields() as $field => $lng_key) {
 
  570            $text_form->setPostVar($field . 
"_value");
 
  571            $text_form->setValue($this->
settings->getProfileMappingFieldValue($field));
 
  572            $form->addItem($text_form);
 
  575            $checkbox_form->setValue(1);
 
  576            $checkbox_form->setPostVar($field . 
"_update");
 
  577            $checkbox_form->setChecked($this->
settings->getProfileMappingFieldUpdate($field));
 
  578            $checkbox_form->setOptionTitle($this->lng->txt(
'auth_oidc_update_field_info'));
 
  579            $form->addItem($checkbox_form);
 
  583            $form->addCommandButton(
'saveProfile', $this->lng->txt(
'save'));
 
  596        if (!$form->checkInput()) {
 
  598            $form->setValuesByPost();
 
  603        foreach ($this->
settings->getProfileMappingFields() as $field => $lng_key) {
 
  604            $this->
settings->setProfileMappingFieldValue(
 
  606                $form->getInput($field . 
'_value')
 
  608            $this->
settings->setProfileMappingFieldUpdate(
 
  610                $form->getInput($field . 
'_update')
 
  614        ilUtil::sendSuccess($this->lng->txt(
'settings_saved'), 
true);
 
  615        $this->ctrl->redirect($this, self::STAB_PROFILE);
 
  629        $this->mainTemplate->setContent($form->getHTML());
 
  638        $form->setTitle($this->lng->txt(
'auth_oidc_role_mapping_table'));
 
  639        $form->setFormAction($this->ctrl->getFormAction($this, self::STAB_ROLES));
 
  644                'role_map_' . $role_id
 
  646            $role_map->setInfo($this->lng->txt(
'auth_oidc_role_info'));
 
  647            $role_map->setValue($this->
settings->getRoleMappingValueForId($role_id));
 
  648            $form->addItem($role_map);
 
  652                'role_map_update_' . $role_id
 
  654            $update->setOptionTitle($this->lng->txt(
'auth_oidc_update_role_info'));
 
  655            $update->setValue(1);
 
  656            $update->setChecked(!$this->
settings->getRoleMappingUpdateForId($role_id));
 
  657            $form->addItem($update);
 
  661            $form->addCommandButton(
'saveRoles', $this->lng->txt(
'save'));
 
  673        if ($form->checkInput()) {
 
  680                if (!strlen(trim($form->getInput(
'role_map_' . $role_id)))) {
 
  684                $role_params = explode(
'::', $form->getInput(
'role_map_' . $role_id));
 
  687                if (count($role_params) !== 2) {
 
  688                    $form->getItemByPostVar(
'role_map_' . $role_id)->setAlert($this->lng->txt(
'msg_wrong_format'));
 
  692                $role_settings[$role_id][
'update'] = (bool) !$form->getInput(
'role_map_update_' . $role_id);
 
  693                $role_settings[$role_id][
'value'] = (string) $form->getInput(
'role_map_' . $role_id);
 
  697                $form->setValuesByPost();
 
  703            $this->
settings->setRoleMappings($role_settings);
 
  705            ilUtil::sendSuccess($this->lng->txt(
'settings_saved'), 
true);
 
  706            $this->ctrl->redirect($this, 
'roles');
 
  709        $form->setValuesByPost();
 
  719        $this->tabs->addSubTab(
 
  721            $this->lng->txt(
'auth_oidc_' . self::STAB_SETTINGS),
 
  722            $this->ctrl->getLinkTarget($this, self::STAB_SETTINGS)
 
  724        $this->tabs->addSubTab(
 
  726            $this->lng->txt(
'auth_oidc_' . self::STAB_PROFILE),
 
  727            $this->ctrl->getLinkTarget($this, self::STAB_PROFILE)
 
  729        $this->tabs->addSubTab(
 
  731            $this->lng->txt(
'auth_oidc_' . self::STAB_ROLES),
 
  732            $this->ctrl->getLinkTarget($this, self::STAB_ROLES)
 
  735        $this->tabs->activateSubTab($active_tab);
 
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
static _lookupTitle($a_id)
lookup object title
Class ilOpenIdConnectSettingsGUI.
executeCommand()
Execute command.
prepareRoleSelection($a_with_select_option=true)
profile(ilPropertyFormGUI $form=null)
initSettingsForm()
Init general settings form.
settings(ilPropertyFormGUI $form=null)
checkAccessBool($a_permission)
setSubTabs(string $active_tab)
Set sub tabs.
saveSettings()
Save settings.
saveImageFromHttpRequest()
Save image from http request.
roles(\ilPropertyFormGUI $form=null)
__construct($a_ref_id)
ilOpenIdConnectSettingsGUI constructor.
saveRoles()
save role selection
checkAccess($a_permission)
const LOGIN_ELEMENT_TYPE_IMG
const VALIDATION_ISSUE_INVALID_SCOPE
const URL_VALIDATION_PROVIDER
static getInstance()
Get singleton instance.
const URL_VALIDATION_CUSTOM
const LOGOUT_SCOPE_GLOBAL
const URL_VALIDATION_NONE
const LOGIN_ELEMENT_TYPE_TXT
This class represents an option in a radio group.
This class represents a text property in a property 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,...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...
Class ChatMainBarProvider \MainMenu\Provider.