public function OpenIDConnectLoginForm::submitForm in OpenID Connect / OAuth client 8
Same name and namespace in other branches
- 2.x src/Form/OpenIDConnectLoginForm.php \Drupal\openid_connect\Form\OpenIDConnectLoginForm::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 FormInterface::submitForm
File
- src/Form/ OpenIDConnectLoginForm.php, line 106 
Class
- OpenIDConnectLoginForm
- Provides the OpenID Connect login form.
Namespace
Drupal\openid_connect\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->session
    ->saveDestination();
  $client_name = $form_state
    ->getTriggeringElement()['#name'];
  $configuration = $this
    ->config('openid_connect.settings.' . $client_name)
    ->get('settings');
  /** @var \Drupal\openid_connect\Plugin\OpenIDConnectClientInterface $client */
  $client = $this->pluginManager
    ->createInstance($client_name, $configuration);
  $scopes = $this->claims
    ->getScopes($client);
  $_SESSION['openid_connect_op'] = 'login';
  $response = $client
    ->authorize($scopes, $form_state);
  $form_state
    ->setResponse($response);
}