class AdvancedSettings in Shibboleth Authentication 8
Class AdvancedSettings.
@package Drupal\shib_auth\Form
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
- class \Drupal\shib_auth\Form\AdvancedSettings
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
Expanded class hierarchy of AdvancedSettings
1 string reference to 'AdvancedSettings'
File
- src/
Form/ AdvancedSettings.php, line 13
Namespace
Drupal\shib_auth\FormView source
class AdvancedSettings extends ConfigFormBase {
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return [
'shib_auth.advancedsettings',
];
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'advanced_settings';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('shib_auth.advancedsettings');
// $form['strict_shibboleth_session_checking'] = array(
// '#type' => 'details',
// '#title' => $this->t('Strict Shibboleth Session Checking'),
// '#open' => 'open',
// );
// $form['strict_shibboleth_session_checking']['Destroy Session'] = [
// '#type' => 'checkbox',
// '#title' => $this->t('Destroy Drupal session when the Shibboleth session expires.'),
// '#default_value' => $config->get('Destroy Session'),
// ];
// $form['terms_of_use_settings'] = array(
// '#type' => 'details',
// '#title' => $this->t('Terms of Use Settings'),
// '#open' => 'open',
// );
// $form['terms_of_use_settings']['force_terms_of_use'] = [
// '#type' => 'checkbox',
// '#title' => $this->t('Force users to accept Terms of Use'),
// '#default_value' => $config->get('force_terms_of_use'),
// ];
// $form['terms_of_use_settings']['url_of_document'] = [
// '#type' => 'textfield',
// '#title' => $this->t('URL of the document'),
// '#description' => $this->t('Please refence local content with e.g. "node/1", or use an external link.'),
// '#maxlength' => 128,
// '#size' => 64,
// '#default_value' => $config->get('url_of_document'),
// ];
// $form['terms_of_use_settings']['document_version'] = [
// '#type' => 'textfield',
// '#title' => $this->t('Document version'),
// '#maxlength' => 64,
// '#size' => 10,
// '#default_value' => $config->get('document_version'),
// ];.
$form['login_settings'] = [
'#type' => 'details',
'#title' => $this
->t('Login Settings'),
'#open' => 'open',
];
$form['login_settings']['url_redirect_login'] = [
'#type' => 'textfield',
'#title' => $this
->t('URL to redirect to after login'),
'#description' => $this
->t('The URL can be absolute or relative to the server base url. The relative paths will be automatically extended with the site base URL. If this value is empty, then the user will be redirected to the originally requested page.'),
'#maxlength' => 128,
'#size' => 64,
'#default_value' => $config
->get('url_redirect_login'),
];
$form['logout_settings'] = [
'#type' => 'details',
'#title' => $this
->t('Logout Settings'),
'#open' => 'open',
];
$form['logout_settings']['url_redirect_logout'] = [
'#type' => 'textfield',
'#title' => $this
->t('URL to redirect to after logout'),
'#description' => $this
->t('The URL can be absolute or relative to the server base url. The relative paths will be automatically extended with the site base URL. If you are using SLO, this setting is probably useless (depending on the IdP)'),
'#maxlength' => 128,
'#size' => 64,
'#default_value' => $config
->get('url_redirect_logout'),
];
$form['logout_settings']['logout_error_message'] = [
'#type' => 'textarea',
'#title' => $this
->t('Error Page Message'),
'#default_value' => $config
->get('logout_error_message'),
'#description' => $this
->t('Error message displayed to the user (if an error occurs).'),
];
// $form['advanced_saml2_settings'] = array(
// '#type' => 'details',
// '#title' => $this->t('Advanced SAML2 Settings'),
// '#open' => 'open',
// );
// $form['advanced_saml2_settings']['enable_passive_authentication'] = [
// '#type' => 'checkbox',
// '#title' => $this->t('Enable passive authentication'),
// '#description' => $this->t('Enable passive authentication'),
// '#default_value' => $config->get('enable_passive_authentication'),
// ];
// $form['advanced_saml2_settings']['enable_forced_authentication'] = [
// '#type' => 'checkbox',
// '#title' => $this->t('Enable forced authentication'),
// '#description' => $this->t('Enable forced authentication'),
// '#default_value' => $config->get('enable_forced_authentication'),
// ];.
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$this
->config('shib_auth.advancedsettings')
->set('url_redirect_logout', $form_state
->getValue('url_redirect_logout'))
->set('logout_error_message', $form_state
->getValue('logout_error_message'))
->set('url_redirect_login', $form_state
->getValue('url_redirect_login'))
->save();
// Invalidate the cache for the Shib login block.
\Drupal::service('cache_tags.invalidator')
->invalidateTags([
'shibboleth_login_block',
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AdvancedSettings:: |
public | function |
Form constructor. Overrides ConfigFormBase:: |
|
AdvancedSettings:: |
protected | function |
Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait:: |
|
AdvancedSettings:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
AdvancedSettings:: |
public | function |
Form submission handler. Overrides ConfigFormBase:: |
|
AdvancedSettings:: |
public | function |
Form validation handler. Overrides FormBase:: |
|
ConfigFormBase:: |
public static | function |
Instantiates a new instance of this class. Overrides FormBase:: |
13 |
ConfigFormBase:: |
public | function | Constructs a \Drupal\system\ConfigFormBase object. | 11 |
ConfigFormBaseTrait:: |
protected | function | Retrieves a configuration object. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
FormBase:: |
protected | property | The config factory. | 1 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 1 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function |
Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait:: |
|
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
LinkGeneratorTrait:: |
protected | property | The link generator. | 1 |
LinkGeneratorTrait:: |
protected | function | Returns the link generator. | |
LinkGeneratorTrait:: |
protected | function | Renders a link to a route given a route name and its parameters. | |
LinkGeneratorTrait:: |
public | function | Sets the link generator service. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |