mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-14 05:08:42 +08:00
OpenId::buildAxParams() fixed to add "openid.ax.required" parameter if required attributes are not empty.
This commit is contained in:
@@ -638,8 +638,8 @@ class OpenId extends BaseClient implements ClientInterface
|
|||||||
$params['openid.ax.mode'] = 'fetch_request';
|
$params['openid.ax.mode'] = 'fetch_request';
|
||||||
$aliases = [];
|
$aliases = [];
|
||||||
$counts = [];
|
$counts = [];
|
||||||
$required = [];
|
$requiredAttributes = [];
|
||||||
$optional = [];
|
$optionalAttributes = [];
|
||||||
foreach (['requiredAttributes', 'optionalAttributes'] as $type) {
|
foreach (['requiredAttributes', 'optionalAttributes'] as $type) {
|
||||||
foreach ($this->$type as $alias => $field) {
|
foreach ($this->$type as $alias => $field) {
|
||||||
if (is_int($alias)) {
|
if (is_int($alias)) {
|
||||||
@@ -665,11 +665,11 @@ class OpenId extends BaseClient implements ClientInterface
|
|||||||
|
|
||||||
// Don't send empty ax.requied and ax.if_available.
|
// Don't send empty ax.requied and ax.if_available.
|
||||||
// Google and possibly other providers refuse to support ax when one of these is empty.
|
// Google and possibly other providers refuse to support ax when one of these is empty.
|
||||||
if ($required) {
|
if (!empty($requiredAttributes)) {
|
||||||
$params['openid.ax.required'] = implode(',', $required);
|
$params['openid.ax.required'] = implode(',', $requiredAttributes);
|
||||||
}
|
}
|
||||||
if ($optional) {
|
if (!empty($optionalAttributes)) {
|
||||||
$params['openid.ax.if_available'] = implode(',', $optional);
|
$params['openid.ax.if_available'] = implode(',', $optionalAttributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $params;
|
return $params;
|
||||||
|
|||||||
Reference in New Issue
Block a user