19declare(strict_types=1);
45 public function __construct($a_data,
int $a_id,
bool $a_call_by_reference,
bool $a_prepare_output =
true)
51 $this->
logger = $DIC->logger()->auth();
53 $this->
lng->loadLanguageModule(
'administration');
54 $this->
lng->loadLanguageModule(
'registration');
55 $this->
lng->loadLanguageModule(
'auth');
56 $this->
lng->loadLanguageModule(
'content');
57 $this->content_style_gui =
$DIC->contentStyle()->gui();
66 ?
ILIAS\UI\
Component\Input\Container\Form\Form $auth_mode_determination_form =
null,
67 ?
ILIAS\UI\
Component\Input\Container\Form\Form $registration_role_mapping_form =
null
70 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
73 $this->tabs_gui->setTabActive(
'authentication_settings');
75 $this->tabs_gui->setSubTabActive(
'auth_settings');
77 $generalSettingsTpl =
new ilTemplate(
'tpl.auth_general.html',
true,
true,
'components/ILIAS/Authentication');
79 $generalSettingsTpl->setVariable(
'FORMACTION', $this->
ctrl->getFormAction($this));
81 $generalSettingsTpl->setVariable(
'TXT_AUTH_MODE', $this->
lng->txt(
'auth_mode'));
82 $generalSettingsTpl->setVariable(
'TXT_AUTH_DEFAULT', $this->
lng->txt(
'default'));
83 $generalSettingsTpl->setVariable(
'TXT_AUTH_ACTIVE', $this->
lng->txt(
'active'));
84 $generalSettingsTpl->setVariable(
'TXT_AUTH_NUM_USERS', $this->
lng->txt(
'num_users'));
86 $generalSettingsTpl->setVariable(
'TXT_LOCAL', $this->
lng->txt(
'auth_local'));
87 $generalSettingsTpl->setVariable(
'TXT_LDAP', $this->
lng->txt(
'auth_ldap'));
88 $generalSettingsTpl->setVariable(
'TXT_SHIB', $this->
lng->txt(
'auth_shib'));
90 $generalSettingsTpl->setVariable(
'TXT_SCRIPT', $this->
lng->txt(
'auth_script'));
92 $generalSettingsTpl->setVariable(
'TXT_APACHE', $this->
lng->txt(
'auth_apache'));
105 $icon_ok = $this->ui_renderer->render(
106 $this->ui_factory->symbol()->icon()->custom(
108 $this->lng->txt(
'enabled')
111 $icon_not_ok = $this->ui_renderer->render(
112 $this->ui_factory->symbol()->icon()->custom(
114 $this->lng->txt(
'disabled')
118 $this->
logger->debug(print_r($auth_modes,
true));
120 foreach ($auth_modes as $mode => $mode_name) {
127 $generalSettingsTpl->setCurrentBlock(
'auth_mode');
131 $generalSettingsTpl->setVariable(
'AUTH_NAME',
$server->getName());
132 $generalSettingsTpl->setVariable(
'AUTH_ACTIVE',
$server->isActive() ? $icon_ok : $icon_not_ok);
135 $generalSettingsTpl->setVariable(
'AUTH_NAME', $idp->getEntityId());
136 $generalSettingsTpl->setVariable(
'AUTH_ACTIVE', $idp->isActive() ? $icon_ok : $icon_not_ok);
138 $generalSettingsTpl->setVariable(
'AUTH_NAME', $this->
lng->txt(
'auth_' . $mode_name));
139 $generalSettingsTpl->setVariable(
144 $generalSettingsTpl->setVariable(
'AUTH_NAME', $this->
lng->txt(
'auth_' . $mode_name));
145 $generalSettingsTpl->setVariable(
147 $this->
ilias->getSetting(
148 $mode_name .
'_active'
153 $auth_cnt_mode = $auth_cnt[$mode_name] ?? 0;
154 if ($this->
settings->get(
'auth_mode') === (
string) $mode) {
155 $generalSettingsTpl->setVariable(
'AUTH_CHECKED',
'checked="checked"');
156 $auth_cnt_default = $auth_cnt[
'default'] ?? 0;
157 $generalSettingsTpl->setVariable(
159 ((
int) $auth_cnt_mode + $auth_cnt_default) .
' (' . $this->
lng->txt(
'auth_per_default') .
160 ': ' . $auth_cnt_default .
')'
163 $generalSettingsTpl->setVariable(
168 $generalSettingsTpl->setVariable(
'AUTH_ID', $mode_name);
169 $generalSettingsTpl->setVariable(
'AUTH_VAL', $mode);
172 $generalSettingsTpl->touchBlock(
'DISABLED');
174 $generalSettingsTpl->setCurrentBlock(
'auth_mode');
175 $generalSettingsTpl->parseCurrentBlock();
178 $generalSettingsTpl->setVariable(
'TXT_CONFIGURE', $this->
lng->txt(
'auth_configure'));
180 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
181 $generalSettingsTpl->setVariable(
'TXT_AUTH_REMARK', $this->
lng->txt(
'auth_remark_non_local_auth'));
182 $generalSettingsTpl->setCurrentBlock(
'auth_mode_submit');
183 $generalSettingsTpl->setVariable(
'TXT_SUBMIT', $this->
lng->txt(
'save'));
184 $generalSettingsTpl->setVariable(
'CMD_SUBMIT',
'setAuthMode');
185 $generalSettingsTpl->parseCurrentBlock();
189 $this->ui_factory->panel()->standard(
190 $this->
lng->txt(
'auth_select'),
191 $this->ui_factory->legacy()->content(implode(
'', [
192 $this->ui_renderer->render($this->ui_factory->messageBox()->info(
193 $this->lng->txt(
'auth_mode_default_change_info')
195 $generalSettingsTpl->get()
201 if ($auth_mode_determination_form !==
null) {
202 $page_content[] = $this->ui_factory->panel()->standard(
203 $this->
lng->txt(
'auth_auth_mode_determination'),
204 $auth_mode_determination_form
208 $page_content[] = $this->ui_factory->panel()->standard(
209 $this->
lng->txt(
'auth_active_roles'),
210 $registration_role_mapping_form ?? $this->buildRegistrationRoleMappingForm()
213 $this->tpl->setContent(
214 $this->ui_renderer->render($page_content)
220 $access = $this->rbac_system->checkAccess(
'write', $this->
object->getRefId());
225 $excluded_auth_names = [
'default',
'saml',
'shibboleth',
'ldap',
'lti',
'apache',
'ecs',
'oidc'];
229 $active_auth_modes = array_filter(
231 static function (
string $auth_name) use ($excluded_auth_names):
bool {
232 foreach ($excluded_auth_names as $excluded_auth_name) {
233 if ($auth_name === $excluded_auth_name) {
237 if (str_starts_with($auth_name, $excluded_auth_name)) {
246 foreach ($reg_roles as $role) {
249 foreach ($active_auth_modes as $auth_name => $auth_key) {
250 if ($auth_name ===
'default') {
251 $name = $this->
lng->txt(
'auth_' . $auth_name) .
' (' . $this->
lng->txt(
255 $name = $this->
lng->txt(
'auth_' . $auth_name);
260 if ($role[
'auth_mode'] === $auth_name) {
271 $fields[
'r_' . $role[
'id']] = $this->ui_factory
277 $this->
lng->txt(
'auth_role_auth_mode')
281 ->withDedicatedName(
'r_' . $role[
'id'])
282 ->withDisabled(!$access);
285 $form = $this->ui_factory
291 $this->
ctrl->getFormAction($this,
'updateRegistrationRoleMapping') :
292 $this->ctrl->getFormAction($this,
'authSettings'),
295 ->withDedicatedName(
'registration_role_mapping');
298 $form = $form->withSubmitLabel($this->
lng->txt(
'refresh'));
306 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
307 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
310 $form = $this->buildRegistrationRoleMappingForm();
313 if ($this->
http->request()->getMethod() ===
'POST') {
314 $form = $form->withRequest($this->
http->request());
315 $form_data = $form->getData();
316 $form_valid = $form_data !==
null;
320 $this->tpl->setOnScreenMessage(
321 $this->tpl::MESSAGE_TYPE_FAILURE,
322 $this->
lng->txt(
'err_wrong_login')
324 $this->authSettingsObject(
null, $form);
329 foreach ($form_data as $role_id => $auth_mode) {
330 $f_object[substr($role_id, 2)] = $auth_mode;
334 $this->tpl->setOnScreenMessage(
335 $this->tpl::MESSAGE_TYPE_SUCCESS,
336 $this->
lng->txt(
'auth_mode_roles_changed'),
339 $this->
ctrl->redirect($this,
'authSettings');
345 if ($det->getCountActiveAuthModes() <= 1) {
349 $access = $this->rbac_system->checkAccess(
'write', $this->
object->getRefId());
351 $automatic_options = [];
353 $auth_sequenced = $det->getAuthModeSequence();
354 foreach ($auth_sequenced as $auth_mode) {
356 switch ($auth_mode) {
363 $text = $this->
lng->txt(
'auth_local');
366 $text = $this->
lng->txt(
'auth_soap');
369 $text = $this->
lng->txt(
'auth_apache');
373 $option = $pl->getMultipleAuthModeOptions($auth_mode);
374 $text = $option[$auth_mode][
'txt'];
379 $automatic_options[
'm' . $auth_mode] = $this->ui_factory
383 ->withDedicatedName(
'm' . $auth_mode)
384 ->withValue($counter++)
385 ->withDisabled(!$access);
394 $this->
lng->txt(
'auth_by_user')
397 ->withDisabled(!$access),
403 $this->
lng->txt(
'auth_automatic')
406 ->withDisabled(!$access)
410 self::PROP_AUTH_MODE_KIND => $this->ui_factory
415 $this->
lng->txt(
'auth_kind_determination'),
416 $this->
lng->txt(
'auth_mode_determination_info')
418 ->withDedicatedName(self::PROP_AUTH_MODE_KIND)
419 ->withValue((
string) $det->getKind())
420 ->withDisabled(!$access)
424 $form = $this->ui_factory
430 $this->
ctrl->getFormAction($this,
'updateAuthModeDetermination') :
431 $this->
ctrl->getFormAction($this,
'authSettings'),
434 ->withDedicatedName(
'auth_mode_determination')
435 ->withAdditionalTransformation(
436 $this->
refinery->custom()->transformation(
function ($value): array {
440 $sequence = (array) ($value[self::PROP_AUTH_MODE_KIND][1] ?? []);
443 $merged_values = array_merge(
445 self::PROP_AUTH_MODE_KIND => $auth_mode_kind,
448 self::PROP_AUTH_MODE_SEQUENCE => $sequence
452 return $merged_values;
457 $form = $form->withSubmitLabel($this->
lng->txt(
'refresh'));
465 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
466 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
469 $form = $this->buildAuthModeDeterminationForm();
470 if ($form ===
null) {
471 $this->authSettingsObject();
477 if ($this->
http->request()->getMethod() ===
'POST') {
478 $form = $form->withRequest($this->
http->request());
479 $form_data = $form->getData();
480 $form_valid = $form_data !==
null;
484 $this->tpl->setOnScreenMessage(
485 $this->tpl::MESSAGE_TYPE_FAILURE,
486 $this->
lng->txt(
'err_wrong_login')
488 $this->authSettingsObject($form);
493 $kind = (
int) $form_data[self::PROP_AUTH_MODE_KIND];
494 $det->setKind($kind);
496 $sequence = $form_data[self::PROP_AUTH_MODE_SEQUENCE];
497 $this->
logger->debug(
'pos mode:' . print_r($sequence,
true));
498 asort($sequence, SORT_NUMERIC);
499 $this->
logger->debug(
'pos mode:' . print_r($sequence,
true));
502 foreach (array_keys($sequence) as $auth_mode) {
503 $position[$counter++] = substr($auth_mode, 1);
505 $this->
logger->debug(
'position mode:' . print_r($position,
true));
506 $det->setAuthModeSequence($position);
510 $this->tpl->setOnScreenMessage(
511 $this->tpl::MESSAGE_TYPE_SUCCESS,
512 $this->
lng->txt(
'settings_saved'),
515 $this->
ctrl->redirect($this,
'authSettings');
520 $this->
ctrl->redirect($this,
'authSettings');
525 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
526 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
528 $this->
logger->debug(
'auth mode available:' . $this->request_wrapper->has(
'auth_mode'));
530 if (!$this->
http->wrapper()->post()->has(
'auth_mode')) {
531 $this->
ilias->raiseError($this->
lng->txt(
'auth_err_no_mode_selected'), $this->ilias->error_obj->MESSAGE);
533 $new_auth_mode = $this->
http->wrapper()->post()->retrieve(
'auth_mode', $this->
refinery->to()->string());
534 $this->
logger->debug(
'auth mode:' . $new_auth_mode);
535 $current_auth_mode = $this->
settings->get(
'auth_mode',
'');
536 if ($new_auth_mode === $current_auth_mode) {
537 $this->tpl->setOnScreenMessage(
539 $this->
lng->txt(
'auth_mode') .
': ' . $this->getAuthModeTitle() .
' ' . $this->lng->txt(
540 'auth_mode_not_changed'
544 $this->
ctrl->redirect($this,
'authSettings');
547 switch ((
int) $new_auth_mode) {
553 if ($this->
object->checkAuthSHIB() !==
true) {
554 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'auth_shib_not_configured'),
true);
556 $this->getReturnLocation(
558 $this->
ctrl->getLinkTargetByClass(
559 ilAuthShibbolethSettingsGUI::class,
571 if ($this->
object->checkAuthScript() !==
true) {
572 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'auth_script_not_configured'),
true);
574 $this->getReturnLocation(
576 $this->
ctrl->getLinkTarget($this,
'editScript',
'',
false,
false)
583 $this->
ilias->setSetting(
'auth_mode', $new_auth_mode);
585 $this->tpl->setOnScreenMessage(
587 $this->
lng->txt(
'auth_default_mode_changed_to') .
' ' . $this->getAuthModeTitle(),
590 $this->
ctrl->redirect($this,
'authSettings');
594 string $submit_action,
597 $role_list = $this->rbac_review->getRolesByFilter(2, $this->
object->
getId());
600 foreach ($role_list as $role) {
601 $roles[$role[
'obj_id']] = $role[
'title'];
604 $active = $this->ui_factory
607 ->checkbox($this->
lng->txt(
'active'))
608 ->withValue((
bool) $this->
settings->get(
'soap_auth_active',
''));
614 $this->
lng->txt(
'server'),
615 $this->lng->txt(
'auth_soap_server_desc')
619 ->withValue($this->
settings->get(
'soap_auth_server',
''));
621 $port = $this->ui_factory
625 $this->
lng->txt(
'port'),
626 $this->lng->txt(
'auth_soap_port_desc')
628 ->withAdditionalTransformation($this->
refinery->int()->isGreaterThan(0))
629 ->withAdditionalTransformation(
630 $this->
refinery->int()->isLessThan(65536)
632 ->withValue((
int) $this->
settings->get(
'soap_auth_port',
'0'));
634 $use_https = $this->ui_factory
637 ->checkbox($this->
lng->txt(
'auth_soap_use_https'))
638 ->withValue((
bool) $this->
settings->get(
'soap_auth_use_https',
''));
640 $uri = $this->ui_factory
644 $this->
lng->txt(
'uri'),
645 $this->lng->txt(
'auth_soap_uri_desc')
648 ->withValue($this->
settings->get(
'soap_auth_uri',
''));
650 $namespace = $this->ui_factory
654 $this->
lng->txt(
'auth_soap_namespace'),
655 $this->lng->txt(
'auth_soap_namespace_desc')
658 ->withValue($this->
settings->get(
'soap_auth_namespace',
''));
660 $dotnet = $this->ui_factory
663 ->checkbox($this->
lng->txt(
'auth_soap_use_dotnet'))
664 ->withValue((
bool) $this->
settings->get(
'soap_auth_use_dotnet',
''));
666 $createuser = $this->ui_factory
670 $this->
lng->txt(
'auth_create_users'),
671 $this->lng->txt(
'auth_soap_create_users_desc')
673 ->withValue((
bool) $this->
settings->get(
'soap_auth_create_users',
''));
675 $sendmail = $this->ui_factory
679 $this->
lng->txt(
'user_send_new_account_mail'),
680 $this->lng->txt(
'auth_new_account_mail_desc')
682 ->withValue((
bool) $this->
settings->get(
'soap_auth_account_mail',
''));
684 $defaultrole = $this->ui_factory
688 $this->
lng->txt(
'auth_user_default_role'),
690 $this->lng->txt(
'auth_soap_user_default_role_desc')
692 ->withValue($this->
settings->get(
'soap_auth_user_default_role',
'4'))
693 ->withAdditionalTransformation($this->
refinery->int()->isGreaterThan(0));
695 $allowlocal = $this->ui_factory
699 $this->
lng->txt(
'auth_allow_local'),
700 $this->lng->txt(
'auth_soap_allow_local_desc')
702 ->withValue((
bool) $this->
settings->get(
'soap_auth_user_default_role',
''));
704 $access = $this->rbac_system->checkAccess(
'write', $this->
object->getRefId());
709 'use_https' => $use_https,
711 'namespace' => $namespace,
713 'createuser' => $createuser,
714 'sendmail' => $sendmail,
715 'defaultrole' => $defaultrole,
716 'allowlocal' => $allowlocal
720 foreach (
$inputs as $key => $input) {
721 $inputs[$key] = $input->withDisabled(
true);
725 $form = $this->ui_factory->input()->container()->form()->standard(
726 $access ? $submit_action : $show_action,
731 $form = $form->withSubmitLabel($this->
lng->txt(
'refresh'));
738 string $submit_action
740 $ext_uid = $this->ui_factory->input()->field()->text(
743 $soap_pw = $this->ui_factory->input()->field()->text(
746 $new_user = $this->ui_factory->input()->field()
747 ->checkbox(
'new_user');
748 return $this->ui_factory->input()->container()->form()->standard(
755 )->withSubmitLabel($this->
lng->txt(
'send'));
760 if (!$this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
761 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
764 $soap_form = $this->buildSOAPForm(
765 $this->
ctrl->getFormAction($this,
'saveSOAP'),
766 $this->ctrl->getFormAction($this,
'editSOAP')
768 $test_form = $this->buildSOAPTestForm(
769 $this->
ctrl->getFormAction($this,
'testSoapAuthConnection'),
772 $this->tabs_gui->setTabActive(
'auth_soap');
773 $panel = $this->ui_factory->panel()->standard(
'SOAP', [$soap_form, $test_form]);
774 $this->tpl->setContent($this->ui_renderer->render($panel));
779 if (!$this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
780 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
783 $soap_form = $this->buildSOAPForm(
784 $this->
ctrl->getFormAction($this,
'saveSOAP'),
785 $this->ctrl->getFormAction($this,
'editSOAP')
787 $test_form = $this->buildSOAPTestForm(
788 $this->
ctrl->getFormAction($this,
'testSoapAuthConnection')
790 $panel_content = [$soap_form, $test_form];
791 if ($this->request->getMethod() ===
'POST') {
792 $test_form = $test_form->withRequest($this->request);
793 $result = $test_form->getData();
794 if ($result !==
null) {
795 $panel_content = array_merge(
805 $this->tabs_gui->setTabActive(
'auth_soap');
806 $panel = $this->ui_factory->panel()->standard(
'SOAP', $panel_content);
807 $this->tpl->setContent($this->ui_renderer->render($panel));
812 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
813 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
816 $soap_form = $this->buildSOAPForm(
817 $this->
ctrl->getFormAction($this,
'saveSOAP'),
818 $this->ctrl->getFormAction($this,
'editSOAP')
820 $test_form = $this->buildSOAPTestForm(
821 $this->
ctrl->getFormAction($this,
'testSoapAuthConnection'),
823 if ($this->request->getMethod() ===
'POST') {
824 $soap_form = $soap_form->withRequest($this->request);
825 $result = $soap_form->getData();
826 if ($result !==
null) {
827 $this->
settings->set(
'soap_auth_active', (
string) $result[
'active']);
828 $this->
settings->set(
'soap_auth_server', $result[
'server']);
829 $this->
settings->set(
'soap_auth_port', (
string) $result[
'port']);
830 $this->
settings->set(
'soap_auth_use_https', (
string) $result[
'use_https']);
831 $this->
settings->set(
'soap_auth_uri', $result[
'uri']);
832 $this->
settings->set(
'soap_auth_namespace', $result[
'namespace']);
833 $this->
settings->set(
'soap_auth_use_dotnet', (
string) $result[
'dotnet']);
834 $this->
settings->set(
'soap_auth_create_users', (
string) $result[
'createuser']);
835 $this->
settings->set(
'soap_auth_account_mail', (
string) $result[
'sendmail']);
836 $this->
settings->set(
'soap_auth_user_default_role', (
string) $result[
'defaultrole']);
837 $this->
settings->set(
'soap_auth_allow_local', (
string) $result[
'allowlocal']);
839 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'auth_soap_settings_saved'),
true);
840 $this->
logger->info(
'data' . print_r($result,
true));
841 $this->
ctrl->redirect($this,
'editSOAP');
845 $this->tabs_gui->setTabActive(
'auth_soap');
846 $panel = $this->ui_factory->panel()->standard(
'SOAP', [$soap_form, $test_form]);
847 $this->tpl->setContent($this->ui_renderer->render($panel));
852 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
853 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
856 if ($_SESSION[
'error_post_vars']) {
857 $this->tpl->setVariable(
'AUTH_SCRIPT_NAME', $_SESSION[
'error_post_vars'][
'auth_script'][
'name']);
861 $this->tpl->setVariable(
'AUTH_SCRIPT_NAME',
$settings[
'auth_script_name']);
864 $this->tabs_gui->setTabActive(
'auth_script');
866 $this->tpl->addBlockFile(
869 'tpl.auth_script.html',
870 'components/ILIAS/Authentication'
873 $this->tpl->setVariable(
'FORMACTION', $this->
ctrl->getFormAction($this));
874 $this->tpl->setVariable(
'COLSPAN', 3);
875 $this->tpl->setVariable(
'TXT_AUTH_SCRIPT_TITLE', $this->
lng->txt(
'auth_script_configure'));
876 $this->tpl->setVariable(
'TXT_OPTIONS', $this->
lng->txt(
'options'));
877 $this->tpl->setVariable(
'TXT_AUTH_SCRIPT_NAME', $this->
lng->txt(
'auth_script_name'));
879 $this->tpl->setVariable(
'TXT_REQUIRED_FLD', $this->
lng->txt(
'required_field'));
880 $this->tpl->setVariable(
'TXT_CANCEL', $this->
lng->txt(
'cancel'));
881 $this->tpl->setVariable(
'TXT_SUBMIT', $this->
lng->txt(
'save'));
882 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveScript');
887 if (!
$_POST[
'auth_script'][
'name']) {
888 $this->
ilias->raiseError($this->
lng->txt(
'fill_out_all_required_fields'), $this->ilias->error_obj->MESSAGE);
891 $this->
ilias->setSetting(
'auth_script_name',
$_POST[
'auth_script'][
'name']);
894 $this->tpl->setOnScreenMessage(
896 $this->
lng->txt(
'auth_mode_changed_to') .
' ' . $this->getAuthModeTitle(),
899 $this->
ctrl->redirect($this,
'editScript');
904 return match ((
int) $this->
ilias->getSetting(
'auth_mode')) {
906 ilAuthUtils::AUTH_LDAP => $this->
lng->txt(
'auth_ldap'),
907 ilAuthUtils::AUTH_SHIBBOLETH => $this->
lng->txt(
'auth_shib'),
908 ilAuthUtils::AUTH_SAML => $this->
lng->txt(
'auth_saml'),
910 ilAuthUtils::AUTH_APACHE => $this->
lng->txt(
'auth_apache'),
911 default => $this->
lng->txt(
'unknown'),
917 $next_class = $this->
ctrl->getNextClass($this) ??
'';
918 $cmd = $this->
ctrl->getCmd() ??
'';
919 $this->prepareOutput();
921 if (!$this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
922 $this->error->raiseError($this->
lng->txt(
'msg_no_perm_read'), $this->error->WARNING);
925 switch ($next_class) {
926 case 'ilopenidconnectsettingsgui':
927 $this->tabs_gui->activateTab(
'auth_oidconnect');
930 $this->
ctrl->forwardCommand($oid);
933 case 'ilsamlsettingsgui':
934 $this->tabs_gui->setTabActive(
'auth_saml');
937 $this->
ctrl->forwardCommand($os);
940 case 'ilregistrationsettingsgui':
941 $this->tabs_gui->setTabActive(
'registration_settings');
944 $this->
ctrl->forwardCommand($registration_gui);
947 case 'ilpermissiongui':
948 $this->tabs_gui->setTabActive(
'perm_settings');
951 $this->
ctrl->forwardCommand($perm_gui);
954 case 'illdapsettingsgui':
955 $this->tabs_gui->setTabActive(
'auth_ldap');
958 $this->
ctrl->forwardCommand($ldap_settings_gui);
961 case 'ilauthshibbolethsettingsgui':
962 $this->tabs_gui->setTabActive(
'auth_shib');
965 $this->
ctrl->forwardCommand($shib_settings_gui);
968 case strtolower(ilAuthPageEditorGUI::class):
969 $this->setSubTabs(
'authSettings');
970 $this->tabs_gui->setTabActive(
'authentication_settings');
971 $this->tabs_gui->setSubTabActive(
'auth_login_editor');
974 $this->
ctrl->forwardCommand($lpe);
977 case strtolower(ilObjectContentStyleSettingsGUI::class):
978 $this->checkPermission(
'write');
979 $this->setTitleAndDescription();
980 $this->setSubTabs(
'authSettings');
981 $this->tabs_gui->activateTab(
'authentication_settings');
982 $this->tabs_gui->activateSubTab(
'style');
984 $settings_gui = $this->content_style_gui
985 ->objectSettingsGUIForRefId(
989 $this->
ctrl->forwardCommand($settings_gui);
992 case strtolower(ilAuthLogoutBehaviourGUI::class):
993 $this->setSubTabs(
'authSettings');
994 $this->tabs_gui->setTabActive(
'authentication_settings');
995 $this->tabs_gui->setSubTabActive(
'logout_behaviour');
998 $this->
ctrl->forwardCommand($gui);
1003 $cmd =
'authSettings';
1019 $this->
ctrl->setParameter($this,
'ref_id', $this->
object->getRefId());
1021 if ($this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
1022 $this->tabs_gui->addTarget(
1023 'authentication_settings',
1024 $this->
ctrl->getLinkTarget($this,
'authSettings'),
1030 $this->tabs_gui->addTarget(
1031 'registration_settings',
1032 $this->
ctrl->getLinkTargetByClass(
'ilregistrationsettingsgui',
'view')
1035 $this->tabs_gui->addTarget(
1037 $this->
ctrl->getLinkTargetByClass(
'illdapsettingsgui',
'serverList'),
1043 $this->tabs_gui->addTarget(
1045 $this->
ctrl->getLinkTargetByClass(
'ilauthshibbolethsettingsgui',
'settings')
1048 $this->tabs_gui->addTarget(
1050 $this->
ctrl->getLinkTarget($this,
'editSOAP'),
1056 $this->tabs_gui->addTarget(
1057 'apache_auth_settings',
1058 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_APACHE_SETTINGS),
1064 $this->tabs_gui->addTarget(
1072 $this->tabs_gui->addTab(
1074 $this->
lng->txt(
'auth_oidconnect'),
1075 $this->ctrl->getLinkTargetByClass(
'ilopenidconnectsettingsgui')
1079 if ($this->rbac_system->checkAccess(
'edit_permission', $this->object->getRefId())) {
1080 $this->tabs_gui->addTarget(
1082 $this->
ctrl->getLinkTargetByClass([get_class($this),
'ilpermissiongui'],
'perm'),
1083 [
'perm',
'info',
'owner'],
1091 $this->
lng->loadLanguageModule(
'auth');
1093 if ($a_tab ===
'authSettings' && $this->
access->checkAccess(
'read',
'', $this->object->getRefId())) {
1094 $this->tabs_gui->addSubTabTarget(
1096 $this->
ctrl->getLinkTarget($this,
'authSettings'),
1100 foreach (AuthPageEditorContext::cases() as $auth_ipe_context) {
1101 $this->
ctrl->setParameterByClass(
1102 ilAuthPageEditorGUI::class,
1104 $auth_ipe_context->value
1106 $this->tabs_gui->addSubTabTarget(
1107 $auth_ipe_context->tabIdentifier(),
1108 $this->ctrl->getLinkTargetByClass(
1109 ilAuthPageEditorGUI::class,
1113 $this->
ctrl->setParameterByClass(
1114 ilAuthPageEditorGUI::class,
1120 $this->tabs_gui->addSubTabTarget(
1122 $this->
ctrl->getLinkTargetByClass(ilAuthLogoutBehaviourGUI::class,
''),
1126 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1127 $this->tabs_gui->addSubTab(
1129 $this->
lng->txt(
'cont_style'),
1130 $this->ctrl->getLinkTargetByClass(ilObjectContentStyleSettingsGUI::class)
1138 $this->tabs_gui->setTabActive(
'apache_auth_settings');
1145 if (file_exists($path) && is_readable($path)) {
1146 $settingsMap[
'apache_auth_domains'] = file_get_contents($path);
1152 self::CMD_SHOW_APACHE_SETTINGS,
1153 self::CMD_SAVE_APACHE_SETTINGS,
1159 $this->tpl->setContent($this->ui_renderer->render([
1160 $this->ui_factory->item()->standard($this->lng->txt(
'apache_settings')),
1167 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
1168 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
1174 self::CMD_SHOW_APACHE_SETTINGS,
1175 self::CMD_SAVE_APACHE_SETTINGS
1176 ))->buildForm()->withRequest($this->
http->request());
1177 if (!$form->getError()) {
1178 $data = $form->getData();
1183 'apache_auth_indicator_name',
1184 'apache_auth_indicator_value',
1185 'apache_enable_auth',
1186 'apache_enable_local',
1187 'apache_local_autocreate',
1188 'apache_enable_ldap',
1189 'apache_auth_username_config_type',
1190 'apache_auth_username_direct_mapping_fieldname',
1191 'apache_default_role',
1192 'apache_auth_target_override_login_page',
1193 'apache_auth_enable_override_login_page',
1194 'apache_auth_authenticate_on_login_page',
1198 foreach ($fields as $field) {
1199 $value = match ($field) {
1200 'apache_enable_auth',
1201 'apache_auth_enable_override_login_page',
1202 'apache_auth_username_config',
1203 'apache_auth_security',
1204 'apache_enable_ldap' => (bool) (
$data[$field] ??
false),
1205 'apache_auth_username_config_type' =>
$data[
'apache_auth_username_config'][$field][0] ?? 1,
1206 'apache_auth_target_override_login_page' =>
$data[
'apache_auth_enable_override_login_page'][$field] ??
'',
1207 'apache_auth_username_direct_mapping_fieldname' =>
$data[
'apache_auth_username_config'][
'apache_auth_username_config_type'][1][$field] ??
'',
1208 'apache_auth_domains' =>
$data[
'apache_auth_security'][$field] ??
'',
1209 'apache_local_autocreate' => (bool) (
$data[
'apache_enable_auth'][$field] ??
false),
1210 'apache_default_role' =>
$data[
'apache_enable_auth'][
'apache_local_autocreate'][$field] ?? 4,
1211 'apache_ldap_sid' =>
$data[
'apache_enable_ldap'][$field] ??
'',
1212 default =>
$data[$field],
1221 if (
$data[$field] ??
false) {
1222 $this->
ilias->setSetting(
'apache_active',
'1');
1224 $this->
ilias->setSetting(
'apache_active',
'0');
1230 $allowed_domains = $this->validateApacheAuthAllowedDomains(
$data[
'apache_auth_security'][
'apache_auth_domains'] ??
'');
1233 $this->tpl->setOnScreenMessage(
1234 $this->tpl::MESSAGE_TYPE_SUCCESS,
1235 $this->
lng->txt(
'apache_settings_changed_success'),
1238 $this->
ctrl->redirect($this, self::CMD_SHOW_APACHE_SETTINGS);
1241 $this->apacheAuthSettingsObject($form);
1246 return implode(
"\n", preg_split(
"/[\r\n]+/",
$text));
1252 $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
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)
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'))