You are here

class OpenIDConnectClientGoogle in OpenID Connect / OAuth client 7

Implements OpenID Connect Client plugin for Google.

Hierarchy

Expanded class hierarchy of OpenIDConnectClientGoogle

1 string reference to 'OpenIDConnectClientGoogle'
google.inc in plugins/openid_connect_client/google/google.inc

File

plugins/openid_connect_client/google/OpenIDConnectClientGoogle.class.php, line 11
OpenID Connect client for Google.

View source
class OpenIDConnectClientGoogle extends OpenIDConnectClientBase {

  /**
   * {@inheritdoc}
   */
  public function getEndpoints() {
    return array(
      'authorization' => 'https://accounts.google.com/o/oauth2/auth',
      'token' => 'https://accounts.google.com/o/oauth2/token',
      'userinfo' => 'https://openidconnect.googleapis.com/v1/userinfo',
    );
  }

  /**
   * {@inheritdoc}
   */
  public function retrieveUserInfo($access_token) {
    $userinfo = parent::retrieveUserInfo($access_token);
    if (!empty($userinfo['picture'])) {

      // 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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
OpenIDConnectClientBase::$label protected property The human-readable name of the client plugin.
OpenIDConnectClientBase::$name protected property The machine name of the client plugin.
OpenIDConnectClientBase::$settings protected property Admin-provided configuration.
OpenIDConnectClientBase::authorize public function Redirects the user to the authorization endpoint. Overrides OpenIDConnectClientInterface::authorize
OpenIDConnectClientBase::decodeIdToken public function Decodes ID token to access user data. Overrides OpenIDConnectClientInterface::decodeIdToken
OpenIDConnectClientBase::getLabel public function Get the client's human-readable label. Overrides OpenIDConnectClientInterface::getLabel
OpenIDConnectClientBase::getName public function Get the client's machine name. Overrides OpenIDConnectClientInterface::getName
OpenIDConnectClientBase::getSetting public function Returns the value of a setting. Overrides OpenIDConnectClientInterface::getSetting
OpenIDConnectClientBase::retrieveTokens public function Retrieve access token and ID token. Overrides OpenIDConnectClientInterface::retrieveTokens
OpenIDConnectClientBase::settingsForm public function Returns the settings form. Overrides OpenIDConnectClientInterface::settingsForm 1
OpenIDConnectClientBase::settingsFormSubmit public function Handles the submitted settings form. Overrides OpenIDConnectClientInterface::settingsFormSubmit
OpenIDConnectClientBase::settingsFormValidate public function Validates the settings form. Overrides OpenIDConnectClientInterface::settingsFormValidate
OpenIDConnectClientBase::__construct public function Constructs a new OpenIDConnectClientBase.
OpenIDConnectClientGoogle::getEndpoints public function Returns an array of endpoints. Overrides OpenIDConnectClientBase::getEndpoints
OpenIDConnectClientGoogle::retrieveUserInfo public function Retrieves user info: additional user profile data. Overrides OpenIDConnectClientBase::retrieveUserInfo