Browse Source

Google open id default params added.

tags/2.0.0-beta
Paul Klimov 11 years ago
parent
commit
938b6c4e9e
  1. 4
      extensions/yii/authclient/AuthAction.php
  2. 5
      extensions/yii/authclient/OpenId.php
  3. 12
      extensions/yii/authclient/clients/GoogleOpenId.php

4
extensions/yii/authclient/AuthAction.php

@ -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

5
extensions/yii/authclient/OpenId.php

@ -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_';

12
extensions/yii/authclient/clients/GoogleOpenId.php

@ -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',
];
}
}
Loading…
Cancel
Save