Commit 938b6c4e by Paul Klimov

Google open id default params added.

parent de83e4dd
...@@ -25,7 +25,7 @@ class AuthAction extends Action ...@@ -25,7 +25,7 @@ class AuthAction extends Action
/** /**
* @var string name of the auth client collection application component. * @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. * @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 ...@@ -227,7 +227,7 @@ class AuthAction extends Action
break; break;
} }
} else { } else {
$provider->identity = $provider->authUrl; // Setting identifier //$provider->identity = $provider->authUrl; // Setting identifier
$request = Yii::$app->getRequest(); $request = Yii::$app->getRequest();
$provider->realm = $request->getHostInfo(); $provider->realm = $request->getHostInfo();
$provider->returnUrl = $provider->realm . $request->getUrl(); // getting return URL $provider->returnUrl = $provider->realm . $request->getUrl(); // getting return URL
......
...@@ -540,7 +540,7 @@ class OpenId extends Component implements ClientInterface ...@@ -540,7 +540,7 @@ class OpenId extends Component implements ClientInterface
$counts = []; $counts = [];
$required = []; $required = [];
$optional = []; $optional = [];
foreach (['required', 'optional'] as $type) { foreach (['requiredAttributes', 'optional'] as $type) {
foreach ($this->$type as $alias => $field) { foreach ($this->$type as $alias => $field) {
if (is_int($alias)) { if (is_int($alias)) {
$alias = strtr($field, '/', '_'); $alias = strtr($field, '/', '_');
...@@ -626,7 +626,6 @@ class OpenId extends Component implements ClientInterface ...@@ -626,7 +626,6 @@ class OpenId extends Component implements ClientInterface
$params['openid.identity'] = $this->identity; $params['openid.identity'] = $this->identity;
$params['openid.claimed_id'] = $this->claimed_id; $params['openid.claimed_id'] = $this->claimed_id;
} }
return $this->buildUrl(parse_url($this->server), ['query' => http_build_query($params, '', '&')]); return $this->buildUrl(parse_url($this->server), ['query' => http_build_query($params, '', '&')]);
} }
...@@ -747,7 +746,7 @@ class OpenId extends Component implements ClientInterface ...@@ -747,7 +746,7 @@ class OpenId extends Component implements ClientInterface
protected function getSregAttributes() protected function getSregAttributes()
{ {
$attributes = array(); $attributes = [];
$sregToAx = array_flip(self::$axToSregMap); $sregToAx = array_flip(self::$axToSregMap);
foreach ($this->data as $key => $value) { foreach ($this->data as $key => $value) {
$keyMatch = 'openid_sreg_'; $keyMatch = 'openid_sreg_';
......
...@@ -17,5 +17,15 @@ use yii\authclient\OpenId; ...@@ -17,5 +17,15 @@ use yii\authclient\OpenId;
*/ */
class GoogleOpenId extends 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