diff --git a/extensions/authclient/clients/GoogleOpenId.php b/extensions/authclient/clients/GoogleOpenId.php new file mode 100644 index 0000000000..0613780aa3 --- /dev/null +++ b/extensions/authclient/clients/GoogleOpenId.php @@ -0,0 +1,96 @@ + [ + * 'authClientCollection' => [ + * 'class' => 'yii\authclient\Collection', + * 'clients' => [ + * 'google' => [ + * 'class' => 'yii\authclient\clients\GoogleOpenId' + * ], + * ], + * ] + * ... + * ] + * ~~~ + * + * @author Paul Klimov + * @since 2.0 + */ +class GoogleOpenId extends OpenId +{ + /** + * @inheritdoc + */ + public $authUrl = 'https://www.google.com/accounts/o8/id'; + /** + * @inheritdoc + */ + public $requiredAttributes = [ + 'namePerson/first', + 'namePerson/last', + 'contact/email', + 'pref/language', + ]; + + + /** + * @inheritdoc + */ + protected function defaultNormalizeUserAttributeMap() + { + return [ + 'first_name' => 'namePerson/first', + 'last_name' => 'namePerson/last', + 'email' => 'contact/email', + 'language' => 'pref/language', + ]; + } + + /** + * @inheritdoc + */ + protected function defaultViewOptions() + { + return [ + 'popupWidth' => 880, + 'popupHeight' => 520, + ]; + } + + /** + * @inheritdoc + */ + protected function defaultName() + { + return 'google'; + } + + /** + * @inheritdoc + */ + protected function defaultTitle() + { + return 'Google'; + } +} diff --git a/extensions/authclient/widgets/GooglePlusButton.php b/extensions/authclient/widgets/GooglePlusButton.php index 683dbdda46..8833cb4242 100644 --- a/extensions/authclient/widgets/GooglePlusButton.php +++ b/extensions/authclient/widgets/GooglePlusButton.php @@ -158,7 +158,6 @@ JS; 'data-scope' => $this->client->scope, 'data-accesstype' => 'offline', 'data-width' => 'iconOnly', - //'data-approvalprompt' => 'force', ], $this->buttonHtmlOptions ); diff --git a/tests/unit/extensions/authclient/OpenIdTest.php b/tests/unit/extensions/authclient/OpenIdTest.php index 6e2bde0492..903175d52b 100644 --- a/tests/unit/extensions/authclient/OpenIdTest.php +++ b/tests/unit/extensions/authclient/OpenIdTest.php @@ -64,7 +64,7 @@ class OpenIdTest extends TestCase public function testDiscover() { - $url = 'https://www.google.com/accounts/o8/id'; + $url = 'http://openid.yandex.ru'; $client = new OpenId(); $info = $client->discover($url); $this->assertNotEmpty($info);