19 declare(strict_types=1);
    88         'hide_own_online_status',
    98         'interests_help_offered',
    99         'interests_help_looking',
   100         'bs_allow_to_contact_me',
   101         'chat_osc_accept_msg',
   102         'chat_broadcast_typing',
   126         $this->
ctrl = $DIC->ctrl();
   127         $this->tpl = $DIC->ui()->mainTemplate();
   128         $this->
lng = $DIC->language();
   129         $this->
access = $DIC->access();
   130         $this->
rbac = $DIC->rbac();
   131         $this->error_handler = $DIC[
'ilErr'];
   132         $this->
tabs = $DIC->tabs();
   133         $this->
toolbar = $DIC[
'ilToolbar'];
   134         $this->
help = $DIC[
'ilHelp'];
   135         $this->httpState = $DIC->http();
   137         $this->ui_factory = $DIC->ui()->factory();
   138         $this->ui_renderer = $DIC->ui()->renderer();
   140         $this->
lng->loadLanguageModule(
'auth');
   145         if (!$this->
rbac->system()->checkAccess($operation, $this->ref_id)) {
   146             $this->error_handler->raiseError($this->
lng->txt(
'msg_no_perm_read'), $this->error_handler->WARNING);
   168         if ($this->httpState->wrapper()->query()->has(self::REQUEST_PARAM_SAML_IDP_ID)) {
   169             $idpId = (
int) $this->httpState->wrapper()->query()->retrieve(
   170                 self::REQUEST_PARAM_SAML_IDP_ID,
   173         } elseif ($this->httpState->wrapper()->post()->has(self::REQUEST_PARAM_SAML_IDP_ID)) {
   174             $idpId = (
int) $this->httpState->wrapper()->post()->retrieve(
   175                 self::REQUEST_PARAM_SAML_IDP_ID,
   188             $this->tpl->setOnScreenMessage(self::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
'auth_saml_unknow_idp'), 
true);
   189             $this->
ctrl->setParameter($this, self::REQUEST_PARAM_SAML_IDP_ID, null);
   190             $this->
ctrl->redirect($this, self::DEFAULT_CMD);
   200             $this->samlAuth = $factory->auth();
   202             if (
'Database error: could not find driver' === $e->getMessage()) {
   203                 $this->tpl->setOnScreenMessage(self::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
'auth_saml_err_sqlite_driver'));
   205                 $this->tpl->setOnScreenMessage(self::MESSAGE_TYPE_FAILURE, $e->getMessage());
   209         $this->
help->setScreenIdComponent(
'auth');
   210         $cmd = $this->
ctrl->getCmd();
   211         if ($cmd === null || $cmd === 
'' || !method_exists($this, $cmd)) {
   212             $cmd = self::DEFAULT_CMD;
   216             $this->
ctrl->saveParameter($this, self::REQUEST_PARAM_SAML_IDP_ID);
   218         if (!in_array(strtolower($cmd), array_map(
'strtolower', self::GLOBAL_COMMANDS), 
true)) {
   220                 $this->
ctrl->redirect($this, self::DEFAULT_CMD);
   227             in_array(strtolower($cmd), array_map(
'strtolower', self::GLOBAL_COMMANDS), 
true) ||
   228             in_array(strtolower($cmd), array_map(
'strtolower', self::GLOBAL_ENTITY_COMMANDS), 
true)
   239         if ($this->samlAuth && $this->
rbac->system()->checkAccess(self::PERMISSION_WRITE, $this->ref_id)) {
   240             $this->
toolbar->addStickyItem($this->ui_factory->button()->standard(
   241                 $this->
lng->txt(
'auth_saml_add_idp_btn'),
   242                 $this->
ctrl->getLinkTarget($this, 
'showNewIdpForm')
   251             $this->
rbac->system()->checkAccess(self::PERMISSION_WRITE, $this->ref_id)
   253         $this->tpl->setContent($table->getHTML());
   260         $this->idp->setActive(
false);
   261         $this->idp->persist();
   263         $this->tpl->setOnScreenMessage(self::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(self::LNG_SAVED_SUCCESSFULLY));
   271         $this->idp->setActive(
true);
   272         $this->idp->persist();
   274         $this->tpl->setOnScreenMessage(self::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(self::LNG_SAVED_SUCCESSFULLY));
   280         switch ($a_view_mode) {
   281             case self::VIEW_MODE_GLOBAL:
   282                 $this->
tabs->addSubTabTarget(
   284                     $this->
ctrl->getLinkTarget($this, self::DEFAULT_CMD),
   285                     array_merge(self::GLOBAL_ENTITY_COMMANDS, [self::DEFAULT_CMD, 
'showNewIdpForm', self::CMD_SAVE_NEW_IDP]),
   289                 $this->
tabs->addSubTabTarget(
   291                     $this->
ctrl->getLinkTarget($this, 
'showSettings'),
   292                     [
'showSettings', self::CMD_SAVE_SETTINGS],
   297             case self::VIEW_MODE_SINGLE:
   298                 $this->
tabs->clearTargets();
   299                 $this->
tabs->setBackTarget(
   300                     $this->
lng->txt(
'back'),
   301                     $this->
ctrl->getLinkTarget($this, self::DEFAULT_CMD)
   304                 $this->
tabs->addSubTabTarget(
   305                     'auth_saml_idp_settings',
   306                     $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_IDP_SETTINGS),
   307                     [self::CMD_SHOW_IDP_SETTINGS, self::CMT_SAVE_IDP_SETTINGS],
   311                 $this->
tabs->addSubTabTarget(
   312                     self::LNG_AUTH_SAML_USER_MAPPING,
   313                     $this->
ctrl->getLinkTarget($this, 
'showUserAttributeMappingForm'),
   314                     [
'showUserAttributeMappingForm', self::CMD_SAVE_USER_ATTRIBUTE_MAPPING],
   329         $form->setFormAction($this->
ctrl->getFormAction($this, self::CMD_SAVE_USER_ATTRIBUTE_MAPPING));
   330         $form->setTitle($this->
lng->txt(self::LNG_AUTH_SAML_USER_MAPPING));
   333         foreach (array_keys($usr_profile->getStandardFields()) as 
$id) {
   334             if (in_array($id, self::IGNORED_USER_FIELDS, 
true)) {
   345         if (!$this->
access->checkAccess(self::PERMISSION_WRITE, 
'', $this->ref_id)) {
   346             foreach ($form->getItems() as $item) {
   347                 $item->setDisabled(
true);
   350             $form->addCommandButton(self::CMD_SAVE_USER_ATTRIBUTE_MAPPING, $this->
lng->txt(self::CMD_SAVE));
   364         $update_automatically = 
new ilCheckboxInputGUI(
'', $field_name . self::PROP_UPDATE_SUFFIX);
   365         $update_automatically->setOptionTitle($this->
lng->txt(
'auth_saml_update_field_info'));
   366         $update_automatically->setValue(
'1');
   367         $form->
addItem($update_automatically);
   375         if ($form->checkInput()) {
   376             $this->mapping->delete();
   379             foreach (array_keys($usr_profile->getStandardFields()) as 
$id) {
   380                 if (in_array($id, self::IGNORED_USER_FIELDS, 
true)) {
   384                 $rule = $this->mapping->getEmptyRule();
   385                 $rule->setAttribute($id);
   386                 $rule->setExternalAttribute((
string) $form->getInput($rule->getAttribute()));
   387                 $rule->updateAutomatically((
bool) $form->getInput($rule->getAttribute() . self::PROP_UPDATE_SUFFIX));
   388                 $this->mapping[$rule->getAttribute()] = $rule;
   392                 $rule = $this->mapping->getEmptyRule();
   393                 $rule->setAttribute(
'udf_' . $definition[
'field_id']);
   394                 $rule->setExternalAttribute((
string) $form->getInput($rule->getAttribute()));
   395                 $rule->updateAutomatically((
bool) $form->getInput($rule->getAttribute() . self::PROP_UPDATE_SUFFIX));
   396                 $this->mapping[$rule->getAttribute()] = $rule;
   399             $this->mapping->save();
   401             $this->tpl->setOnScreenMessage(self::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(self::LNG_SAVED_SUCCESSFULLY));
   404         $form->setValuesByPost();
   411         $this->
tabs->setSubTabActive(self::LNG_AUTH_SAML_USER_MAPPING);
   416             foreach ($this->mapping as $rule) {
   417                 $data[$rule->getAttribute()] = $rule->getExternalAttribute();
   418                 $data[$rule->getAttribute() . self::PROP_UPDATE_SUFFIX] = $rule->isAutomaticallyUpdated();
   420             $form->setValuesByArray(
$data);
   423         $this->tpl->setContent($form->getHTML());
   429         $form->setFormAction($this->
ctrl->getFormAction($this, self::CMD_SAVE_SETTINGS));
   430         $form->setTitle($this->
lng->txt(
'auth_saml_configure'));
   432         $show_login_form = 
new ilCheckboxInputGUI($this->
lng->txt(
'auth_saml_login_form'), self::LNG_LOGIN_FORM);
   433         $show_login_form->setInfo($this->
lng->txt(
'auth_saml_login_form_info'));
   434         $show_login_form->setValue(
'1');
   435         $form->addItem($show_login_form);
   437         if (!$this->
access->checkAccess(self::PERMISSION_WRITE, 
'', $this->ref_id)) {
   438             foreach ($form->getItems() as $item) {
   439                 $item->setDisabled(
true);
   442             $form->addCommandButton(self::CMD_SAVE_SETTINGS, $this->
lng->txt(self::CMD_SAVE));
   455             $this->
rbac->review()->getGlobalRoles(),
   461         $select[0] = $this->
lng->txt(
'links_select_one');
   462         foreach ($global_roles as $role_id) {
   474         if ($form->checkInput()) {
   476             $this->tpl->setOnScreenMessage(self::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(self::LNG_SAVED_SUCCESSFULLY));
   479         $form->setValuesByPost();
   488             $form->setValuesByArray([
   493         $this->tpl->setContent($form->getHTML());
   499         $form->setFormAction($this->
ctrl->getFormAction($this, self::CMT_SAVE_IDP_SETTINGS));
   500         $form->setTitle(sprintf($this->
lng->txt(
'auth_saml_configure_idp'), $this->idp->getEntityId()));
   503         $idp->setDisabled(
true);
   504         $form->addItem($idp);
   509         $local->setValue(
'1');
   510         $local->setInfo($this->
lng->txt(
'auth_allow_local_info'));
   511         $form->addItem($local);
   513         $uid_claim = 
new ilTextInputGUI($this->
lng->txt(
'auth_saml_uid_claim'), 
'uid_claim');
   514         $uid_claim->setInfo($this->
lng->txt(
'auth_saml_uid_claim_info'));
   515         $uid_claim->setRequired(
true);
   516         $form->addItem($uid_claim);
   519         $sync->setInfo($this->
lng->txt(
'auth_saml_sync_info'));
   520         $sync->setValue(
'1');
   522         $username_claim = 
new ilTextInputGUI($this->
lng->txt(
'auth_saml_username_claim'), 
'login_claim');
   523         $username_claim->setInfo($this->
lng->txt(
'auth_saml_username_claim_info'));
   524         $username_claim->setRequired(
true);
   525         $sync->addSubItem($username_claim);
   529         $role->setRequired(
true);
   530         $sync->addSubItem($role);
   533         $migr->setInfo($this->
lng->txt(
'auth_saml_migration_info'));
   534         $migr->setValue(
'1');
   535         $sync->addSubItem($migr);
   536         $form->addItem($sync);
   538         if (!$this->
access->checkAccess(self::PERMISSION_WRITE, 
'', $this->ref_id)) {
   539             foreach ($form->getItems() as $item) {
   540                 $item->setDisabled(
true);
   543             $form->addCommandButton(self::CMT_SAVE_IDP_SETTINGS, $this->
lng->txt(self::CMD_SAVE));
   545         $form->addCommandButton(self::DEFAULT_CMD, $this->
lng->txt(self::LNG_CANCEL));
   552         $this->
tabs->setSubTabActive(
'auth_saml_idp_settings');
   554         if (null === $form) {
   556             $data = $this->idp->toArray();
   558             $form->setValuesByArray(
$data);
   560             $form->setValuesByPost();
   563         $this->
help->setSubScreenId(
'edit_idp');
   565         $this->tpl->setContent($form->getHTML());
   573         if ($form->checkInput()) {
   574             $this->idp->bindForm($form);
   575             $this->idp->persist();
   576             $this->tpl->setOnScreenMessage(self::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(self::LNG_SAVED_SUCCESSFULLY));
   578             $this->
storeMetadata($this->idp, $form->getInput(self::METADATA_STORAGE_KEY));
   587         $form->setFormAction($this->
ctrl->getFormAction($this, self::CMD_SAVE_NEW_IDP));
   588         $form->setTitle($this->
lng->txt(
'auth_saml_add_idp_btn'));
   592         $form->addCommandButton(self::CMD_SAVE_NEW_IDP, $this->
lng->txt(self::CMD_SAVE));
   593         $form->addCommandButton(
'listIdps', $this->
lng->txt(self::LNG_CANCEL));
   603         if ($form->checkInput()) {
   605             $idp->bindForm($form);
   608             $this->
storeMetadata($idp, $form->getInput(self::METADATA_STORAGE_KEY));
   610             $this->tpl->setOnScreenMessage(self::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(self::LNG_SAVED_SUCCESSFULLY), 
true);
   611             $this->
ctrl->setParameter($this, self::REQUEST_PARAM_SAML_IDP_ID, $idp->
getIdpId());
   612             $this->
ctrl->redirect($this, self::CMD_SHOW_IDP_SETTINGS);
   622         if (null === $form) {
   625             $form->setValuesByPost();
   628         $this->
help->setSubScreenId(
'create_idp');
   630         $this->tpl->setContent($form->getHTML());
   636             $this->
lng->txt(
'auth_saml_add_idp_md_label'),
   637             self::METADATA_STORAGE_KEY,
   643         $metadata->
setInfo($this->
lng->txt(
'auth_saml_add_idp_md_info'));
   644         $metadata->setRows(20);
   645         $metadata->setRequired(
true);
   650         $metadata->setPurifier($purifier);
   651         $metadata->usePurifier(
true);
   657         $idpDisco = $this->samlAuth->getIdpDiscovery();
   659         $data[self::METADATA_STORAGE_KEY] = $idpDisco->fetchIdpMetadata($idp->
getIdpId());
   664         $idpDisco = $this->samlAuth->getIdpDiscovery();
   665         $idpDisco->storeIdpMetadata($idp->
getIdpId(), $metadata);
   673         $confirmation->setFormAction($this->
ctrl->getFormAction($this, 
'deleteIdp'));
   674         $confirmation->setConfirm($this->
lng->txt(
'confirm'), 
'deleteIdp');
   675         $confirmation->setCancel($this->
lng->txt(self::LNG_CANCEL), self::DEFAULT_CMD);
   676         $confirmation->setHeaderText($this->
lng->txt(
'auth_saml_sure_delete_idp'));
   677         $confirmation->addItem(
'saml_idp_ids', (
string) $this->idp->getIdpId(), $this->idp->getEntityId());
   679         $this->tpl->setContent($confirmation->getHTML());
   686         $idpDisco = $this->samlAuth->getIdpDiscovery();
   687         $idpDisco->deleteIdpMetadata($this->idp->getIdpId());
   689         $this->idp->delete();
   691         $this->tpl->setOnScreenMessage(self::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(
'auth_saml_deleted_idp'), 
true);
   693         $this->
ctrl->setParameter($this, self::REQUEST_PARAM_SAML_IDP_ID, null);
   694         $this->
ctrl->redirect($this, self::DEFAULT_CMD);
 
const MESSAGE_TYPE_SUCCESS
 
Interface GlobalHttpState. 
 
showNewIdpForm(ilPropertyFormGUI $form=null)
 
storeMetadata(ilSamlIdp $idp, string $metadata)
 
const CMT_SAVE_IDP_SETTINGS
 
readonly ilErrorHandling $error_handler
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
readonly GlobalHttpState $httpState
 
const METADATA_STORAGE_KEY
 
setSubTabs(int $a_view_mode)
 
const GLOBAL_ENTITY_COMMANDS
 
Composite for nesting multiple purifiers. 
 
showSettings(ilPropertyFormGUI $form=null)
 
const REQUEST_PARAM_SAML_IDP_ID
 
populateWithMetadata(ilSamlIdp $idp, array &$data)
 
static getInstanceByIdpId(int $a_idp_id)
 
getUserAttributeMappingForm()
 
const LNG_AUTH_SAML_USER_MAPPING
 
const IGNORED_USER_FIELDS
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
showIdpSettings(ilPropertyFormGUI $form=null)
 
readonly RBACServices $rbac
 
static _lookupTitle(int $obj_id)
 
readonly ilGlobalTemplateInterface $tpl
 
initUserAttributeMapping()
 
readonly ilToolbarGUI $toolbar
 
const CMD_SHOW_IDP_SETTINGS
 
const LNG_SAVED_SUCCESSFULLY
 
Provides fluid interface to RBAC services. 
 
readonly ILIAS UI Renderer $ui_renderer
 
saveUserAttributeMapping()
 
ilExternalAuthUserAttributeMapping $mapping
 
ensureAccess(string $operation)
 
__construct(private readonly int $ref_id)
 
static _sortIds(array $a_ids, string $a_table, string $a_field, string $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname. 
 
readonly ilCtrlInterface $ctrl
 
readonly Refinery $refinery
 
readonly ILIAS UI Factory $ui_factory
 
Error Handling & global info handling. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
addAttributeRuleFieldToForm(ilPropertyFormGUI $form, string $field_label, string $field_name)
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
showUserAttributeMappingForm(ilPropertyFormGUI $form=null)
 
readonly ilAccessHandler $access
 
const MESSAGE_TYPE_FAILURE
 
const CMD_SAVE_USER_ATTRIBUTE_MAPPING
 
addMetadataElement(ilPropertyFormGUI $form)