/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/api-functional/testsuite/Magento/GraphQl/GetCustomerAuthenticationHeader.php
44 строки
1 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2020 Adobe * All Rights Reserved. */ declare(strict_types=1); namespace Magento\GraphQl; use Magento\Framework\Exception\AuthenticationException; use Magento\Integration\Api\CustomerTokenServiceInterface; /** * Get authentication header for customer */ class GetCustomerAuthenticationHeader { /** * @var CustomerTokenServiceInterface */ private $customerTokenService; /** * @param CustomerTokenServiceInterface $customerTokenService */ public function __construct(CustomerTokenServiceInterface $customerTokenService) { $this->customerTokenService = $customerTokenService; } /** * Get header to perform customer authenticated request * * @param string $email * @param string $password * @return string[] * @throws AuthenticationException */ public function execute(string $email = 'customer@example.com', string $password = 'password'): array { $customerToken = $this->customerTokenService->createCustomerAccessToken($email, $password); return ['Authorization' => 'Bearer ' . $customerToken]; } }