Skip to content

Commit 54b2ab0

Browse files
committed
Add related functions
1 parent 6d1fd4d commit 54b2ab0

10 files changed

+43
-23
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "authing-sdk/php",
33
"description": "authing-php-sdk",
44
"minimum-stability": "stable",
5-
"version": "4.1.6",
5+
"version": "4.1.7",
66
"require": {
77
"php": ">=5.4",
88
"ext-curl": "*",

src/Auth/AuthenticationClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ function getUserInfoByAccessToken(string $accessToken)
975975

976976
function getOidcHeaders()
977977
{
978-
$SDK_VERSION = "4.1.0";
978+
$SDK_VERSION = "4.1.7";
979979
return [
980980
'x-authing-sdk-version' => 'php:' . $SDK_VERSION,
981981
'x-authing-userpool-id' => (isset($this->options->userPoolId) ? $this->options->userPoolId : ""),

src/BaseClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ abstract class BaseClient
2121

2222
private $_type = "SDK";
2323

24-
private $_version = "php:4.1.6";
24+
private $_version = "php:4.1.7";
2525

2626
private $publicKey
2727
= <<<PUBLICKKEY

src/Mgmt/UdfManagementClient.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ public function listUdv(string $targetType, string $targetId)
8181
{
8282
$param = new UdvParam($targetType, $targetId);
8383
$res = $this->client->request($param->createRequest());
84-
$list = $res->udv;
85-
return convertUdv($list);
84+
if ($res) {
85+
return Utils::convertUdv((array)$res);
86+
}
87+
return [];
8688
}
8789

8890
public function setUdvBatch(string $targetType, string $targetId, array $udvList)
@@ -94,7 +96,11 @@ public function setUdvBatch(string $targetType, string $targetId, array $udvList
9496
];
9597
}, $udvList);
9698
$param = (new SetUdvBatchParam($targetType, $targetId))->withUdvList($data);
97-
$list = $this->client->request($param->createRequest())->setUdvBatch;
98-
return Utils::convertUdv($list);
99+
$res = $this->client->request($param->createRequest());
100+
if ($res) {
101+
// $list = $res->setUdvBatch;
102+
return Utils::convertUdv((array)$res);
103+
}
104+
return [];
99105
}
100106
}

src/Mgmt/Utils.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Authing\Mgmt;
44

5+
use Authing\Types\UDFDataType;
56

67
class Utils
78
{

tmp/Auth/AuthenticationClientTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77

88
$authenticationClient = new AuthenticationClient(function ($ops) {
9-
$ops->appId = "606dd67c164539e1c90f4d83";
9+
$ops->appId = "---";
1010
});
1111

12-
$authenticationClient->loginByEmail(new LoginByEmailInput("1409458062@qq.com", "admin"));
12+
$authenticationClient->loginByEmail(new LoginByEmailInput("--", "-"));
1313

1414
$res = $authenticationClient->getCurrentUser();
1515

tmp/Mgmt/AclManagementClientTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
use Authing\Types\PolicyAssignmentTargetType;
66

77
// $client = new AuthenticationClient(function($options) {
8-
// $options->appId = '5f97fb40d352ecf69ffe6d98';
9-
// $options->secret = '19938f6ef3c84360a9c0ab73c2cc88d7';
8+
// $options->appId = '--';
9+
// $options->secret = '--';
1010
// $options->redirectUri = 'http://localhost:3000';
1111
// $options->appHost = 'https://localhost';
1212
// $options->protocol = 'oidc';
1313
// });
14-
$client = new ManagementClient('5f88506c81cd279930195660', 'f6bbab3309f021639c6b04d6e54133cd');
14+
$client = new ManagementClient('--', '--');
1515
// $client = new ManagementClient('605ae5ebf3e8478bba488c38', 'aa30679b3e0bb3710bcd60af4e4b684d');
1616

1717
// $client->setHost('http://localhost:3000');

tmp/Mgmt/ApplicationsManagementClientTest copy.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
use Authing\Types\PolicyAssignmentTargetType;
66

77
// $client = new AuthenticationClient(function($options) {
8-
// $options->appId = '5f97fb40d352ecf69ffe6d98';
9-
// $options->secret = '19938f6ef3c84360a9c0ab73c2cc88d7';
8+
// $options->appId = '--';
9+
// $options->secret = '-----';
1010
// $options->redirectUri = 'http://localhost:3000';
1111
// $options->appHost = 'https://localhost';
1212
// $options->protocol = 'oidc';
1313
// });
14-
$client = new ManagementClient('5f88506c81cd279930195660', 'f6bbab3309f021639c6b04d6e54133cd');
14+
$client = new ManagementClient('--', '--');
1515
// $client = new ManagementClient('605ae5ebf3e8478bba488c38', 'aa30679b3e0bb3710bcd60af4e4b684d');
1616

1717
// $client->setHost('http://localhost:3000');

tmp/Mgmt/ApplicationsManagementClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use Authing\Mgmt\ManagementClient;
55

66

7-
$client = new ManagementClient('5f88506c81cd279930195660', 'f6bbab3309f021639c6b04d6e54133cd');
7+
$client = new ManagementClient('---', '---');
88

99
$client->requestToken();
1010
$appManageClient = $client->applications();

tmp/Mgmt/UdfManagementClientTest.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,35 @@
44
use Authing\Mgmt\ManagementClient;
55
use Authing\Types\UDFTargetType;
66

7-
$client = new ManagementClient('5f88506c81cd279930195660', 'f6bbab3309f021639c6b04d6e54133cd');
7+
$client = new ManagementClient('---', '---');
8+
// $client = new ManagementClient('605ae5ebf3e8478bba488c38', 'aa30679b3e0bb3710bcd60af4e4b684d');
9+
810

911
// $client->setHost('http://localhost:3000');
1012
$client->requestToken();
1113
$udfManageClient = $client->udf();
1214

1315
// 获取某一实体的自定义字段数据列表
1416
// $res = $udfManageClient->listUdv(UDFTargetType::USER, '6073e46da6c86d84a9def94a');
17+
$res = $udfManageClient->listUdv(UDFTargetType::USER, '--');
18+
// [
19+
// {
20+
// "key": "好家伙",
21+
// "dataType": "STRING",
22+
// "value": "this is value",
23+
// "label": "这是一个扩展字段"
24+
// }
25+
// ]
26+
1527

1628
// 批量添加自定义数据
17-
$res = $udfManageClient->setUdvBatch(UDFTargetType::USER, '6073e46da6c86d84a9def94a', [
18-
(object) [
19-
'key' => 'this is key',
20-
'value' => 'this is value',
21-
],
22-
]);
29+
// $res = $udfManageClient->setUdvBatch(UDFTargetType::USER, '606fd22265371f55fdb1bfad', [
30+
// (object) [
31+
// 'key' => '好家伙',
32+
// 'value' => 'this is value',
33+
// ],
34+
// ]);
35+
2336

2437
$a = json_encode($res);
2538
echo $a;

0 commit comments

Comments
 (0)