/**
  * Overrides OpenIDConnectClientBase::settingsForm().
  */
 public function settingsForm()
 {
     $form = parent::settingsForm();
     $default_site = 'https://example.com/oauth2';
     $form['authorization_endpoint'] = array('#title' => t('Authorization endpoint'), '#type' => 'textfield', '#default_value' => $this->getSetting('authorization_endpoint', $default_site . '/authorize'));
     $form['token_endpoint'] = array('#title' => t('Token endpoint'), '#type' => 'textfield', '#default_value' => $this->getSetting('token_endpoint', $default_site . '/token'));
     $form['userinfo_endpoint'] = array('#title' => t('UserInfo endpoint'), '#type' => 'textfield', '#default_value' => $this->getSetting('userinfo_endpoint', $default_site . '/UserInfo'));
     return $form;
 }
 /**
  * Overrides OpenIDConnectClientBase::retrieveUserInfo().
  */
 public function retrieveUserInfo($access_token)
 {
     $userinfo = parent::retrieveUserInfo($access_token);
     if ($userinfo) {
         // For some reason Google returns the URI of the profile picture in a
         // weird format: "https:" appears twice in the beginning of the URI.
         // Using a regular expression matching for fixing it guarantees that
         // things won't break if Google changes the way the URI is returned.
         preg_match('/https:\\/\\/*.*/', $userinfo['picture'], $matches);
         $userinfo['picture'] = $matches[0];
     }
     return $userinfo;
 }