public function SalesforceJWTPlugin::validateConfigurationForm in Salesforce Suite 8.4
Same name and namespace in other branches
- 5.0.x modules/salesforce_jwt/src/Plugin/SalesforceAuthProvider/SalesforceJWTPlugin.php \Drupal\salesforce_jwt\Plugin\SalesforceAuthProvider\SalesforceJWTPlugin::validateConfigurationForm()
Form validation handler.
Parameters
array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().
Overrides SalesforceAuthProviderPluginBase::validateConfigurationForm
File
- modules/
salesforce_jwt/ src/ Plugin/ SalesforceAuthProvider/ SalesforceJWTPlugin.php, line 140
Class
- SalesforceJWTPlugin
- JWT Oauth plugin.
Namespace
Drupal\salesforce_jwt\Plugin\SalesforceAuthProviderCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::validateConfigurationForm($form, $form_state);
if (empty($form_state
->getValue('provider_settings')) && $form_state
->getValue('provider_settings') == self::defaultConfiguration()) {
$form_state
->setError($form, $this
->t('Please fill in JWT provider settings.'));
return;
}
$this
->setConfiguration($form_state
->getValue('provider_settings'));
// Force new credentials from form input, rather than storage.
unset($this->credentials);
try {
// Bootstrap here by setting ID to provide a key to token storage.
$this->id = $form_state
->getValue('id');
$this
->requestAccessToken($this
->generateAssertion());
} catch (\Exception $e) {
$form_state
->setError($form, $e
->getMessage());
}
}