class ShibbolethSettings in Shibboleth Authentication 8
Class ShibbolethSettings.
@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\ShibbolethSettings
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
Expanded class hierarchy of ShibbolethSettings
1 string reference to 'ShibbolethSettings'
File
- src/
Form/ ShibbolethSettings.php, line 13
Namespace
Drupal\shib_auth\FormView source
class ShibbolethSettings extends ConfigFormBase {
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return [
'shib_auth.shibbolethsettings',
];
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'shibboleth_settings';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('shib_auth.shibbolethsettings');
$form['shibboleth_handler_settings'] = [
'#type' => 'details',
'#title' => $this
->t('Shibboleth Handler Settings'),
'#open' => 'open',
];
$form['shibboleth_handler_settings']['shibboleth_login_handler_url'] = [
'#type' => 'textfield',
'#title' => $this
->t('Shibboleth login handler URL'),
'#description' => $this
->t('The URL can be absolute or relative to the server base url: http://www.example.com/Shibboleth.sso/DS; /Shibboleth.sso/DS'),
'#maxlength' => 128,
'#size' => 64,
'#default_value' => $config
->get('shibboleth_login_handler_url'),
];
$form['shibboleth_handler_settings']['shibboleth_logout_handler_url'] = [
'#type' => 'textfield',
'#title' => $this
->t('Shibboleth logout handler URL'),
'#description' => $this
->t('The URL can be absolute or relative to the server base url: http://www.example.com/Shibboleth.sso/Logout; /Shibboleth.sso/Logout'),
'#maxlength' => 128,
'#size' => 64,
'#default_value' => $config
->get('shibboleth_logout_handler_url'),
];
$form['shibboleth_handler_settings']['shibboleth_login_link_text'] = [
'#type' => 'textfield',
'#title' => $this
->t('Shibboleth login link text'),
'#description' => $this
->t('The text of the login link. You can change this text on the Shibboleth login block settings form too!'),
'#maxlength' => 128,
'#size' => 64,
'#default_value' => $config
->get('shibboleth_login_link_text'),
];
$form['shibboleth_handler_settings']['force_https_on_login'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Force HTTPS on login'),
'#description' => $this
->t('The user will be redirected to HTTPS'),
'#default_value' => $config
->get('force_https_on_login'),
];
$form['attribute_settings'] = [
'#type' => 'details',
'#title' => $this
->t('Attribute Settings'),
'#open' => 'open',
];
$form['attribute_settings']['server_variable_username'] = [
'#type' => 'textfield',
'#title' => $this
->t('Server variable for username'),
'#maxlength' => 128,
'#size' => 64,
'#default_value' => $config
->get('server_variable_username'),
];
$form['attribute_settings']['server_variable_email'] = [
'#type' => 'textfield',
'#title' => $this
->t('Server variable for e-mail address'),
'#maxlength' => 128,
'#size' => 64,
'#default_value' => $config
->get('server_variable_email'),
];
// $form['attribute_settings']['user_defined_usernames'] = [
// '#type' => 'checkbox',
// '#title' => $this->t('User-defined usernames'),
// '#description' => $this->t('Allow users to set their Drupal usernames at first Shibboleth login. Note that disabling this option only prevents new users from registering their own username. Existing user-defined usernames will remain valid.'),
// '#default_value' => $config->get('user_defined_usernames'),
// ];
// $form['attribute_settings']['user_defined_email'] = [
// '#type' => 'checkbox',
// '#title' => $this->t('User-defined email addresses'),
// '#description' => $this->t('Ask users to set their contact email address at first login. Disabling this option will override contact address with the one, which was received from IdP. (In this case, missing e-mail address will result in fatal error.)'),
// '#default_value' => $config->get('user_defined_email'),
// ];
// $form['attribute_settings']['account_linking'] = [
// '#type' => 'checkbox',
// '#title' => $this->t('Account Linking'),
// '#description' => $this->t('Allow locally authenticated users to link their Drupal accounts to federated logins. Note that disabling this option only prevents from creating/removing associations, existing links will remain valid.'),
// '#default_value' => $config->get('account_linking'),
// ];
// $form['attribute_settings']['shibboleth_account_linking_text'] = [
// '#type' => 'textfield',
// '#title' => $this->t('Shibboleth account linking text'),
// '#description' => $this->t('The text of the link providing account linking shown on the user settings form.'),
// '#maxlength' => 128,
// '#size' => 64,
// '#default_value' => $config->get('shibboleth_account_linking_text'),
// ];.
$form['debugging_options'] = [
'#type' => 'details',
'#title' => $this
->t('Debugging Options'),
'#open' => 'open',
];
$form['debugging_options']['enable_debug_mode'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable DEBUG mode.'),
'#default_value' => $config
->get('enable_debug_mode'),
];
$form['debugging_options']['debug_prefix_path'] = [
'#type' => 'textfield',
'#title' => $this
->t('DEBUG path prefix'),
'#description' => $this
->t("For example, use \"/user/\" to display DEBUG messages on paths like \"/user/*\"."),
'#maxlength' => 128,
'#size' => 64,
'#default_value' => $config
->get('debug_prefix_path'),
];
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.shibbolethsettings')
->set('shibboleth_login_handler_url', $form_state
->getValue('shibboleth_login_handler_url'))
->set('shibboleth_logout_handler_url', $form_state
->getValue('shibboleth_logout_handler_url'))
->set('shibboleth_login_link_text', $form_state
->getValue('shibboleth_login_link_text'))
->set('force_https_on_login', $form_state
->getValue('force_https_on_login'))
->set('server_variable_username', $form_state
->getValue('server_variable_username'))
->set('server_variable_email', $form_state
->getValue('server_variable_email'))
->set('enable_debug_mode', $form_state
->getValue('enable_debug_mode'))
->set('debug_prefix_path', $form_state
->getValue('debug_prefix_path'))
->save();
// Invalidate the cache for the Shib login block.
\Drupal::service('cache_tags.invalidator')
->invalidateTags([
'shibboleth_login_block',
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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. | |
ShibbolethSettings:: |
public | function |
Form constructor. Overrides ConfigFormBase:: |
|
ShibbolethSettings:: |
protected | function |
Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait:: |
|
ShibbolethSettings:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
ShibbolethSettings:: |
public | function |
Form submission handler. Overrides ConfigFormBase:: |
|
ShibbolethSettings:: |
public | function |
Form validation handler. Overrides FormBase:: |
|
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. |