1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
jwtsender.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\Service\MicroService;
4
5use Bitrix\Main\Result;
6use Bitrix\Main\SystemException;
7use Bitrix\Main\Web\HttpClient;
8
9abstract class JWTSender extends BaseSender
10{
11 abstract protected function obtainJWToken();
12
13 protected function createHttpClient()
14 {
15 $httpClient = new HttpClient(
17 );
18
19 $token = $this->obtainJWToken();
20
21 if(!$token)
22 {
23 throw new SystemException('JWT Token must not be empty');
24 }
25
26 $httpClient->setHeader('Authorization', 'Bearer ' . $token);
27 return $httpClient;
28 }
29
30 public function performRequest($action, array $parameters = []): Result
31 {
32 $url = $this->getServiceUrl() . "/api/?action=" . $action;
33 $httpClient = $this->createHttpClient();
34 $result = $httpClient->query(HttpClient::HTTP_POST, $url, $parameters);
35
36 return $this->createAnswer(
37 $result,
38 $httpClient->getResult(),
39 $httpClient->getError(),
40 $httpClient->getStatus()
41 );
42 }
43}
performRequest($action, array $parameters=[])
Определения jwtsender.php:30
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$action
Определения file_dialog.php:21
$url
Определения iframe.php:7