19declare(strict_types=1);
44 public function __construct($a_data,
int $a_id,
bool $a_call_by_reference,
bool $a_prepare_output =
true)
50 $this->
logger = $DIC->logger()->auth();
52 $this->
lng->loadLanguageModule(
'administration');
53 $this->
lng->loadLanguageModule(
'registration');
54 $this->
lng->loadLanguageModule(
'auth');
55 $this->
lng->loadLanguageModule(
'content');
56 $this->content_style_gui =
$DIC->contentStyle()->gui();
65 ?
ILIAS\UI\
Component\Input\Container\Form\Form $auth_mode_determination_form =
null,
66 ?
ILIAS\UI\
Component\Input\Container\Form\Form $registration_role_mapping_form =
null
69 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
72 $this->tabs_gui->setTabActive(
'authentication_settings');
74 $this->tabs_gui->setSubTabActive(
'auth_settings');
76 $generalSettingsTpl =
new ilTemplate(
'tpl.auth_general.html',
true,
true,
'components/ILIAS/Authentication');
78 $generalSettingsTpl->setVariable(
'FORMACTION', $this->
ctrl->getFormAction($this));
80 $generalSettingsTpl->setVariable(
'TXT_AUTH_MODE', $this->
lng->txt(
'auth_mode'));
81 $generalSettingsTpl->setVariable(
'TXT_AUTH_DEFAULT', $this->
lng->txt(
'default'));
82 $generalSettingsTpl->setVariable(
'TXT_AUTH_ACTIVE', $this->
lng->txt(
'active'));
83 $generalSettingsTpl->setVariable(
'TXT_AUTH_NUM_USERS', $this->
lng->txt(
'num_users'));
85 $generalSettingsTpl->setVariable(
'TXT_LOCAL', $this->
lng->txt(
'auth_local'));
86 $generalSettingsTpl->setVariable(
'TXT_LDAP', $this->
lng->txt(
'auth_ldap'));
87 $generalSettingsTpl->setVariable(
'TXT_SHIB', $this->
lng->txt(
'auth_shib'));
89 $generalSettingsTpl->setVariable(
'TXT_SCRIPT', $this->
lng->txt(
'auth_script'));
91 $generalSettingsTpl->setVariable(
'TXT_APACHE', $this->
lng->txt(
'auth_apache'));
104 $icon_ok = $this->ui_renderer->render(
105 $this->ui_factory->symbol()->icon()->custom(
107 $this->lng->txt(
'enabled')
110 $icon_not_ok = $this->ui_renderer->render(
111 $this->ui_factory->symbol()->icon()->custom(
113 $this->lng->txt(
'disabled')
117 $this->
logger->debug(print_r($auth_modes,
true));
119 foreach ($auth_modes as $mode => $mode_name) {
126 $generalSettingsTpl->setCurrentBlock(
'auth_mode');
130 $generalSettingsTpl->setVariable(
'AUTH_NAME',
$server->getName());
131 $generalSettingsTpl->setVariable(
'AUTH_ACTIVE',
$server->isActive() ? $icon_ok : $icon_not_ok);
134 $generalSettingsTpl->setVariable(
'AUTH_NAME', $idp->getEntityId());
135 $generalSettingsTpl->setVariable(
'AUTH_ACTIVE', $idp->isActive() ? $icon_ok : $icon_not_ok);
137 $generalSettingsTpl->setVariable(
'AUTH_NAME', $this->
lng->txt(
'auth_' . $mode_name));
138 $generalSettingsTpl->setVariable(
143 $generalSettingsTpl->setVariable(
'AUTH_NAME', $this->
lng->txt(
'auth_' . $mode_name));
144 $generalSettingsTpl->setVariable(
146 $this->
ilias->getSetting(
147 $mode_name .
'_active'
152 $auth_cnt_mode = $auth_cnt[$mode_name] ?? 0;
153 if ($this->
settings->get(
'auth_mode') === (
string) $mode) {
154 $generalSettingsTpl->setVariable(
'AUTH_CHECKED',
'checked="checked"');
155 $auth_cnt_default = $auth_cnt[
'default'] ?? 0;
156 $generalSettingsTpl->setVariable(
158 ((
int) $auth_cnt_mode + $auth_cnt_default) .
' (' . $this->
lng->txt(
'auth_per_default') .
159 ': ' . $auth_cnt_default .
')'
162 $generalSettingsTpl->setVariable(
167 $generalSettingsTpl->setVariable(
'AUTH_ID', $mode_name);
168 $generalSettingsTpl->setVariable(
'AUTH_VAL', $mode);
171 $generalSettingsTpl->touchBlock(
'DISABLED');
173 $generalSettingsTpl->setCurrentBlock(
'auth_mode');
174 $generalSettingsTpl->parseCurrentBlock();
177 $generalSettingsTpl->setVariable(
'TXT_CONFIGURE', $this->
lng->txt(
'auth_configure'));
179 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
180 $generalSettingsTpl->setVariable(
'TXT_AUTH_REMARK', $this->
lng->txt(
'auth_remark_non_local_auth'));
181 $generalSettingsTpl->setCurrentBlock(
'auth_mode_submit');
182 $generalSettingsTpl->setVariable(
'TXT_SUBMIT', $this->
lng->txt(
'save'));
183 $generalSettingsTpl->setVariable(
'CMD_SUBMIT',
'setAuthMode');
184 $generalSettingsTpl->parseCurrentBlock();
188 $this->ui_factory->panel()->standard(
189 $this->
lng->txt(
'auth_select'),
190 $this->ui_factory->legacy()->content(implode(
'', [
191 $this->ui_renderer->render($this->ui_factory->messageBox()->info(
192 $this->lng->txt(
'auth_mode_default_change_info')
194 $generalSettingsTpl->get()
200 if ($auth_mode_determination_form !==
null) {
201 $page_content[] = $this->ui_factory->panel()->standard(
202 $this->
lng->txt(
'auth_auth_mode_determination'),
203 $auth_mode_determination_form
207 $page_content[] = $this->ui_factory->panel()->standard(
208 $this->
lng->txt(
'auth_active_roles'),
209 $registration_role_mapping_form ?? $this->buildRegistrationRoleMappingForm()
212 $this->tpl->setContent(
213 $this->ui_renderer->render($page_content)
219 $access = $this->rbac_system->checkAccess(
'write', $this->
object->getRefId());
224 $excluded_auth_names = [
'default',
'saml',
'shibboleth',
'ldap',
'lti',
'apache',
'ecs',
'oidc'];
228 $active_auth_modes = array_filter(
230 static function (
string $auth_name) use ($excluded_auth_names):
bool {
231 foreach ($excluded_auth_names as $excluded_auth_name) {
232 if ($auth_name === $excluded_auth_name) {
236 if (str_starts_with($auth_name, $excluded_auth_name)) {
245 foreach ($reg_roles as $role) {
248 foreach ($active_auth_modes as $auth_name => $auth_key) {
249 if ($auth_name ===
'default') {
250 $name = $this->
lng->txt(
'auth_' . $auth_name) .
' (' . $this->
lng->txt(
254 $name = $this->
lng->txt(
'auth_' . $auth_name);
259 if ($role[
'auth_mode'] === $auth_name) {
270 $fields[
'r_' . $role[
'id']] = $this->ui_factory
276 $this->
lng->txt(
'auth_role_auth_mode')
280 ->withDedicatedName(
'r_' . $role[
'id'])
281 ->withDisabled(!$access);
284 $form = $this->ui_factory
290 $this->
ctrl->getFormAction($this,
'updateRegistrationRoleMapping') :
291 $this->ctrl->getFormAction($this,
'authSettings'),
294 ->withDedicatedName(
'registration_role_mapping');
297 $form = $form->withSubmitLabel($this->
lng->txt(
'refresh'));
305 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
306 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
309 $form = $this->buildRegistrationRoleMappingForm();
312 if ($this->
http->request()->getMethod() ===
'POST') {
313 $form = $form->withRequest($this->
http->request());
314 $form_data = $form->getData();
315 $form_valid = $form_data !==
null;
319 $this->tpl->setOnScreenMessage(
320 $this->tpl::MESSAGE_TYPE_FAILURE,
321 $this->
lng->txt(
'err_wrong_login')
323 $this->authSettingsObject(
null, $form);
328 foreach ($form_data as $role_id => $auth_mode) {
329 $f_object[substr($role_id, 2)] = $auth_mode;
333 $this->tpl->setOnScreenMessage(
334 $this->tpl::MESSAGE_TYPE_SUCCESS,
335 $this->
lng->txt(
'auth_mode_roles_changed'),
338 $this->
ctrl->redirect($this,
'authSettings');
344 if ($det->getCountActiveAuthModes() <= 1) {
348 $access = $this->rbac_system->checkAccess(
'write', $this->
object->getRefId());
350 $automatic_options = [];
352 $auth_sequenced = $det->getAuthModeSequence();
353 foreach ($auth_sequenced as $auth_mode) {
355 switch ($auth_mode) {
362 $text = $this->
lng->txt(
'auth_local');
365 $text = $this->
lng->txt(
'auth_soap');
368 $text = $this->
lng->txt(
'auth_apache');
372 $option = $pl->getMultipleAuthModeOptions($auth_mode);
373 $text = $option[$auth_mode][
'txt'];
378 $automatic_options[
'm' . $auth_mode] = $this->ui_factory
382 ->withDedicatedName(
'm' . $auth_mode)
384 ->withDisabled(!$access);
393 $this->
lng->txt(
'auth_by_user')
396 ->withDisabled(!$access),
402 $this->
lng->txt(
'auth_automatic')
405 ->withDisabled(!$access)
409 self::PROP_AUTH_MODE_KIND => $this->ui_factory
414 $this->
lng->txt(
'auth_kind_determination'),
415 $this->
lng->txt(
'auth_mode_determination_info')
417 ->withDedicatedName(self::PROP_AUTH_MODE_KIND)
418 ->withValue((
string) $det->getKind())
419 ->withDisabled(!$access)
423 $form = $this->ui_factory
429 $this->
ctrl->getFormAction($this,
'updateAuthModeDetermination') :
430 $this->
ctrl->getFormAction($this,
'authSettings'),
433 ->withDedicatedName(
'auth_mode_determination')
434 ->withAdditionalTransformation(
435 $this->
refinery->custom()->transformation(
function ($value): array {
439 $sequence = (array) ($value[self::PROP_AUTH_MODE_KIND][1] ?? []);
442 $merged_values = array_merge(
444 self::PROP_AUTH_MODE_KIND => $auth_mode_kind,
447 self::PROP_AUTH_MODE_SEQUENCE => $sequence
451 return $merged_values;
456 $form = $form->withSubmitLabel($this->
lng->txt(
'refresh'));
464 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
465 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
468 $form = $this->buildAuthModeDeterminationForm();
469 if ($form ===
null) {
470 $this->authSettingsObject();
476 if ($this->
http->request()->getMethod() ===
'POST') {
477 $form = $form->withRequest($this->
http->request());
478 $form_data = $form->getData();
479 $form_valid = $form_data !==
null;
483 $this->tpl->setOnScreenMessage(
484 $this->tpl::MESSAGE_TYPE_FAILURE,
485 $this->
lng->txt(
'err_wrong_login')
487 $this->authSettingsObject($form);
492 $kind = (
int) $form_data[self::PROP_AUTH_MODE_KIND];
493 $det->setKind($kind);
495 $sequence = $form_data[self::PROP_AUTH_MODE_SEQUENCE];
496 $this->
logger->debug(
'pos mode:' . print_r($sequence,
true));
497 asort($sequence, SORT_NUMERIC);
498 $this->
logger->debug(
'pos mode:' . print_r($sequence,
true));
501 foreach (array_keys($sequence) as $auth_mode) {
502 $position[
$counter++] = substr($auth_mode, 1);
504 $this->
logger->debug(
'position mode:' . print_r($position,
true));
505 $det->setAuthModeSequence($position);
509 $this->tpl->setOnScreenMessage(
510 $this->tpl::MESSAGE_TYPE_SUCCESS,
511 $this->
lng->txt(
'settings_saved'),
514 $this->
ctrl->redirect($this,
'authSettings');
519 $this->
ctrl->redirect($this,
'authSettings');
524 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
525 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
527 $this->
logger->debug(
'auth mode available:' . $this->request_wrapper->has(
'auth_mode'));
529 if (!$this->
http->wrapper()->post()->has(
'auth_mode')) {
530 $this->
ilias->raiseError($this->
lng->txt(
'auth_err_no_mode_selected'), $this->ilias->error_obj->MESSAGE);
532 $new_auth_mode = $this->
http->wrapper()->post()->retrieve(
'auth_mode', $this->
refinery->to()->string());
533 $this->
logger->debug(
'auth mode:' . $new_auth_mode);
534 $current_auth_mode = $this->
settings->get(
'auth_mode',
'');
535 if ($new_auth_mode === $current_auth_mode) {
536 $this->tpl->setOnScreenMessage(
538 $this->
lng->txt(
'auth_mode') .
': ' . $this->getAuthModeTitle() .
' ' . $this->lng->txt(
539 'auth_mode_not_changed'
543 $this->
ctrl->redirect($this,
'authSettings');
546 switch ((
int) $new_auth_mode) {
552 if ($this->
object->checkAuthSHIB() !==
true) {
553 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'auth_shib_not_configured'),
true);
555 $this->getReturnLocation(
557 $this->
ctrl->getLinkTargetByClass(
558 ilAuthShibbolethSettingsGUI::class,
570 if ($this->
object->checkAuthScript() !==
true) {
571 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'auth_script_not_configured'),
true);
573 $this->getReturnLocation(
575 $this->
ctrl->getLinkTarget($this,
'editScript',
'',
false,
false)
582 $this->
ilias->setSetting(
'auth_mode', $new_auth_mode);
584 $this->tpl->setOnScreenMessage(
586 $this->
lng->txt(
'auth_default_mode_changed_to') .
' ' . $this->getAuthModeTitle(),
589 $this->
ctrl->redirect($this,
'authSettings');
593 string $submit_action,
596 $role_list = $this->rbac_review->getRolesByFilter(2, $this->
object->
getId());
599 foreach ($role_list as $role) {
600 $roles[$role[
'obj_id']] = $role[
'title'];
603 $active = $this->ui_factory
606 ->checkbox($this->
lng->txt(
'active'))
607 ->withValue((
bool) $this->
settings->get(
'soap_auth_active',
''));
613 $this->
lng->txt(
'server'),
614 $this->lng->txt(
'auth_soap_server_desc')
618 ->withValue($this->
settings->get(
'soap_auth_server',
''));
620 $port = $this->ui_factory
624 $this->
lng->txt(
'port'),
625 $this->lng->txt(
'auth_soap_port_desc')
627 ->withAdditionalTransformation($this->
refinery->int()->isGreaterThan(0))
628 ->withAdditionalTransformation(
629 $this->
refinery->int()->isLessThan(65536)
631 ->withValue((
int) $this->
settings->get(
'soap_auth_port',
'0'));
633 $use_https = $this->ui_factory
636 ->checkbox($this->
lng->txt(
'auth_soap_use_https'))
637 ->withValue((
bool) $this->
settings->get(
'soap_auth_use_https',
''));
639 $uri = $this->ui_factory
643 $this->
lng->txt(
'uri'),
644 $this->lng->txt(
'auth_soap_uri_desc')
647 ->withValue($this->
settings->get(
'soap_auth_uri',
''));
653 $this->
lng->txt(
'auth_soap_namespace'),
654 $this->lng->txt(
'auth_soap_namespace_desc')
657 ->withValue($this->
settings->get(
'soap_auth_namespace',
''));
659 $dotnet = $this->ui_factory
662 ->checkbox($this->
lng->txt(
'auth_soap_use_dotnet'))
663 ->withValue((
bool) $this->
settings->get(
'soap_auth_use_dotnet',
''));
665 $createuser = $this->ui_factory
669 $this->
lng->txt(
'auth_create_users'),
670 $this->lng->txt(
'auth_soap_create_users_desc')
672 ->withValue((
bool) $this->
settings->get(
'soap_auth_create_users',
''));
674 $sendmail = $this->ui_factory
678 $this->
lng->txt(
'user_send_new_account_mail'),
679 $this->lng->txt(
'auth_new_account_mail_desc')
681 ->withValue((
bool) $this->
settings->get(
'soap_auth_account_mail',
''));
683 $defaultrole = $this->ui_factory
687 $this->
lng->txt(
'auth_user_default_role'),
689 $this->lng->txt(
'auth_soap_user_default_role_desc')
691 ->withValue($this->
settings->get(
'soap_auth_user_default_role',
'4'))
692 ->withAdditionalTransformation($this->
refinery->int()->isGreaterThan(0));
694 $allowlocal = $this->ui_factory
698 $this->
lng->txt(
'auth_allow_local'),
699 $this->lng->txt(
'auth_soap_allow_local_desc')
701 ->withValue((
bool) $this->
settings->get(
'soap_auth_user_default_role',
''));
703 $access = $this->rbac_system->checkAccess(
'write', $this->
object->getRefId());
708 'use_https' => $use_https,
712 'createuser' => $createuser,
713 'sendmail' => $sendmail,
714 'defaultrole' => $defaultrole,
715 'allowlocal' => $allowlocal
719 foreach (
$inputs as $key => $input) {
720 $inputs[$key] = $input->withDisabled(
true);
724 $form = $this->ui_factory->input()->container()->form()->standard(
725 $access ? $submit_action : $show_action,
730 $form = $form->withSubmitLabel($this->
lng->txt(
'refresh'));
737 string $submit_action
739 $ext_uid = $this->ui_factory->input()->field()->text(
742 $soap_pw = $this->ui_factory->input()->field()->text(
745 $new_user = $this->ui_factory->input()->field()
746 ->checkbox(
'new_user');
747 return $this->ui_factory->input()->container()->form()->standard(
754 )->withSubmitLabel($this->
lng->txt(
'send'));
759 if (!$this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
760 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
763 $soap_form = $this->buildSOAPForm(
764 $this->
ctrl->getFormAction($this,
'saveSOAP'),
765 $this->ctrl->getFormAction($this,
'editSOAP')
767 $test_form = $this->buildSOAPTestForm(
768 $this->
ctrl->getFormAction($this,
'testSoapAuthConnection'),
771 $this->tabs_gui->setTabActive(
'auth_soap');
772 $panel = $this->ui_factory->panel()->standard(
'SOAP', [$soap_form, $test_form]);
773 $this->tpl->setContent($this->ui_renderer->render($panel));
778 if (!$this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
779 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
782 $soap_form = $this->buildSOAPForm(
783 $this->
ctrl->getFormAction($this,
'saveSOAP'),
784 $this->ctrl->getFormAction($this,
'editSOAP')
786 $test_form = $this->buildSOAPTestForm(
787 $this->
ctrl->getFormAction($this,
'testSoapAuthConnection')
789 $panel_content = [$soap_form, $test_form];
790 if ($this->request->getMethod() ===
'POST') {
791 $test_form = $test_form->withRequest($this->request);
792 $result = $test_form->getData();
793 if ($result !==
null) {
794 $panel_content[] = $this->ui_factory->legacy()->content(
799 $this->tabs_gui->setTabActive(
'auth_soap');
800 $panel = $this->ui_factory->panel()->standard(
'SOAP', $panel_content);
801 $this->tpl->setContent($this->ui_renderer->render($panel));
806 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
807 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
810 $soap_form = $this->buildSOAPForm(
811 $this->
ctrl->getFormAction($this,
'saveSOAP'),
812 $this->ctrl->getFormAction($this,
'editSOAP')
814 $test_form = $this->buildSOAPTestForm(
815 $this->
ctrl->getFormAction($this,
'testSoapAuthConnection'),
817 if ($this->request->getMethod() ===
'POST') {
818 $soap_form = $soap_form->withRequest($this->request);
819 $result = $soap_form->getData();
820 if ($result !==
null) {
821 $this->
settings->set(
'soap_auth_active', (
string) $result[
'active']);
822 $this->
settings->set(
'soap_auth_server', $result[
'server']);
823 $this->
settings->set(
'soap_auth_port', (
string) $result[
'port']);
824 $this->
settings->set(
'soap_auth_use_https', (
string) $result[
'use_https']);
825 $this->
settings->set(
'soap_auth_uri', $result[
'uri']);
826 $this->
settings->set(
'soap_auth_namespace', $result[
'namespace']);
827 $this->
settings->set(
'soap_auth_use_dotnet', (
string) $result[
'dotnet']);
828 $this->
settings->set(
'soap_auth_create_users', (
string) $result[
'createuser']);
829 $this->
settings->set(
'soap_auth_account_mail', (
string) $result[
'sendmail']);
830 $this->
settings->set(
'soap_auth_user_default_role', (
string) $result[
'defaultrole']);
831 $this->
settings->set(
'soap_auth_allow_local', (
string) $result[
'allowlocal']);
833 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'auth_soap_settings_saved'),
true);
834 $this->
logger->info(
'data' . print_r($result,
true));
835 $this->
ctrl->redirect($this,
'editSOAP');
839 $this->tabs_gui->setTabActive(
'auth_soap');
840 $panel = $this->ui_factory->panel()->standard(
'SOAP', [$soap_form, $test_form]);
841 $this->tpl->setContent($this->ui_renderer->render($panel));
846 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
847 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
850 if ($_SESSION[
'error_post_vars']) {
851 $this->tpl->setVariable(
'AUTH_SCRIPT_NAME', $_SESSION[
'error_post_vars'][
'auth_script'][
'name']);
853 $settings = $this->
ilias->getAllSettings();
855 $this->tpl->setVariable(
'AUTH_SCRIPT_NAME', $settings[
'auth_script_name']);
858 $this->tabs_gui->setTabActive(
'auth_script');
860 $this->tpl->addBlockFile(
863 'tpl.auth_script.html',
864 'components/ILIAS/Authentication'
867 $this->tpl->setVariable(
'FORMACTION', $this->
ctrl->getFormAction($this));
868 $this->tpl->setVariable(
'COLSPAN', 3);
869 $this->tpl->setVariable(
'TXT_AUTH_SCRIPT_TITLE', $this->
lng->txt(
'auth_script_configure'));
870 $this->tpl->setVariable(
'TXT_OPTIONS', $this->
lng->txt(
'options'));
871 $this->tpl->setVariable(
'TXT_AUTH_SCRIPT_NAME', $this->
lng->txt(
'auth_script_name'));
873 $this->tpl->setVariable(
'TXT_REQUIRED_FLD', $this->
lng->txt(
'required_field'));
874 $this->tpl->setVariable(
'TXT_CANCEL', $this->
lng->txt(
'cancel'));
875 $this->tpl->setVariable(
'TXT_SUBMIT', $this->
lng->txt(
'save'));
876 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveScript');
881 if (!
$_POST[
'auth_script'][
'name']) {
882 $this->
ilias->raiseError($this->
lng->txt(
'fill_out_all_required_fields'), $this->ilias->error_obj->MESSAGE);
885 $this->
ilias->setSetting(
'auth_script_name',
$_POST[
'auth_script'][
'name']);
888 $this->tpl->setOnScreenMessage(
890 $this->
lng->txt(
'auth_mode_changed_to') .
' ' . $this->getAuthModeTitle(),
893 $this->
ctrl->redirect($this,
'editScript');
898 return match ((
int) $this->
ilias->getSetting(
'auth_mode')) {
900 ilAuthUtils::AUTH_LDAP => $this->
lng->txt(
'auth_ldap'),
901 ilAuthUtils::AUTH_SHIBBOLETH => $this->
lng->txt(
'auth_shib'),
902 ilAuthUtils::AUTH_SAML => $this->
lng->txt(
'auth_saml'),
904 ilAuthUtils::AUTH_APACHE => $this->
lng->txt(
'auth_apache'),
905 default => $this->
lng->txt(
'unknown'),
911 $next_class = $this->
ctrl->getNextClass($this) ??
'';
912 $cmd = $this->
ctrl->getCmd() ??
'';
913 $this->prepareOutput();
915 if (!$this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
916 $this->
error->raiseError($this->
lng->txt(
'msg_no_perm_read'), $this->error->WARNING);
919 switch ($next_class) {
920 case 'ilopenidconnectsettingsgui':
921 $this->tabs_gui->activateTab(
'auth_oidconnect');
924 $this->
ctrl->forwardCommand($oid);
927 case 'ilsamlsettingsgui':
928 $this->tabs_gui->setTabActive(
'auth_saml');
931 $this->
ctrl->forwardCommand($os);
934 case 'ilregistrationsettingsgui':
935 $this->tabs_gui->setTabActive(
'registration_settings');
938 $this->
ctrl->forwardCommand($registration_gui);
941 case 'ilpermissiongui':
942 $this->tabs_gui->setTabActive(
'perm_settings');
945 $this->
ctrl->forwardCommand($perm_gui);
948 case 'illdapsettingsgui':
949 $this->tabs_gui->setTabActive(
'auth_ldap');
952 $this->
ctrl->forwardCommand($ldap_settings_gui);
955 case 'ilauthshibbolethsettingsgui':
956 $this->tabs_gui->setTabActive(
'auth_shib');
959 $this->
ctrl->forwardCommand($shib_settings_gui);
962 case strtolower(ilAuthPageEditorGUI::class):
963 $this->setSubTabs(
'authSettings');
964 $this->tabs_gui->setTabActive(
'authentication_settings');
965 $this->tabs_gui->setSubTabActive(
'auth_login_editor');
968 $this->
ctrl->forwardCommand($lpe);
971 case strtolower(ilObjectContentStyleSettingsGUI::class):
972 $this->setTitleAndDescription();
973 $this->setSubTabs(
'authSettings');
974 $this->tabs_gui->activateTab(
'authentication_settings');
975 $this->tabs_gui->activateSubTab(
'style');
977 $settings_gui = $this->content_style_gui
978 ->objectSettingsGUIForRefId(
982 $this->
ctrl->forwardCommand($settings_gui);
985 case strtolower(ilAuthLogoutBehaviourGUI::class):
986 $this->setSubTabs(
'authSettings');
987 $this->tabs_gui->setTabActive(
'authentication_settings');
988 $this->tabs_gui->setSubTabActive(
'logout_behaviour');
991 $this->
ctrl->forwardCommand($gui);
996 $cmd =
'authSettings';
1012 $this->
ctrl->setParameter($this,
'ref_id', $this->
object->getRefId());
1014 if ($this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
1015 $this->tabs_gui->addTarget(
1016 'authentication_settings',
1017 $this->
ctrl->getLinkTarget($this,
'authSettings'),
1023 $this->tabs_gui->addTarget(
1024 'registration_settings',
1025 $this->
ctrl->getLinkTargetByClass(
'ilregistrationsettingsgui',
'view')
1028 $this->tabs_gui->addTarget(
1030 $this->
ctrl->getLinkTargetByClass(
'illdapsettingsgui',
'serverList'),
1036 $this->tabs_gui->addTarget(
1038 $this->
ctrl->getLinkTargetByClass(
'ilauthshibbolethsettingsgui',
'settings')
1041 $this->tabs_gui->addTarget(
1043 $this->
ctrl->getLinkTarget($this,
'editSOAP'),
1049 $this->tabs_gui->addTarget(
1050 'apache_auth_settings',
1051 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_APACHE_SETTINGS),
1057 $this->tabs_gui->addTarget(
1065 $this->tabs_gui->addTab(
1067 $this->
lng->txt(
'auth_oidconnect'),
1068 $this->ctrl->getLinkTargetByClass(
'ilopenidconnectsettingsgui')
1072 if ($this->rbac_system->checkAccess(
'edit_permission', $this->object->getRefId())) {
1073 $this->tabs_gui->addTarget(
1075 $this->
ctrl->getLinkTargetByClass([get_class($this),
'ilpermissiongui'],
'perm'),
1076 [
'perm',
'info',
'owner'],
1084 $this->
lng->loadLanguageModule(
'auth');
1086 if ($a_tab ===
'authSettings' && $this->
access->checkAccess(
'read',
'', $this->object->getRefId())) {
1087 $this->tabs_gui->addSubTabTarget(
1089 $this->
ctrl->getLinkTarget($this,
'authSettings'),
1093 foreach (AuthPageEditorContext::cases() as $auth_ipe_context) {
1094 $this->
ctrl->setParameterByClass(
1095 ilAuthPageEditorGUI::class,
1097 $auth_ipe_context->value
1099 $this->tabs_gui->addSubTabTarget(
1100 $auth_ipe_context->tabIdentifier(),
1101 $this->ctrl->getLinkTargetByClass(
1102 ilAuthPageEditorGUI::class,
1106 $this->
ctrl->setParameterByClass(
1107 ilAuthPageEditorGUI::class,
1113 $this->tabs_gui->addSubTabTarget(
1115 $this->
ctrl->getLinkTargetByClass(ilAuthLogoutBehaviourGUI::class,
''),
1119 $this->tabs_gui->addSubTab(
1121 $this->
lng->txt(
'cont_style'),
1122 $this->ctrl->getLinkTargetByClass(ilObjectContentStyleSettingsGUI::class)
1129 $this->tabs_gui->setTabActive(
'apache_auth_settings');
1132 $settings =
new ilSetting(
'apache_auth');
1133 $settingsMap = $settings->getAll();
1136 if (file_exists(
$path) && is_readable(
$path)) {
1137 $settingsMap[
'apache_auth_domains'] = file_get_contents(
$path);
1143 self::CMD_SHOW_APACHE_SETTINGS,
1144 self::CMD_SAVE_APACHE_SETTINGS,
1150 $this->tpl->setContent($this->ui_renderer->render([
1151 $this->ui_factory->item()->standard($this->lng->txt(
'apache_settings')),
1161 self::CMD_SHOW_APACHE_SETTINGS,
1162 self::CMD_SAVE_APACHE_SETTINGS
1163 ))->buildForm()->withRequest($this->
http->request());
1164 if (!$form->getError()) {
1165 $data = $form->getData();
1167 $settings =
new ilSetting(
'apache_auth');
1170 'apache_auth_indicator_name',
1171 'apache_auth_indicator_value',
1172 'apache_enable_auth',
1173 'apache_enable_local',
1174 'apache_local_autocreate',
1175 'apache_enable_ldap',
1176 'apache_auth_username_config_type',
1177 'apache_auth_username_direct_mapping_fieldname',
1178 'apache_default_role',
1179 'apache_auth_target_override_login_page',
1180 'apache_auth_enable_override_login_page',
1181 'apache_auth_authenticate_on_login_page',
1185 foreach ($fields as $field) {
1186 $value = match ($field) {
1187 'apache_enable_auth',
1188 'apache_auth_enable_override_login_page',
1189 'apache_auth_username_config',
1190 'apache_auth_security',
1191 'apache_enable_ldap' => (bool) (
$data[$field] ??
false),
1192 'apache_auth_username_config_type' =>
$data[
'apache_auth_username_config'][$field][0] ?? 1,
1193 'apache_auth_target_override_login_page' =>
$data[
'apache_auth_enable_override_login_page'][$field] ??
'',
1194 'apache_auth_username_direct_mapping_fieldname' =>
$data[
'apache_auth_username_config'][
'apache_auth_username_config_type'][1][$field] ??
'',
1195 'apache_auth_domains' =>
$data[
'apache_auth_security'][$field] ??
'',
1196 'apache_local_autocreate' => (bool) (
$data[
'apache_enable_auth'][$field] ??
false),
1197 'apache_default_role' =>
$data[
'apache_enable_auth'][
'apache_local_autocreate'][$field] ?? 4,
1198 'apache_ldap_sid' =>
$data[
'apache_enable_ldap'][$field] ??
'',
1199 default =>
$data[$field],
1208 if (
$data[$field] ??
false) {
1209 $this->
ilias->setSetting(
'apache_active',
'1');
1211 $this->
ilias->setSetting(
'apache_active',
'0');
1217 $allowed_domains = $this->validateApacheAuthAllowedDomains(
$data[
'apache_auth_security'][
'apache_auth_domains'] ??
'');
1220 $this->tpl->setOnScreenMessage(
1221 $this->tpl::MESSAGE_TYPE_SUCCESS,
1222 $this->
lng->txt(
'apache_settings_changed_success'),
1225 $this->
ctrl->redirect($this, self::CMD_SHOW_APACHE_SETTINGS);
1228 $this->apacheAuthSettingsObject($form);
1233 return implode(
"\n", preg_split(
"/[\r\n]+/",
$text));
1239 $this->
ctrl->redirect($registration_gui);
Facade for consumer gui interface.
@ilCtrl_isCalledBy ilAuthLogoutBehaviourGUI: ilObjAuthSettingsGUI @ilCtrl_Calls ilAuthLogoutBehaviour...
@ilCtrl_isCalledBy ilAuthPageEditorGUI: ilObjAuthSettingsGUI @ilCtrl_Calls ilAuthPageEditorGUI: ilLog...
final const string CONTEXT_HTTP_PARAM
final const string DEFAULT_COMMAND
static testConnection(string $a_ext_uid, string $a_soap_pw, bool $a_new_user)
Class ilAuthShibbolethSettingsGUI.
const int AUTH_SHIBBOLETH
static _getActiveAuthModes()
const int AUTH_OPENID_CONNECT
static _getAllAuthModes()
static _getAuthModeName($a_auth_key)
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
static getServerIdByAuthMode(string $a_auth_mode)
Get auth id by auth mode.
static isAuthModeLDAP(string $a_auth_mode)
Check if user auth mode is LDAP.
Component logger with individual log levels by component id.
@ilCtrl_Calls ilObjAuthSettingsGUI: ilPermissionGUI, ilRegistrationSettingsGUI, ilLDAPSettingsGUI @il...
getAdminTabs()
administration tabs show only permissions and trash folder
GUIService $content_style_gui
const string CMD_SHOW_APACHE_SETTINGS
validateApacheAuthAllowedDomains(string $text)
buildAuthModeDeterminationForm()
updateAuthModeDeterminationObject()
buildSOAPTestForm(string $submit_action)
registrationSettingsObject()
apacheAuthSettingsObject(?StandardForm $form=null)
saveApacheSettingsObject()
const string CMD_SAVE_APACHE_SETTINGS
const string PROP_AUTH_MODE_KIND
const string PROP_AUTH_MODE_SEQUENCE
__construct($a_data, int $a_id, bool $a_call_by_reference, bool $a_prepare_output=true)
buildRegistrationRoleMappingForm()
cancelObject()
cancel action and go back to previous page
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
testSoapAuthConnectionObject()
setSubTabs(string $a_tab)
getTabs()
@abstract overwrite in derived GUI class of your object type
buildSOAPForm(string $submit_action, string $show_action)
updateRegistrationRoleMappingObject()
authSettingsObject(?ILIAS\UI\Component\Input\Container\Form\Form $auth_mode_determination_form=null, ?ILIAS\UI\Component\Input\Container\Form\Form $registration_role_mapping_form=null)
static _updateAuthMode(array $a_roles)
static _lookupRegisterAllowed()
get all roles that are activated in user registration
static _getNumberOfUsersPerAuthMode()
get number of users per auth mode
Class ilObjectGUI Basic methods of all Output classes.
Class ilRegistrationSettingsGUI.
static getIdpIdByAuthMode(string $a_auth_mode)
static isAuthModeSaml(string $a_auth_mode)
static getInstanceByIdpId(int $a_idp_id)
special template class to simplify handling of ITX/PEAR
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static redirect(string $a_script)
if($err=$client->getError()) $namespace
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
Class ilObjForumAdministration.
if(!file_exists('../ilias.ini.php'))