You are here

function openid_connect_update_8207 in OpenID Connect / OAuth client 2.x

Update generic plugins with End Session endpoint and logout redirect URL.

File

./openid_connect.install, line 248
Install, update and uninstall functions for the OpenID Connect module.

Code

function openid_connect_update_8207() {
  $clients = \Drupal::entityTypeManager()
    ->getStorage('openid_connect_client')
    ->loadByProperties([
    'plugin' => 'generic',
  ]);
  foreach ($clients as $client) {
    $config = $client
      ->getPlugin()
      ->getConfiguration();
    if (empty($config['end_session_endpoint'])) {
      $client
        ->getPlugin()
        ->setConfiguration([
        'end_session_endpoint' => '',
      ]);
      $client
        ->save();
    }
  }
  $config = \Drupal::configFactory()
    ->getEditable('openid_connect.settings');
  $config
    ->set('redirect_logout', '');
  $config
    ->save(TRUE);
}