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(
'registration');
53 $this->
lng->loadLanguageModule(
'auth');
54 $this->
lng->loadLanguageModule(
'content');
55 $this->content_style_gui =
$DIC->contentStyle()->gui();
64 ?
ILIAS\UI\
Component\Input\Container\Form\Form $auth_mode_determination_form =
null,
65 ?
ILIAS\UI\
Component\Input\Container\Form\Form $registration_role_mapping_form =
null
67 if (!$this->rbac_system->checkAccess(
'visible,read', $this->
object->
getRefId())) {
68 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
71 $this->tabs_gui->setTabActive(
'authentication_settings');
73 $this->tabs_gui->setSubTabActive(
'auth_settings');
75 $generalSettingsTpl =
new ilTemplate(
'tpl.auth_general.html',
true,
true,
'components/ILIAS/Authentication');
77 $generalSettingsTpl->setVariable(
'FORMACTION', $this->
ctrl->getFormAction($this));
79 $generalSettingsTpl->setVariable(
'TXT_AUTH_MODE', $this->
lng->txt(
'auth_mode'));
80 $generalSettingsTpl->setVariable(
'TXT_AUTH_DEFAULT', $this->
lng->txt(
'default'));
81 $generalSettingsTpl->setVariable(
'TXT_AUTH_ACTIVE', $this->
lng->txt(
'active'));
82 $generalSettingsTpl->setVariable(
'TXT_AUTH_NUM_USERS', $this->
lng->txt(
'num_users'));
84 $generalSettingsTpl->setVariable(
'TXT_LOCAL', $this->
lng->txt(
'auth_local'));
85 $generalSettingsTpl->setVariable(
'TXT_LDAP', $this->
lng->txt(
'auth_ldap'));
86 $generalSettingsTpl->setVariable(
'TXT_SHIB', $this->
lng->txt(
'auth_shib'));
88 $generalSettingsTpl->setVariable(
'TXT_SCRIPT', $this->
lng->txt(
'auth_script'));
90 $generalSettingsTpl->setVariable(
'TXT_APACHE', $this->
lng->txt(
'auth_apache'));
103 $icon_ok = $this->ui_renderer->render(
104 $this->ui_factory->symbol()->icon()->custom(
106 $this->lng->txt(
'enabled')
109 $icon_not_ok = $this->ui_renderer->render(
110 $this->ui_factory->symbol()->icon()->custom(
112 $this->lng->txt(
'disabled')
116 $this->
logger->debug(print_r($auth_modes,
true));
117 foreach ($auth_modes as $mode => $mode_name) {
124 $generalSettingsTpl->setCurrentBlock(
'auth_mode');
128 $generalSettingsTpl->setVariable(
'AUTH_NAME',
$server->getName());
129 $generalSettingsTpl->setVariable(
'AUTH_ACTIVE',
$server->isActive() ? $icon_ok : $icon_not_ok);
132 $generalSettingsTpl->setVariable(
'AUTH_NAME', $idp->getEntityId());
133 $generalSettingsTpl->setVariable(
'AUTH_ACTIVE', $idp->isActive() ? $icon_ok : $icon_not_ok);
135 $generalSettingsTpl->setVariable(
'AUTH_NAME', $this->
lng->txt(
'auth_' . $mode_name));
136 $generalSettingsTpl->setVariable(
141 $generalSettingsTpl->setVariable(
'AUTH_NAME', $this->
lng->txt(
'auth_' . $mode_name));
142 $generalSettingsTpl->setVariable(
144 $this->
ilias->getSetting(
145 $mode_name .
'_active'
150 $auth_cnt_mode = $auth_cnt[$mode_name] ?? 0;
151 if ($this->
settings->get(
'auth_mode') === (
string) $mode) {
152 $generalSettingsTpl->setVariable(
'AUTH_CHECKED',
'checked="checked"');
153 $auth_cnt_default = $auth_cnt[
'default'] ?? 0;
154 $generalSettingsTpl->setVariable(
156 ((
int) $auth_cnt_mode + $auth_cnt_default) .
' (' . $this->
lng->txt(
'auth_per_default') .
157 ': ' . $auth_cnt_default .
')'
160 $generalSettingsTpl->setVariable(
165 $generalSettingsTpl->setVariable(
'AUTH_ID', $mode_name);
166 $generalSettingsTpl->setVariable(
'AUTH_VAL', $mode);
167 $generalSettingsTpl->parseCurrentBlock();
170 $generalSettingsTpl->setVariable(
'TXT_CONFIGURE', $this->
lng->txt(
'auth_configure'));
172 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
173 $generalSettingsTpl->setVariable(
'TXT_AUTH_REMARK', $this->
lng->txt(
'auth_remark_non_local_auth'));
174 $generalSettingsTpl->setCurrentBlock(
'auth_mode_submit');
175 $generalSettingsTpl->setVariable(
'TXT_SUBMIT', $this->
lng->txt(
'save'));
176 $generalSettingsTpl->setVariable(
'CMD_SUBMIT',
'setAuthMode');
177 $generalSettingsTpl->parseCurrentBlock();
181 $this->ui_factory->panel()->standard(
182 $this->
lng->txt(
'auth_select'),
183 $this->ui_factory->legacy()->content(implode(
'', [
184 $this->ui_renderer->render($this->ui_factory->messageBox()->info(
185 $this->lng->txt(
'auth_mode_default_change_info')
187 $generalSettingsTpl->get()
193 if ($auth_mode_determination_form !==
null) {
194 $page_content[] = $this->ui_factory->panel()->standard(
195 $this->
lng->txt(
'auth_auth_mode_determination'),
196 $auth_mode_determination_form
200 $page_content[] = $this->ui_factory->panel()->standard(
201 $this->
lng->txt(
'auth_active_roles'),
202 $registration_role_mapping_form ?? $this->buildRegistrationRoleMappingForm()
205 $this->tpl->setContent(
206 $this->ui_renderer->render($page_content)
212 $disabled_fields = !$this->rbac_system->checkAccess(
'write', $this->
object->getRefId());
217 $excluded_auth_names = [
'default',
'saml',
'shibboleth',
'ldap',
'apache',
'ecs',
'openid'];
221 $active_auth_modes = array_filter(
223 static fn(
string $auth_name):
bool => in_array($auth_name, $excluded_auth_names,
true),
227 foreach ($reg_roles as $role) {
230 foreach ($active_auth_modes as $auth_name => $auth_key) {
231 if ($auth_name ===
'default') {
232 $name = $this->
lng->txt(
'auth_' . $auth_name) .
' (' . $this->
lng->txt(
240 $name = $idp->getEntityId();
242 $name = $this->
lng->txt(
'auth_' . $auth_name);
245 $options[$auth_name] = $name;
247 if ($role[
'auth_mode'] === $auth_name) {
252 if ($options === []) {
258 $fields[
'r_' . $role[
'id']] = $this->ui_factory
264 $this->
lng->txt(
'auth_role_auth_mode')
268 ->withDedicatedName(
'r_' . $role[
'id'])
269 ->withDisabled($disabled_fields);
272 return $this->ui_factory
276 ->standard($this->
ctrl->getFormAction($this,
'updateRegistrationRoleMapping'), $fields)
277 ->withDedicatedName(
'registration_role_mapping');
282 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
283 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
286 $form = $this->buildRegistrationRoleMappingForm();
289 if ($this->
http->request()->getMethod() ===
'POST') {
290 $form = $form->withRequest($this->
http->request());
291 $form_data = $form->getData();
292 $form_valid = $form_data !==
null;
296 $this->tpl->setOnScreenMessage(
297 $this->tpl::MESSAGE_TYPE_FAILURE,
298 $this->
lng->txt(
'err_wrong_login')
300 $this->authSettingsObject(
null, $form);
305 foreach ($form_data as $role_id => $auth_mode) {
306 $f_object[substr($role_id, 2)] = $auth_mode;
310 $this->tpl->setOnScreenMessage(
311 $this->tpl::MESSAGE_TYPE_SUCCESS,
312 $this->
lng->txt(
'auth_mode_roles_changed'),
315 $this->
ctrl->redirect($this,
'authSettings');
321 if ($det->getCountActiveAuthModes() <= 1) {
325 $disabled_fields = !$this->rbac_system->checkAccess(
'write', $this->
object->getRefId());
327 $automatic_options = [];
329 $auth_sequenced = $det->getAuthModeSequence();
330 foreach ($auth_sequenced as $auth_mode) {
332 switch ($auth_mode) {
339 $text = $this->
lng->txt(
'auth_local');
342 $text = $this->
lng->txt(
'auth_soap');
345 $text = $this->
lng->txt(
'auth_apache');
349 $option = $pl->getMultipleAuthModeOptions($auth_mode);
350 $text = $option[$auth_mode][
'txt'];
355 $automatic_options[
'm' . $auth_mode] = $this->ui_factory
359 ->withDedicatedName(
'm' . $auth_mode)
361 ->withDisabled($disabled_fields);
370 $this->
lng->txt(
'auth_by_user')
373 ->withDisabled($disabled_fields),
379 $this->
lng->txt(
'auth_automatic')
382 ->withDisabled($disabled_fields)
386 self::PROP_AUTH_MODE_KIND => $this->ui_factory
391 $this->
lng->txt(
'auth_kind_determination'),
392 $this->
lng->txt(
'auth_mode_determination_info')
394 ->withDedicatedName(self::PROP_AUTH_MODE_KIND)
395 ->withValue((
string) $det->getKind())
396 ->withDisabled($disabled_fields)
400 return $this->ui_factory
404 ->standard($this->
ctrl->getFormAction($this,
'updateAuthModeDetermination'), $sections)
405 ->withDedicatedName(
'auth_mode_determination')
406 ->withAdditionalTransformation(
407 $this->
refinery->custom()->transformation(
function ($value): array {
411 $sequence = (array) ($value[self::PROP_AUTH_MODE_KIND][1] ?? []);
414 $merged_values = array_merge(
416 self::PROP_AUTH_MODE_KIND => $auth_mode_kind,
419 self::PROP_AUTH_MODE_SEQUENCE => $sequence
423 return $merged_values;
430 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
431 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
434 $form = $this->buildAuthModeDeterminationForm();
435 if ($form ===
null) {
436 $this->authSettingsObject();
442 if ($this->
http->request()->getMethod() ===
'POST') {
443 $form = $form->withRequest($this->
http->request());
444 $form_data = $form->getData();
445 $form_valid = $form_data !==
null;
449 $this->tpl->setOnScreenMessage(
450 $this->tpl::MESSAGE_TYPE_FAILURE,
451 $this->
lng->txt(
'err_wrong_login')
453 $this->authSettingsObject($form);
458 $kind = (
int) $form_data[self::PROP_AUTH_MODE_KIND];
459 $det->setKind($kind);
461 $sequence = $form_data[self::PROP_AUTH_MODE_SEQUENCE];
462 $this->
logger->debug(
'pos mode:' . print_r($sequence,
true));
463 asort($sequence, SORT_NUMERIC);
464 $this->
logger->debug(
'pos mode:' . print_r($sequence,
true));
467 foreach (array_keys($sequence) as $auth_mode) {
468 $position[
$counter++] = substr($auth_mode, 1);
470 $this->
logger->debug(
'position mode:' . print_r($position,
true));
471 $det->setAuthModeSequence($position);
475 $this->tpl->setOnScreenMessage(
476 $this->tpl::MESSAGE_TYPE_SUCCESS,
477 $this->
lng->txt(
'settings_saved'),
480 $this->
ctrl->redirect($this,
'authSettings');
485 $this->
ctrl->redirect($this,
'authSettings');
490 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
491 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
493 $this->
logger->debug(
'auth mode available:' . $this->request_wrapper->has(
'auth_mode'));
495 if (!$this->
http->wrapper()->post()->has(
'auth_mode')) {
496 $this->
ilias->raiseError($this->
lng->txt(
'auth_err_no_mode_selected'), $this->ilias->error_obj->MESSAGE);
498 $new_auth_mode = $this->
http->wrapper()->post()->retrieve(
'auth_mode', $this->
refinery->to()->string());
499 $this->
logger->debug(
'auth mode:' . $new_auth_mode);
500 $current_auth_mode = $this->
settings->get(
'auth_mode',
'');
501 if ($new_auth_mode === $current_auth_mode) {
502 $this->tpl->setOnScreenMessage(
504 $this->
lng->txt(
'auth_mode') .
': ' . $this->getAuthModeTitle() .
' ' . $this->lng->txt(
505 'auth_mode_not_changed'
509 $this->
ctrl->redirect($this,
'authSettings');
512 switch ((
int) $new_auth_mode) {
518 if ($this->
object->checkAuthSHIB() !==
true) {
519 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'auth_shib_not_configured'),
true);
521 $this->getReturnLocation(
523 $this->
ctrl->getLinkTargetByClass(
524 ilAuthShibbolethSettingsGUI::class,
536 if ($this->
object->checkAuthScript() !==
true) {
537 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'auth_script_not_configured'),
true);
539 $this->getReturnLocation(
541 $this->
ctrl->getLinkTarget($this,
'editScript',
'',
false,
false)
548 $this->
ilias->setSetting(
'auth_mode', $new_auth_mode);
550 $this->tpl->setOnScreenMessage(
552 $this->
lng->txt(
'auth_default_mode_changed_to') .
' ' . $this->getAuthModeTitle(),
555 $this->
ctrl->redirect($this,
'authSettings');
559 string $submit_action
561 $role_list = $this->rbac_review->getRolesByFilter(2, $this->
object->
getId());
564 foreach ($role_list as $role) {
565 $roles[$role[
'obj_id']] = $role[
'title'];
568 $active = $this->ui_factory
571 ->checkbox($this->
lng->txt(
'active'))
572 ->withValue((
bool) $this->
settings->get(
'soap_auth_active',
''));
578 $this->
lng->txt(
'server'),
579 $this->lng->txt(
'auth_soap_server_desc')
583 ->withValue($this->
settings->get(
'soap_auth_server',
''));
585 $port = $this->ui_factory
589 $this->
lng->txt(
'port'),
590 $this->lng->txt(
'auth_soap_port_desc')
592 ->withAdditionalTransformation($this->
refinery->int()->isGreaterThan(0))
593 ->withAdditionalTransformation(
594 $this->
refinery->int()->isLessThan(65536)
596 ->withValue((
int) $this->
settings->get(
'soap_auth_port',
'0'));
598 $use_https = $this->ui_factory
601 ->checkbox($this->
lng->txt(
'auth_soap_use_https'))
602 ->withValue((
bool) $this->
settings->get(
'soap_auth_use_https',
''));
604 $uri = $this->ui_factory
608 $this->
lng->txt(
'uri'),
609 $this->lng->txt(
'auth_soap_uri_desc')
612 ->withValue($this->
settings->get(
'soap_auth_uri',
''));
618 $this->
lng->txt(
'auth_soap_namespace'),
619 $this->lng->txt(
'auth_soap_namespace_desc')
622 ->withValue($this->
settings->get(
'soap_auth_namespace',
''));
624 $dotnet = $this->ui_factory
627 ->checkbox($this->
lng->txt(
'auth_soap_use_dotnet'))
628 ->withValue((
bool) $this->
settings->get(
'soap_auth_use_dotnet',
''));
630 $createuser = $this->ui_factory
634 $this->
lng->txt(
'auth_create_users'),
635 $this->lng->txt(
'auth_soap_create_users_desc')
637 ->withValue((
bool) $this->
settings->get(
'soap_auth_create_users',
''));
639 $sendmail = $this->ui_factory
643 $this->
lng->txt(
'user_send_new_account_mail'),
644 $this->lng->txt(
'auth_new_account_mail_desc')
646 ->withValue((
bool) $this->
settings->get(
'soap_auth_account_mail',
''));
648 $defaultrole = $this->ui_factory
652 $this->
lng->txt(
'auth_user_default_role'),
654 $this->lng->txt(
'auth_soap_user_default_role_desc')
656 ->withValue($this->
settings->get(
'soap_auth_user_default_role',
'4'))
657 ->withAdditionalTransformation($this->
refinery->int()->isGreaterThan(0));
659 $allowlocal = $this->ui_factory
663 $this->
lng->txt(
'auth_allow_local'),
664 $this->lng->txt(
'auth_soap_allow_local_desc')
666 ->withValue((
bool) $this->
settings->get(
'soap_auth_user_default_role',
''));
668 $form = $this->ui_factory->input()->container()->form()->standard(
674 'use_https' => $use_https,
678 'createuser' => $createuser,
679 'sendmail' => $sendmail,
680 'defaultrole' => $defaultrole,
681 'allowlocal' => $allowlocal
688 string $submit_action
690 $ext_uid = $this->ui_factory->input()->field()->text(
693 $soap_pw = $this->ui_factory->input()->field()->text(
696 $new_user = $this->ui_factory->input()->field()
697 ->checkbox(
'new_user');
698 return $this->ui_factory->input()->container()->form()->standard(
705 )->withSubmitLabel(
'Send');
710 if (!$this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
711 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
714 $soap_form = $this->buildSOAPForm($this->
ctrl->getFormAction($this,
'saveSOAP'));
715 $test_form = $this->buildSOAPTestForm($this->
ctrl->getFormAction($this,
'testSoapAuthConnection'));
717 $this->tabs_gui->setTabActive(
'auth_soap');
718 $panel = $this->ui_factory->panel()->standard(
'SOAP', [$soap_form, $test_form]);
719 $this->tpl->setContent($this->ui_renderer->render($panel));
724 if (!$this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
725 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
728 $soap_form = $this->buildSOAPForm($this->
ctrl->getFormAction($this,
'saveSOAP'));
729 $test_form = $this->buildSOAPTestForm($this->
ctrl->getFormAction($this,
'testSoapAuthConnection'));
730 $panel_content = [$soap_form, $test_form];
731 if ($this->request->getMethod() ===
'POST') {
732 $test_form = $test_form->withRequest($this->request);
733 $result = $test_form->getData();
734 if ($result !==
null) {
735 $panel_content[] = $this->ui_factory->legacy()->content(
736 ilSOAPAuth::testConnection($result[
'ext_uid'], $result[
'soap_pw'], $result[
'new_user'])
740 $this->tabs_gui->setTabActive(
'auth_soap');
741 $panel = $this->ui_factory->panel()->standard(
'SOAP', $panel_content);
742 $this->tpl->setContent($this->ui_renderer->render($panel));
747 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
748 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
751 $soap_form = $this->buildSOAPForm($this->
ctrl->getFormAction($this,
'saveSOAP'));
752 $test_form = $this->buildSOAPTestForm($this->
ctrl->getFormAction($this,
'testSoapAuthConnection'));
753 if ($this->request->getMethod() ===
'POST') {
754 $soap_form = $soap_form->withRequest($this->request);
755 $result = $soap_form->getData();
756 if ($result !==
null) {
757 $this->
settings->set(
'soap_auth_active', (
string) $result[
'active']);
758 $this->
settings->set(
'soap_auth_server', $result[
'server']);
759 $this->
settings->set(
'soap_auth_port', (
string) $result[
'port']);
760 $this->
settings->set(
'soap_auth_use_https', (
string) $result[
'use_https']);
761 $this->
settings->set(
'soap_auth_uri', $result[
'uri']);
762 $this->
settings->set(
'soap_auth_namespace', $result[
'namespace']);
763 $this->
settings->set(
'soap_auth_use_dotnet', (
string) $result[
'dotnet']);
764 $this->
settings->set(
'soap_auth_create_users', (
string) $result[
'createuser']);
765 $this->
settings->set(
'soap_auth_account_mail', (
string) $result[
'sendmail']);
766 $this->
settings->set(
'soap_auth_user_default_role', (
string) $result[
'defaultrole']);
767 $this->
settings->set(
'soap_auth_allow_local', (
string) $result[
'allowlocal']);
769 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'auth_soap_settings_saved'),
true);
770 $this->
logger->info(
'data' . print_r($result,
true));
771 $this->
ctrl->redirect($this,
'editSOAP');
775 $this->tabs_gui->setTabActive(
'auth_soap');
776 $panel = $this->ui_factory->panel()->standard(
'SOAP', [$soap_form, $test_form]);
777 $this->tpl->setContent($this->ui_renderer->render($panel));
782 if (!$this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
783 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
786 if ($_SESSION[
'error_post_vars']) {
787 $this->tpl->setVariable(
'AUTH_SCRIPT_NAME', $_SESSION[
'error_post_vars'][
'auth_script'][
'name']);
789 $settings = $this->
ilias->getAllSettings();
791 $this->tpl->setVariable(
'AUTH_SCRIPT_NAME', $settings[
'auth_script_name']);
794 $this->tabs_gui->setTabActive(
'auth_script');
796 $this->tpl->addBlockFile(
799 'tpl.auth_script.html',
800 'components/ILIAS/Authentication'
803 $this->tpl->setVariable(
'FORMACTION', $this->
ctrl->getFormAction($this));
804 $this->tpl->setVariable(
'COLSPAN', 3);
805 $this->tpl->setVariable(
'TXT_AUTH_SCRIPT_TITLE', $this->
lng->txt(
'auth_script_configure'));
806 $this->tpl->setVariable(
'TXT_OPTIONS', $this->
lng->txt(
'options'));
807 $this->tpl->setVariable(
'TXT_AUTH_SCRIPT_NAME', $this->
lng->txt(
'auth_script_name'));
809 $this->tpl->setVariable(
'TXT_REQUIRED_FLD', $this->
lng->txt(
'required_field'));
810 $this->tpl->setVariable(
'TXT_CANCEL', $this->
lng->txt(
'cancel'));
811 $this->tpl->setVariable(
'TXT_SUBMIT', $this->
lng->txt(
'save'));
812 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveScript');
817 if (!
$_POST[
'auth_script'][
'name']) {
818 $this->
ilias->raiseError($this->
lng->txt(
'fill_out_all_required_fields'), $this->ilias->error_obj->MESSAGE);
821 $this->
ilias->setSetting(
'auth_script_name',
$_POST[
'auth_script'][
'name']);
824 $this->tpl->setOnScreenMessage(
826 $this->
lng->txt(
'auth_mode_changed_to') .
' ' . $this->getAuthModeTitle(),
829 $this->
ctrl->redirect($this,
'editScript');
834 return match ((
int) $this->
ilias->getSetting(
'auth_mode')) {
836 ilAuthUtils::AUTH_LDAP => $this->
lng->txt(
'auth_ldap'),
837 ilAuthUtils::AUTH_SHIBBOLETH => $this->
lng->txt(
'auth_shib'),
838 ilAuthUtils::AUTH_SAML => $this->
lng->txt(
'auth_saml'),
840 ilAuthUtils::AUTH_APACHE => $this->
lng->txt(
'auth_apache'),
841 default => $this->
lng->txt(
'unknown'),
847 $next_class = $this->
ctrl->getNextClass($this) ??
'';
848 $cmd = $this->
ctrl->getCmd() ??
'';
849 $this->prepareOutput();
851 if (!$this->rbac_system->checkAccess(
'visible,read', $this->object->getRefId())) {
852 $this->
error->raiseError($this->
lng->txt(
'msg_no_perm_read'), $this->error->WARNING);
855 switch ($next_class) {
856 case 'ilopenidconnectsettingsgui':
857 $this->tabs_gui->activateTab(
'auth_oidconnect');
860 $this->
ctrl->forwardCommand($oid);
863 case 'ilsamlsettingsgui':
864 $this->tabs_gui->setTabActive(
'auth_saml');
867 $this->
ctrl->forwardCommand($os);
870 case 'ilregistrationsettingsgui':
871 $this->tabs_gui->setTabActive(
'registration_settings');
874 $this->
ctrl->forwardCommand($registration_gui);
877 case 'ilpermissiongui':
878 $this->tabs_gui->setTabActive(
'perm_settings');
881 $this->
ctrl->forwardCommand($perm_gui);
884 case 'illdapsettingsgui':
885 $this->tabs_gui->setTabActive(
'auth_ldap');
888 $this->
ctrl->forwardCommand($ldap_settings_gui);
891 case 'ilauthshibbolethsettingsgui':
892 $this->tabs_gui->setTabActive(
'auth_shib');
895 $this->
ctrl->forwardCommand($shib_settings_gui);
898 case strtolower(ilAuthPageEditorGUI::class):
899 $this->setSubTabs(
'authSettings');
900 $this->tabs_gui->setTabActive(
'authentication_settings');
901 $this->tabs_gui->setSubTabActive(
'auth_login_editor');
904 $this->
ctrl->forwardCommand($lpe);
907 case strtolower(ilObjectContentStyleSettingsGUI::class):
908 $this->checkPermission(
'write');
909 $this->setTitleAndDescription();
910 $this->setSubTabs(
'authSettings');
911 $this->tabs_gui->activateTab(
'authentication_settings');
912 $this->tabs_gui->activateSubTab(
'style');
914 $settings_gui = $this->content_style_gui
915 ->objectSettingsGUIForRefId(
919 $this->
ctrl->forwardCommand($settings_gui);
922 case strtolower(ilAuthLogoutBehaviourGUI::class):
923 $this->setSubTabs(
'authSettings');
924 $this->tabs_gui->setTabActive(
'authentication_settings');
925 $this->tabs_gui->setSubTabActive(
'logout_behaviour');
928 $this->
ctrl->forwardCommand($gui);
933 $cmd =
'authSettings';
949 $this->
ctrl->setParameter($this,
'ref_id', $this->
object->getRefId());
951 if ($this->rbac_system->checkAccess(
'visible,read', $this->object->getRefId())) {
952 $this->tabs_gui->addTarget(
953 'authentication_settings',
954 $this->
ctrl->getLinkTarget($this,
'authSettings'),
960 $this->tabs_gui->addTarget(
961 'registration_settings',
962 $this->
ctrl->getLinkTargetByClass(
'ilregistrationsettingsgui',
'view')
965 $this->tabs_gui->addTarget(
967 $this->
ctrl->getLinkTargetByClass(
'illdapsettingsgui',
'serverList'),
973 $this->tabs_gui->addTarget(
975 $this->
ctrl->getLinkTargetByClass(
'ilauthshibbolethsettingsgui',
'settings')
978 $this->tabs_gui->addTarget(
980 $this->
ctrl->getLinkTarget($this,
'editSOAP'),
986 $this->tabs_gui->addTarget(
987 'apache_auth_settings',
988 $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_APACHE_SETTINGS),
994 $this->tabs_gui->addTarget(
1002 $this->tabs_gui->addTab(
1004 $this->
lng->txt(
'auth_oidconnect'),
1005 $this->ctrl->getLinkTargetByClass(
'ilopenidconnectsettingsgui')
1009 if ($this->rbac_system->checkAccess(
'edit_permission', $this->object->getRefId())) {
1010 $this->tabs_gui->addTarget(
1012 $this->
ctrl->getLinkTargetByClass([get_class($this),
'ilpermissiongui'],
'perm'),
1013 [
'perm',
'info',
'owner'],
1021 $this->
lng->loadLanguageModule(
'auth');
1023 if ($a_tab ===
'authSettings' && $this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
1024 $this->tabs_gui->addSubTabTarget(
1026 $this->
ctrl->getLinkTarget($this,
'authSettings'),
1030 foreach (AuthPageEditorContext::cases() as $auth_ipe_context) {
1031 $this->
ctrl->setParameterByClass(
1032 ilAuthPageEditorGUI::class,
1034 $auth_ipe_context->value
1036 $this->tabs_gui->addSubTabTarget(
1037 $auth_ipe_context->tabIdentifier(),
1038 $this->ctrl->getLinkTargetByClass(
1039 ilAuthPageEditorGUI::class,
1043 $this->
ctrl->setParameterByClass(
1044 ilAuthPageEditorGUI::class,
1050 $this->tabs_gui->addSubTabTarget(
1052 $this->
ctrl->getLinkTargetByClass(ilAuthLogoutBehaviourGUI::class,
''),
1056 $this->tabs_gui->addSubTab(
1058 $this->
lng->txt(
'cont_style'),
1059 $this->ctrl->getLinkTargetByClass(ilObjectContentStyleSettingsGUI::class)
1066 $this->tabs_gui->setTabActive(
'apache_auth_settings');
1069 $settings =
new ilSetting(
'apache_auth');
1070 $settingsMap = $settings->getAll();
1073 if (file_exists(
$path) && is_readable(
$path)) {
1074 $settingsMap[
'apache_auth_domains'] = file_get_contents(
$path);
1080 self::CMD_SHOW_APACHE_SETTINGS,
1081 self::CMD_SAVE_APACHE_SETTINGS,
1087 $this->tpl->setContent($this->ui_renderer->render([
1088 $this->ui_factory->item()->standard($this->lng->txt(
'apache_settings')),
1098 self::CMD_SHOW_APACHE_SETTINGS,
1099 self::CMD_SAVE_APACHE_SETTINGS
1100 ))->buildForm()->withRequest($this->
http->request());
1101 if (!$form->getError()) {
1102 $data = $form->getData();
1104 $settings =
new ilSetting(
'apache_auth');
1107 'apache_auth_indicator_name',
1108 'apache_auth_indicator_value',
1109 'apache_enable_auth',
1110 'apache_enable_local',
1111 'apache_local_autocreate',
1112 'apache_enable_ldap',
1113 'apache_auth_username_config_type',
1114 'apache_auth_username_direct_mapping_fieldname',
1115 'apache_default_role',
1116 'apache_auth_target_override_login_page',
1117 'apache_auth_enable_override_login_page',
1118 'apache_auth_authenticate_on_login_page',
1122 foreach ($fields as $field) {
1123 $value = match ($field) {
1124 'apache_enable_auth',
1125 'apache_auth_enable_override_login_page',
1126 'apache_auth_username_config',
1127 'apache_auth_security',
1128 'apache_enable_ldap' => (bool) (
$data[$field] ??
false),
1129 'apache_auth_username_config_type' =>
$data[
'apache_auth_username_config'][$field][0] ?? 1,
1130 'apache_auth_target_override_login_page' =>
$data[
'apache_auth_enable_override_login_page'][$field] ??
'',
1131 'apache_auth_username_direct_mapping_fieldname' =>
$data[
'apache_auth_username_config'][
'apache_auth_username_config_type'][1][$field] ??
'',
1132 'apache_auth_domains' =>
$data[
'apache_auth_security'][$field] ??
'',
1133 'apache_local_autocreate' => (bool) (
$data[
'apache_enable_auth'][$field] ??
false),
1134 'apache_default_role' =>
$data[
'apache_enable_auth'][
'apache_local_autocreate'][$field] ?? 4,
1135 'apache_ldap_sid' =>
$data[
'apache_enable_ldap'][$field] ??
'',
1136 default =>
$data[$field],
1145 if (
$data[$field] ??
false) {
1146 $this->
ilias->setSetting(
'apache_active',
'1');
1148 $this->
ilias->setSetting(
'apache_active',
'0');
1154 $allowed_domains = $this->validateApacheAuthAllowedDomains(
$data[
'apache_auth_security'][
'apache_auth_domains'] ??
'');
1157 $this->tpl->setOnScreenMessage(
1158 $this->tpl::MESSAGE_TYPE_SUCCESS,
1159 $this->
lng->txt(
'apache_settings_changed_success'),
1162 $this->
ctrl->redirect($this, self::CMD_SHOW_APACHE_SETTINGS);
1165 $this->
ctrl->redirect($this, self::CMD_SHOW_APACHE_SETTINGS);
1170 return implode(
"\n", preg_split(
"/[\r\n]+/", $text));
1176 $this->
ctrl->redirect($registration_gui);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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)
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
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'))