You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
1.6 KiB
90 lines
1.6 KiB
11 years ago
|
<?php
|
||
|
/**
|
||
|
* @link http://www.yiiframework.com/
|
||
|
* @copyright Copyright (c) 2008 Yii Software LLC
|
||
|
* @license http://www.yiiframework.com/license/
|
||
|
*/
|
||
|
|
||
|
namespace yii\authclient\clients;
|
||
|
|
||
|
use yii\authclient\OpenId;
|
||
|
|
||
|
/**
|
||
11 years ago
|
* GoogleOpenId allows authentication via Google OpenId.
|
||
|
* Unlike Google OAuth you do not need to register your application anywhere in order to use Google OpenId.
|
||
11 years ago
|
*
|
||
11 years ago
|
* Example application configuration:
|
||
|
*
|
||
|
* ~~~
|
||
|
* 'components' => [
|
||
|
* 'authClientCollection' => [
|
||
|
* 'class' => 'yii\authclient\Collection',
|
||
|
* 'clients' => [
|
||
|
* 'google' => [
|
||
|
* 'class' => 'yii\authclient\clients\GoogleOpenId'
|
||
|
* ],
|
||
|
* ],
|
||
|
* ]
|
||
|
* ...
|
||
|
* ]
|
||
|
* ~~~
|
||
|
*
|
||
11 years ago
|
* @author Paul Klimov <klimov.paul@gmail.com>
|
||
|
* @since 2.0
|
||
|
*/
|
||
|
class GoogleOpenId extends OpenId
|
||
|
{
|
||
11 years ago
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
11 years ago
|
public $authUrl = 'https://www.google.com/accounts/o8/id';
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public $requiredAttributes = [
|
||
|
'namePerson/first',
|
||
|
'namePerson/last',
|
||
|
'contact/email',
|
||
|
'pref/language',
|
||
|
];
|
||
11 years ago
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
11 years ago
|
protected function defaultNormalizeUserAttributeMap()
|
||
|
{
|
||
|
return [
|
||
|
'first_name' => 'namePerson/first',
|
||
|
'last_name' => 'namePerson/last',
|
||
|
'email' => 'contact/email',
|
||
|
'language' => 'pref/language',
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
11 years ago
|
protected function defaultViewOptions()
|
||
|
{
|
||
|
return [
|
||
|
'popupWidth' => 880,
|
||
|
'popupHeight' => 520,
|
||
|
];
|
||
|
}
|
||
11 years ago
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
protected function defaultName()
|
||
|
{
|
||
|
return 'google';
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
protected function defaultTitle()
|
||
|
{
|
||
|
return 'Google';
|
||
|
}
|
||
11 years ago
|
}
|