Commit 938b6c4e by Paul Klimov

Google open id default params added.

parent de83e4dd
......@@ -25,7 +25,7 @@ class AuthAction extends Action
/**
* @var string name of the auth client collection application component.
*/
public $clientCollection;
public $clientCollection = 'auth';
/**
* @var string name of the GET param, which is used to passed auth client id to this action.
*/
......@@ -227,7 +227,7 @@ class AuthAction extends Action
break;
}
} else {
$provider->identity = $provider->authUrl; // Setting identifier
//$provider->identity = $provider->authUrl; // Setting identifier
$request = Yii::$app->getRequest();
$provider->realm = $request->getHostInfo();
$provider->returnUrl = $provider->realm . $request->getUrl(); // getting return URL
......
......@@ -540,7 +540,7 @@ class OpenId extends Component implements ClientInterface
$counts = [];
$required = [];
$optional = [];
foreach (['required', 'optional'] as $type) {
foreach (['requiredAttributes', 'optional'] as $type) {
foreach ($this->$type as $alias => $field) {
if (is_int($alias)) {
$alias = strtr($field, '/', '_');
......@@ -626,7 +626,6 @@ class OpenId extends Component implements ClientInterface
$params['openid.identity'] = $this->identity;
$params['openid.claimed_id'] = $this->claimed_id;
}
return $this->buildUrl(parse_url($this->server), ['query' => http_build_query($params, '', '&')]);
}
......@@ -747,7 +746,7 @@ class OpenId extends Component implements ClientInterface
protected function getSregAttributes()
{
$attributes = array();
$attributes = [];
$sregToAx = array_flip(self::$axToSregMap);
foreach ($this->data as $key => $value) {
$keyMatch = 'openid_sreg_';
......
......@@ -17,5 +17,15 @@ use yii\authclient\OpenId;
*/
class GoogleOpenId extends OpenId
{
public function init()
{
parent::init();
$this->setIdentity('https://www.google.com/accounts/o8/id');
$this->requiredAttributes = [
'namePerson/first',
'namePerson/last',
'contact/email',
'pref/language',
];
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment