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.
86 lines
1.4 KiB
86 lines
1.4 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
|
* YandexOpenId allows authentication via Yandex OpenId.
|
||
|
* Unlike Yandex OAuth you do not need to register your application anywhere in order to use Yandex OpenId.
|
||
11 years ago
|
*
|
||
11 years ago
|
* Example application configuration:
|
||
|
*
|
||
|
* ~~~
|
||
|
* 'components' => [
|
||
|
* 'authClientCollection' => [
|
||
|
* 'class' => 'yii\authclient\Collection',
|
||
|
* 'clients' => [
|
||
|
* 'yandex' => [
|
||
|
* 'class' => 'yii\authclient\clients\YandexOpenId'
|
||
|
* ],
|
||
|
* ],
|
||
|
* ]
|
||
|
* ...
|
||
|
* ]
|
||
|
* ~~~
|
||
|
*
|
||
11 years ago
|
* @author Paul Klimov <klimov.paul@gmail.com>
|
||
|
* @since 2.0
|
||
|
*/
|
||
|
class YandexOpenId extends OpenId
|
||
|
{
|
||
11 years ago
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
11 years ago
|
public $authUrl = 'http://openid.yandex.ru';
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public $requiredAttributes = [
|
||
|
'namePerson',
|
||
|
'contact/email',
|
||
|
];
|
||
11 years ago
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
11 years ago
|
protected function defaultNormalizeUserAttributeMap()
|
||
|
{
|
||
|
return [
|
||
|
'name' => 'namePerson',
|
||
|
'email' => 'contact/email',
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
11 years ago
|
protected function defaultViewOptions()
|
||
|
{
|
||
|
return [
|
||
|
'popupWidth' => 900,
|
||
|
'popupHeight' => 550,
|
||
|
];
|
||
|
}
|
||
11 years ago
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
protected function defaultName()
|
||
|
{
|
||
|
return 'yandex';
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
protected function defaultTitle()
|
||
|
{
|
||
|
return 'Yandex';
|
||
|
}
|
||
11 years ago
|
}
|