4 require_once
'Services/Saml/classes/class.ilSamlSettings.php';
5 require_once
'Services/Saml/classes/class.ilSamlIdp.php';
22 'showAddIdpForm', self::DEFAULT_CMD,
'showSettings',
'saveSettings',
'showNewIdpForm',
'saveNewIdp' 29 'deactivateIdp',
'activateIdp',
'confirmDeleteIdp',
'deleteIdp' 36 'mail_incoming_mail',
'preferences',
'hide_own_online_status',
37 'show_users_online',
'hits_per_page',
38 'roles',
'upload',
'password',
39 'username',
'language',
'skin_style',
40 'interests_general',
'interests_help_offered',
'interests_help_looking',
41 'bs_allow_to_contact_me',
'chat_osc_accept_msg' 117 $this->ctrl = $DIC->ctrl();
118 $this->tpl = $DIC->ui()->mainTemplate();
119 $this->lng = $DIC->language();
120 $this->access = $DIC->access();
121 $this->error_handler = $DIC[
'ilErr'];
122 $this->tabs = $DIC->tabs();
123 $this->rbacreview = $DIC->rbac()->review();
124 $this->toolbar = $DIC[
'ilToolbar'];
125 $this->help = $DIC[
'ilHelp'];
127 $this->lng->loadLanguageModule(
'auth');
136 if (!$this->access->checkAccess($operation,
'', $this->getRefId())) {
137 $this->error_handler->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error_handler->WARNING);
182 $this->ctrl->setParameter($this,
'saml_idp_id', null);
183 $this->ctrl->redirect($this, self::DEFAULT_CMD);
203 $this->help->setScreenIdComponent(
'auth');
205 switch ($this->ctrl->getNextClass()) {
207 $cmd = $this->ctrl->getCmd();
208 if (!strlen($cmd) || !method_exists($this, $cmd)) {
209 $cmd = self::DEFAULT_CMD;
212 if (isset($_REQUEST[
'saml_idp_id'])) {
213 $this->ctrl->saveParameter($this,
'saml_idp_id');
216 if (!in_array(strtolower($cmd), array_map(
'strtolower', self::$globalCommands))) {
217 if (!isset($_REQUEST[
'saml_idp_id'])) {
218 $this->ctrl->redirect($this, self::DEFAULT_CMD);
226 in_array(strtolower($cmd), array_map(
'strtolower', self::$globalCommands)) ||
227 in_array(strtolower($cmd), array_map(
'strtolower', self::$globalEntityCommands))
244 if ($this->samlAuth) {
246 $addIdpButton->setCaption(
'auth_saml_add_idp_btn');
247 $addIdpButton->setUrl($this->ctrl->getLinkTarget($this,
'showNewIdpForm'));
248 $this->toolbar->addStickyItem($addIdpButton);
251 require_once
'Services/Saml/classes/class.ilSamlIdpTableGUI.php';
253 $this->tpl->setContent(
$table->getHTML());
264 $this->idp->setActive(0);
265 $this->idp->persist();
278 $this->idp->setActive(1);
279 $this->idp->persist();
290 switch ($a_view_mode) {
291 case self::VIEW_MODE_GLOBAL:
292 $this->tabs->addSubTabTarget(
294 $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD),
295 array_merge(self::$globalEntityCommands,
array(self::DEFAULT_CMD,
'showNewIdpForm',
'saveNewIdp')),
299 $this->tabs->addSubTabTarget(
301 $this->ctrl->getLinkTarget($this,
'showSettings'),
302 array(
'showSettings',
'saveSettings'),
307 case self::VIEW_MODE_SINGLE:
308 $this->tabs->clearTargets();
309 $this->tabs->setBackTarget($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this, self::DEFAULT_CMD));
311 $this->tabs->addSubTabTarget(
312 'auth_saml_idp_settings',
313 $this->ctrl->getLinkTarget($this,
'showIdpSettings'),
314 array(
'showIdpSettings',
'saveIdpSettings'),
318 $this->tabs->addSubTabTarget(
319 'auth_saml_user_mapping',
320 $this->ctrl->getLinkTarget($this,
'showUserAttributeMappingForm'),
321 array(
'showUserAttributeMappingForm',
'saveUserAttributeMapping'),
333 require_once
'Services/Authentication/classes/External/UserAttributeMapping/class.ilExternalAuthUserAttributeMapping.php';
342 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
344 $form->setFormAction($this->ctrl->getFormAction($this,
'saveUserAttributeMapping'));
345 $form->setTitle($this->lng->txt(
'auth_saml_user_mapping'));
347 require_once
'Services/User/classes/class.ilUserProfile.php';
349 foreach ($usr_profile->getStandardFields() as
$id => $definition) {
350 if (in_array($id, self::$ignoredUserFields)) {
357 require_once
'Services/User/classes/class.ilUserDefinedFields.php';
362 if (!$this->access->checkAccess(
'write',
'', $this->getRefId())) {
363 foreach (
$form->getItems() as $item) {
364 $item->setDisabled(
true);
367 $form->addCommandButton(
'saveUserAttributeMapping', $this->lng->txt(
'save'));
381 $form->addItem($field);
384 $update_automatically->setOptionTitle($this->lng->txt(
'auth_saml_update_field_info'));
385 $update_automatically->setValue(1);
386 $form->addItem($update_automatically);
397 if (
$form->checkInput()) {
398 $this->mapping->delete();
400 require_once
'Services/User/classes/class.ilUserProfile.php';
402 foreach ($usr_profile->getStandardFields() as
$id => $definition) {
403 if (in_array($id, self::$ignoredUserFields)) {
407 $rule = $this->mapping->getEmptyRule();
408 $rule->setAttribute($id);
410 $rule->updateAutomatically((
bool)
$form->getInput(
$rule->getAttribute() .
'_update'));
411 $this->mapping[
$rule->getAttribute()] =
$rule;
414 require_once
'Services/User/classes/class.ilUserDefinedFields.php';
416 $rule = $this->mapping->getEmptyRule();
417 $rule->setAttribute(
'udf_' . $definition[
'field_id']);
419 $rule->updateAutomatically((
bool)
$form->getInput(
$rule->getAttribute() .
'_update'));
420 $this->mapping[
$rule->getAttribute()] =
$rule;
423 $this->mapping->save();
428 $form->setValuesByPost();
438 $this->tabs->setSubTabActive(
'auth_saml_user_mapping');
443 foreach ($this->mapping as
$rule) {
444 $data[$rule->getAttribute()] = $rule->getExternalAttribute();
445 $data[$rule->getAttribute() .
'_update'] = (bool) $rule->isAutomaticallyUpdated();
450 $this->tpl->setContent(
$form->getHTML());
458 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
460 $form->setFormAction($this->ctrl->getFormAction($this,
'saveSettings'));
461 $form->setTitle($this->lng->txt(
'auth_saml_configure'));
463 $show_login_form =
new ilCheckboxInputGUI($this->lng->txt(
'auth_saml_login_form'),
'login_form');
464 $show_login_form->
setInfo($this->lng->txt(
'auth_saml_login_form_info'));
465 $show_login_form->setValue(1);
466 $form->addItem($show_login_form);
468 if (!$this->access->checkAccess(
'write',
'', $this->getRefId())) {
469 foreach (
$form->getItems() as $item) {
470 $item->setDisabled(
true);
473 $form->addCommandButton(
'saveSettings', $this->lng->txt(
'save'));
485 $this->rbacreview->getGlobalRoles(),
491 $select[0] = $this->lng->txt(
'links_select_one');
492 foreach ($global_roles as $role_id) {
507 if (
$form->checkInput()) {
512 $form->setValuesByPost();
529 $this->tpl->setContent(
$form->getHTML());
537 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
539 $form->setFormAction($this->ctrl->getFormAction($this,
'saveIdpSettings'));
540 $form->setTitle(sprintf($this->lng->txt(
'auth_saml_configure_idp'), $this->idp->getEntityId()));
543 $idp->setDisabled(
true);
548 $local =
new ilCheckboxInputGUI($this->lng->txt(
'auth_allow_local'),
'allow_local_auth');
550 $local->setInfo($this->lng->txt(
'auth_allow_local_info'));
551 $form->addItem($local);
553 $uid_claim =
new ilTextInputGUI($this->lng->txt(
'auth_saml_uid_claim'),
'uid_claim');
554 $uid_claim->
setInfo($this->lng->txt(
'auth_saml_uid_claim_info'));
555 $uid_claim->setRequired(
true);
556 $form->addItem($uid_claim);
559 $sync->setInfo($this->lng->txt(
'auth_saml_sync_info'));
562 $username_claim =
new ilTextInputGUI($this->lng->txt(
'auth_saml_username_claim'),
'login_claim');
563 $username_claim->
setInfo($this->lng->txt(
'auth_saml_username_claim_info'));
564 $username_claim->setRequired(
true);
565 $sync->addSubItem($username_claim);
567 $role =
new ilSelectInputGUI($this->lng->txt(
'auth_saml_role_select'),
'default_role_id');
569 $role->setRequired(
true);
570 $sync->addSubItem($role);
572 $migr =
new ilCheckboxInputGUI($this->lng->txt(
'auth_saml_migration'),
'account_migr_status');
573 $migr->
setInfo($this->lng->txt(
'auth_saml_migration_info'));
575 $sync->addSubItem($migr);
578 if (!$this->access->checkAccess(
'write',
'', $this->getRefId())) {
579 foreach (
$form->getItems() as $item) {
580 $item->setDisabled(
true);
583 $form->addCommandButton(
'saveIdpSettings', $this->lng->txt(
'save'));
585 $form->addCommandButton(self::DEFAULT_CMD, $this->lng->txt(
'cancel'));
595 $this->tabs->setSubTabActive(
'auth_saml_idp_settings');
597 if (null ===
$form) {
599 $data = $this->idp->toArray();
603 $form->setValuesByPost();
606 $this->help->setSubScreenId(
'edit_idp');
608 $this->tpl->setContent(
$form->getHTML());
619 if (
$form->checkInput()) {
620 $this->idp->bindForm(
$form);
621 $this->idp->persist();
635 $form = new \ilPropertyFormGUI();
636 $form->setFormAction($this->ctrl->getFormAction($this,
'saveNewIdp'));
637 $form->setTitle($this->lng->txt(
'auth_saml_add_idp_btn'));
641 $form->addCommandButton(
'saveNewIdp', $this->lng->txt(
'save'));
642 $form->addCommandButton(
'listIdps', $this->lng->txt(
'cancel'));
655 if (
$form->checkInput()) {
663 $this->ctrl->setParameter($this,
'saml_idp_id',
$idp->getIdpId());
664 $this->ctrl->redirect($this,
'showIdpSettings');
677 if (null ===
$form) {
680 $form->setValuesByPost();
683 $this->help->setSubScreenId(
'create_idp');
685 $this->tpl->setContent(
$form->getHTML());
693 require_once
'Services/Saml/classes/form/class.ilSamlIdpMetadataInputGUI.php';
694 require_once
'Services/Saml/classes/form/class.ilSamlIdpMetadataPurifier.php';
695 require_once
'Services/Saml/classes/class.ilSamlIdpXmlMetadataParser.php';
696 require_once
'Services/Html/classes/class.ilHtmlPurifierComposite.php';
698 $metadata = new \ilSamlIdpMetadataInputGUI(
699 $this->lng->txt(
'auth_saml_add_idp_md_label'),
703 $metadata->setInfo($this->lng->txt(
'auth_saml_add_idp_md_info'));
717 $idpDisco = $this->samlAuth->getIdpDiscovery();
719 $data[
'metadata'] = $idpDisco->fetchIdpMetadata($idp->
getIdpId());
728 $idpDisco = $this->samlAuth->getIdpDiscovery();
739 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
740 $confirmation = new \ilConfirmationGUI();
741 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'deleteIdp'));
742 $confirmation->setConfirm($this->lng->txt(
'confirm'),
'deleteIdp');
743 $confirmation->setCancel($this->lng->txt(
'cancel'), self::DEFAULT_CMD);
744 $confirmation->setHeaderText($this->lng->txt(
'auth_saml_sure_delete_idp'));
745 $confirmation->addItem(
'saml_idp_ids', $this->idp->getIdpId(), $this->idp->getEntityId());
747 $this->tpl->setContent($confirmation->getHTML());
757 $idpDisco = $this->samlAuth->getIdpDiscovery();
758 $idpDisco->deleteIdpMetadata($this->idp->getIdpId());
760 $this->idp->delete();
764 $this->ctrl->setParameter($this,
'saml_idp_id', null);
765 $this->ctrl->redirect($this, self::DEFAULT_CMD);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static $globalEntityCommands
static _getInstance()
Get instance.
populateWithMetadata(\ilSamlIdp $idp, &$data)
Composite for nesting multiple purifiers.
showSettings(ilPropertyFormGUI $form=null)
if(!array_key_exists('StateId', $_REQUEST)) $id
static getInstanceByIdpId($a_idp_id)
static _lookupTitle($a_id)
lookup object title
static $ignoredUserFields
$metadata['__DYNAMIC:1__']
storeMetadata(\ilSamlIdp $idp, $metadata)
getUserAttributeMappingForm()
Class ilExternalAuthUserAttributeMapping.
showIdpSettings(ilPropertyFormGUI $form=null)
if(isset($_POST['submit'])) $form
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.
initUserAttributeMapping()
This class represents a text property in a property form.
saveUserAttributeMapping()
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
showNewIdpForm(\ilPropertyFormGUI $form=null)
addAttributeRuleFieldToForm($form, $field_label, $field_name)
showUserAttributeMappingForm(ilPropertyFormGUI $form=null)
if(empty($password)) $table
__construct($ref_id)
ilSamlSettingsGUI constructor.
addMetadataElement(\ilPropertyFormGUI $form)