public function SamlauthConfigureForm::submitForm in SAML Authentication 8.2
Same name and namespace in other branches
- 8.3 src/Form/SamlauthConfigureForm.php \Drupal\samlauth\Form\SamlauthConfigureForm::submitForm()
- 8 src/Form/SamlauthConfigureForm.php \Drupal\samlauth\Form\SamlauthConfigureForm::submitForm()
- 4.x src/Form/SamlauthConfigureForm.php \Drupal\samlauth\Form\SamlauthConfigureForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides ConfigFormBase::submitForm
File
- src/
Form/ SamlauthConfigureForm.php, line 465
Class
- SamlauthConfigureForm
- Provides a configuration form for samlauth module settings and IDP/SP info.
Namespace
Drupal\samlauth\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
// Only store variables related to the sp_cert_type value. (If the user
// switched from fields to folder, the cert/key values always get cleared
// so no unused security sensitive data gets saved in the database.)
$sp_cert_type = $form_state
->getValue('sp_cert_type');
$sp_x509_certificate = '';
$sp_private_key = '';
$sp_cert_folder = '';
if ($sp_cert_type == 'folder') {
$sp_cert_folder = $this
->fixFolderPath($form_state
->getValue('sp_cert_folder'));
}
else {
$sp_x509_certificate = $form_state
->getValue('sp_x509_certificate');
$sp_private_key = $form_state
->getValue('sp_private_key');
}
$this
->config('samlauth.authentication')
->set('login_menu_item_title', $form_state
->getValue('login_menu_item_title'))
->set('logout_menu_item_title', $form_state
->getValue('logout_menu_item_title'))
->set('drupal_saml_login', $form_state
->getValue('drupal_saml_login'))
->set('login_redirect_url', $form_state
->getValue('login_redirect_url'))
->set('logout_redirect_url', $form_state
->getValue('logout_redirect_url'))
->set('sp_entity_id', $form_state
->getValue('sp_entity_id'))
->set('sp_name_id_format', $form_state
->getValue('sp_name_id_format'))
->set('sp_x509_certificate', $sp_x509_certificate)
->set('sp_private_key', $sp_private_key)
->set('sp_cert_folder', $sp_cert_folder)
->set('idp_entity_id', $form_state
->getValue('idp_entity_id'))
->set('idp_single_sign_on_service', $form_state
->getValue('idp_single_sign_on_service'))
->set('idp_single_log_out_service', $form_state
->getValue('idp_single_log_out_service'))
->set('idp_change_password_service', $form_state
->getValue('idp_change_password_service'))
->set('idp_cert_type', $form_state
->getValue('idp_cert_type'))
->set('idp_x509_certificate', $form_state
->getValue('idp_x509_certificate'))
->set('idp_x509_certificate_multi', $form_state
->getValue('idp_x509_certificate_multi'))
->set('unique_id_attribute', $form_state
->getValue('unique_id_attribute'))
->set('map_users', $form_state
->getValue('map_users'))
->set('create_users', $form_state
->getValue('create_users'))
->set('sync_name', $form_state
->getValue('sync_name'))
->set('sync_mail', $form_state
->getValue('sync_mail'))
->set('user_name_attribute', $form_state
->getValue('user_name_attribute'))
->set('user_mail_attribute', $form_state
->getValue('user_mail_attribute'))
->set('security_authn_requests_sign', $form_state
->getValue('security_authn_requests_sign'))
->set('security_lowercase_url_encoding', $form_state
->getValue('security_lowercase_url_encoding'))
->set('security_messages_sign', $form_state
->getValue('security_messages_sign'))
->set('security_request_authn_context', $form_state
->getValue('security_request_authn_context'))
->set('security_signature_algorithm', $form_state
->getValue('security_signature_algorithm'))
->set('strict', $form_state
->getValue('strict'))
->save();
}