From 80f7ed86366ec1a58fcf51e4435262f9b5d8c1c2 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Mon, 5 Feb 2024 16:14:28 +0900 Subject: [PATCH 01/18] =?UTF-8?q?fix:bin/console=E3=81=BE=E3=81=A7?= =?UTF-8?q?=E9=80=9A=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bundle/ApiBundle.php | 3 ++- PluginManager.php | 2 +- Resource/config/services.yaml | 2 +- Security/Core/Encoder/UserPasswordEncoder.php | 2 +- composer.json | 7 ++++--- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Bundle/ApiBundle.php b/Bundle/ApiBundle.php index 76e0657..8a18f7a 100644 --- a/Bundle/ApiBundle.php +++ b/Bundle/ApiBundle.php @@ -16,6 +16,7 @@ use Plugin\Api42\DependencyInjection\ApiExtension; use Plugin\Api42\DependencyInjection\Compiler\ApiCompilerPass; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; use Symfony\Component\HttpKernel\Bundle\Bundle; class ApiBundle extends Bundle @@ -27,7 +28,7 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new ApiCompilerPass()); } - public function getContainerExtension() + public function getContainerExtension(): ?ExtensionInterface { return new ApiExtension(); } diff --git a/PluginManager.php b/PluginManager.php index 30c80e5..0402fdc 100644 --- a/PluginManager.php +++ b/PluginManager.php @@ -18,7 +18,7 @@ use Eccube\Entity\Master\Authority; use Eccube\Plugin\AbstractPluginManager; use Eccube\Repository\AuthorityRoleRepository; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Psr\Container\ContainerInterface; class PluginManager extends AbstractPluginManager { diff --git a/Resource/config/services.yaml b/Resource/config/services.yaml index b5d6348..2785746 100644 --- a/Resource/config/services.yaml +++ b/Resource/config/services.yaml @@ -42,7 +42,7 @@ services: Plugin\Api42\EventListener\UserResolveListener: arguments: - '@Eccube\Security\Core\User\MemberProvider' - - '@Plugin\Api42\Security\Core\Encoder\UserPasswordEncoder' + - '@Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher' tags: - { name: kernel.event_listener, event: league.oauth2_server.event.user_resolve, method: onUserResolve } diff --git a/Security/Core/Encoder/UserPasswordEncoder.php b/Security/Core/Encoder/UserPasswordEncoder.php index 99ccdd5..694e4d5 100644 --- a/Security/Core/Encoder/UserPasswordEncoder.php +++ b/Security/Core/Encoder/UserPasswordEncoder.php @@ -17,7 +17,7 @@ use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Security\Core\User\UserInterface; -class UserPasswordEncoder implements UserPasswordEncoderInterface +class UserPasswordEncoder { /** * @var PasswordEncoder diff --git a/composer.json b/composer.json index 759b3a3..623fdc4 100644 --- a/composer.json +++ b/composer.json @@ -1,12 +1,13 @@ { - "name": "ec-cube/api42", - "version": "4.2.3", + "name": "ec-cube\/api42", + "version": "4.3.0", "description": "Web API", "type": "eccube-plugin", "require": { "ec-cube/plugin-installer": "^2.0", - "league/oauth2-server-bundle": "^0.3", + "league/oauth2-server-bundle": "^0.5", "nyholm/psr7": "^1.2", + "php-http/message-factory": "*", "webonyx/graphql-php": "^14.0" }, "extra": { From f3a27bec8541e1af35477e9f9ae0c05cbc115082 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Tue, 6 Feb 2024 10:07:25 +0900 Subject: [PATCH 02/18] =?UTF-8?q?fix:=E3=82=BF=E3=82=A4=E3=83=9D=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resource/config/services.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resource/config/services.yaml b/Resource/config/services.yaml index 2785746..377b248 100644 --- a/Resource/config/services.yaml +++ b/Resource/config/services.yaml @@ -42,7 +42,7 @@ services: Plugin\Api42\EventListener\UserResolveListener: arguments: - '@Eccube\Security\Core\User\MemberProvider' - - '@Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher' + - '@Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface' tags: - { name: kernel.event_listener, event: league.oauth2_server.event.user_resolve, method: onUserResolve } From d9c01745b8f24cb7f37b7ee634e9abc49d57cced Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Tue, 6 Feb 2024 12:08:42 +0900 Subject: [PATCH 03/18] =?UTF-8?q?fix:RedirectUri=E3=81=8C=E8=A6=8B?= =?UTF-8?q?=E3=81=A4=E3=81=8B=E3=82=89=E3=81=AA=E3=81=84=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/Admin/OAuthController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Controller/Admin/OAuthController.php b/Controller/Admin/OAuthController.php index ab49663..cf51af0 100644 --- a/Controller/Admin/OAuthController.php +++ b/Controller/Admin/OAuthController.php @@ -27,9 +27,9 @@ use League\Bundle\OAuth2ServerBundle\Manager\RefreshTokenManagerInterface; use League\Bundle\OAuth2ServerBundle\Model\AuthorizationCode; use League\Bundle\OAuth2ServerBundle\Model\Client; -use League\Bundle\OAuth2ServerBundle\Model\Grant; -use League\Bundle\OAuth2ServerBundle\Model\RedirectUri; -use League\Bundle\OAuth2ServerBundle\Model\Scope; +use League\Bundle\OAuth2ServerBundle\ValueObject\Grant; +use League\Bundle\OAuth2ServerBundle\ValueObject\RedirectUri; +use League\Bundle\OAuth2ServerBundle\ValueObject\Scope; use League\Bundle\OAuth2ServerBundle\OAuth2Grants; class OAuthController extends AbstractController From baea36a57bbfb283e16612c91f058815cd7eb9be Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Tue, 6 Feb 2024 12:09:53 +0900 Subject: [PATCH 04/18] =?UTF-8?q?fix:create=E3=83=A1=E3=82=BD=E3=83=83?= =?UTF-8?q?=E3=83=89=E3=81=8C=E5=AD=98=E5=9C=A8=E3=81=97=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EventListener/AuthorizationRequestResolveListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventListener/AuthorizationRequestResolveListener.php b/EventListener/AuthorizationRequestResolveListener.php index ca3437d..5208fd6 100644 --- a/EventListener/AuthorizationRequestResolveListener.php +++ b/EventListener/AuthorizationRequestResolveListener.php @@ -98,7 +98,7 @@ public function onAuthorizationRequestResolve(AuthorizationRequestResolveEvent $ $event->resolveAuthorization(AuthorizationRequestResolveEvent::AUTHORIZATION_DENIED); } } else { - $event->setResponse(Response::create($content)); + $event->setResponse(new Response($content)); } } } From 458f19d2f44bc081bbc816b136a27e1efb566fbd Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Wed, 7 Feb 2024 19:03:58 +0900 Subject: [PATCH 05/18] =?UTF-8?q?fix:$container=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tests/GraphQL/Mutation/UpdateShippedMutationTest.php | 10 +++++----- Tests/GraphQL/SchemaTest.php | 2 +- Tests/GraphQL/TypesTest.php | 2 +- Tests/Service/WebHookServiceTest.php | 4 ++-- Tests/Web/Admin/LoginControllerTest.php | 2 +- Tests/Web/Admin/OAuthControllerTest.php | 2 +- Tests/Web/ApiControllerTest.php | 8 +++++++- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Tests/GraphQL/Mutation/UpdateShippedMutationTest.php b/Tests/GraphQL/Mutation/UpdateShippedMutationTest.php index 6d2034b..082a446 100644 --- a/Tests/GraphQL/Mutation/UpdateShippedMutationTest.php +++ b/Tests/GraphQL/Mutation/UpdateShippedMutationTest.php @@ -42,11 +42,11 @@ public function setUp(): void { parent::setUp(); - $mailService = self::$container->get(MailService::class); - $orderStateMachine = self::$container->get(OrderStateMachine::class); - $orderStatusRepository = self::$container->get(OrderStatusRepository::class); - $types = self::$container->get(Types::class); - $shippingRepository = self::$container->get(ShippingRepository::class); + $mailService = self::getContainer()->get(MailService::class); + $orderStateMachine = self::getContainer()->get(OrderStateMachine::class); + $orderStatusRepository = self::getContainer()->get(OrderStatusRepository::class); + $types = self::getContainer()->get(Types::class); + $shippingRepository = self::getContainer()->get(ShippingRepository::class); $this->updateShippedMutation = new UpdateShippedMutation( $this->eccubeConfig, diff --git a/Tests/GraphQL/SchemaTest.php b/Tests/GraphQL/SchemaTest.php index a694bd6..21265c4 100644 --- a/Tests/GraphQL/SchemaTest.php +++ b/Tests/GraphQL/SchemaTest.php @@ -428,7 +428,7 @@ private function executeQuery($query, $variables = null, $readonly = false) { $op = OperationParams::create(['query' => $query, 'variables' => $variables], $readonly); $helper = new Helper(); - $config = ServerConfig::create()->setSchema(self::$container->get(Schema::class)); + $config = ServerConfig::create()->setSchema(self::getContainer()->get(Schema::class)); $result = $helper->executeOperation($config, $op); self::assertInstanceOf(ExecutionResult::class, $result); diff --git a/Tests/GraphQL/TypesTest.php b/Tests/GraphQL/TypesTest.php index c1293f7..88bed96 100644 --- a/Tests/GraphQL/TypesTest.php +++ b/Tests/GraphQL/TypesTest.php @@ -28,7 +28,7 @@ class TypesTest extends EccubeTestCase public function setUp(): void { parent::setUp(); - $this->types = self::$container->get(Types::class); + $this->types = self::getContainer()->get(Types::class); } /** diff --git a/Tests/Service/WebHookServiceTest.php b/Tests/Service/WebHookServiceTest.php index ad281b5..93d085b 100644 --- a/Tests/Service/WebHookServiceTest.php +++ b/Tests/Service/WebHookServiceTest.php @@ -23,13 +23,13 @@ class WebHookServiceTest extends EccubeTestCase { /** @var WebHookService */ - private $service; + private mixed $service; public function setUp(): void { parent::setUp(); - $this->service = self::$container->get(WebHookService::class); + $this->service = self::getContainer()->get(WebHookService::class); } public function testCreateRequest_withSecret() diff --git a/Tests/Web/Admin/LoginControllerTest.php b/Tests/Web/Admin/LoginControllerTest.php index 4bafe9f..ff2005f 100644 --- a/Tests/Web/Admin/LoginControllerTest.php +++ b/Tests/Web/Admin/LoginControllerTest.php @@ -41,7 +41,7 @@ public function testRoutingAdminLoginCheck() ] ); - $this->assertNotNull(self::$container->get('security.token_storage')->getToken(), 'ログインしているかどうか'); + $this->assertNotNull(self::getContainer()->get('security.token_storage')->getToken(), 'ログインしているかどうか'); } public function testRoutingAdminLogin_ログインしていない場合はログイン画面を表示() diff --git a/Tests/Web/Admin/OAuthControllerTest.php b/Tests/Web/Admin/OAuthControllerTest.php index bc91d8b..8cd9db3 100644 --- a/Tests/Web/Admin/OAuthControllerTest.php +++ b/Tests/Web/Admin/OAuthControllerTest.php @@ -32,7 +32,7 @@ public function setUp(): void { parent::setUp(); - $this->clientManager = self::$container->get(ClientManager::class); + $this->clientManager = self::getContainer()->get(ClientManager::class); } public function testRoutingAdminSettingSystemOAuth2Client() diff --git a/Tests/Web/ApiControllerTest.php b/Tests/Web/ApiControllerTest.php index 5bd4764..03d1eca 100644 --- a/Tests/Web/ApiControllerTest.php +++ b/Tests/Web/ApiControllerTest.php @@ -44,6 +44,11 @@ public function setUp(): void $this->clientRepository = self::$container->get(ClientRepositoryInterface::class); $this->accessTokenRepository = self::$container->get(AccessTokenRepositoryInterface::class); $this->authorizationServer = self::$container->get(AuthorizationServer::class); + $this->clientManager = self::getContainer()->get(ClientManager::class); + $this->clientRepository = self::getContainer()->get(ClientRepositoryInterface::class); + $this->accessTokenRepository = self::getContainer()->get(AccessTokenRepositoryInterface::class); + $this->authorizationServer = self::getContainer()->get(AuthorizationServer::class); + $this->scopeRepositoryInterface = self::getContainer()->get(ScopeRepositoryInterface::class); } /** @@ -89,7 +94,7 @@ private function newAccessToken($scopes) $client = new Client('', $identifier, $secret); $client->setScopes(...array_map(function ($s) { - return new \League\Bundle\OAuth2ServerBundle\Model\Scope($s); + return new \League\Bundle\OAuth2ServerBundle\ValueObject\Scope($s); }, $scopes)); $this->clientManager->save($client); $clientEntity = $this->clientRepository->getClientEntity($identifier, 'authorization_code', $secret); @@ -100,6 +105,7 @@ private function newAccessToken($scopes) $accessTokenEntity->setExpiryDateTime(new \DateTimeImmutable('+1 days', new \DateTimeZone('Asia/Tokyo'))); $accessTokenEntity->setUserIdentifier('admin'); $accessTokenEntity->setPrivateKey(new CryptKey(self::$container->getParameter('kernel.project_dir').'/app/PluginData/Api42/oauth/private.key')); + $accessTokenEntity->setPrivateKey(new CryptKey(self::getContainer()->get(EccubeConfig::class)->get('kernel.project_dir').'/app/PluginData/Api42/oauth/private.key')); array_walk($scopes, function ($s) use ($accessTokenEntity) { $scope = new Scope(); From 701e265a8a62daeb8d30e9711e4c731905d3e06e Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Wed, 7 Feb 2024 19:05:33 +0900 Subject: [PATCH 06/18] =?UTF-8?q?fix:scope=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tests/Web/ApiControllerTest.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Tests/Web/ApiControllerTest.php b/Tests/Web/ApiControllerTest.php index 03d1eca..7506c31 100644 --- a/Tests/Web/ApiControllerTest.php +++ b/Tests/Web/ApiControllerTest.php @@ -13,11 +13,13 @@ namespace Plugin\Api42\Tests\Web; +use Eccube\Common\EccubeConfig; use Eccube\Tests\Web\AbstractWebTestCase; use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\CryptKey; use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; use League\OAuth2\Server\Repositories\ClientRepositoryInterface; +use League\OAuth2\Server\Repositories\ScopeRepositoryInterface; use League\Bundle\OAuth2ServerBundle\Entity\AccessToken; use League\Bundle\OAuth2ServerBundle\Entity\Scope; use League\Bundle\OAuth2ServerBundle\Manager\Doctrine\ClientManager; @@ -26,24 +28,26 @@ class ApiControllerTest extends AbstractWebTestCase { /** @var ClientManager */ - private $clientManager; + private ClientManager $clientManager; /** @var ClientRepositoryInterface */ - private $clientRepository; + private ClientRepositoryInterface $clientRepository; /** @var AccessTokenRepositoryInterface */ private $accessTokenRepository; + private AccessTokenRepositoryInterface $accessTokenRepository; + + /** @var ScopeRepositoryInterface */ + private ScopeRepositoryInterface $scopeRepositoryInterface; /** @var AuthorizationServer */ - private $authorizationServer; + private AuthorizationServer $authorizationServer; public function setUp(): void { parent::setUp(); - $this->clientManager = self::$container->get(ClientManager::class); - $this->clientRepository = self::$container->get(ClientRepositoryInterface::class); - $this->accessTokenRepository = self::$container->get(AccessTokenRepositoryInterface::class); - $this->authorizationServer = self::$container->get(AuthorizationServer::class); + // containerの取得を修正 + // Error: Access to undeclared static property Plugin\Api42\Tests\Web\ApiControllerTest::$container $this->clientManager = self::getContainer()->get(ClientManager::class); $this->clientRepository = self::getContainer()->get(ClientRepositoryInterface::class); $this->accessTokenRepository = self::getContainer()->get(AccessTokenRepositoryInterface::class); @@ -104,7 +108,7 @@ private function newAccessToken($scopes) $accessTokenEntity->setClient($clientEntity); $accessTokenEntity->setExpiryDateTime(new \DateTimeImmutable('+1 days', new \DateTimeZone('Asia/Tokyo'))); $accessTokenEntity->setUserIdentifier('admin'); - $accessTokenEntity->setPrivateKey(new CryptKey(self::$container->getParameter('kernel.project_dir').'/app/PluginData/Api42/oauth/private.key')); + //Error: Access to undeclared static property Plugin\Api42\Tests\Web\ApiControllerTest::$container $accessTokenEntity->setPrivateKey(new CryptKey(self::getContainer()->get(EccubeConfig::class)->get('kernel.project_dir').'/app/PluginData/Api42/oauth/private.key')); array_walk($scopes, function ($s) use ($accessTokenEntity) { From f32a0fa95cc8b8fb02c6dda5848de676948e403a Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 8 Feb 2024 13:34:34 +0900 Subject: [PATCH 07/18] =?UTF-8?q?fix:service=E3=82=92public=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resource/config/services_test.yaml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Resource/config/services_test.yaml diff --git a/Resource/config/services_test.yaml b/Resource/config/services_test.yaml new file mode 100644 index 0000000..ef20c11 --- /dev/null +++ b/Resource/config/services_test.yaml @@ -0,0 +1,3 @@ +services: + _defaults: + public: true \ No newline at end of file From de45f4885baf1586829c7e08a408a6e1d5a31141 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 8 Feb 2024 13:37:10 +0900 Subject: [PATCH 08/18] =?UTF-8?q?fix:null=E8=A8=B1=E5=AE=B9=E5=9E=8B?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tests/Web/ApiControllerTest.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Tests/Web/ApiControllerTest.php b/Tests/Web/ApiControllerTest.php index 7506c31..02ea8fd 100644 --- a/Tests/Web/ApiControllerTest.php +++ b/Tests/Web/ApiControllerTest.php @@ -28,20 +28,19 @@ class ApiControllerTest extends AbstractWebTestCase { /** @var ClientManager */ - private ClientManager $clientManager; + private ?ClientManager $clientManager; /** @var ClientRepositoryInterface */ - private ClientRepositoryInterface $clientRepository; + private ?ClientRepositoryInterface $clientRepository; /** @var AccessTokenRepositoryInterface */ - private $accessTokenRepository; - private AccessTokenRepositoryInterface $accessTokenRepository; + private ?AccessTokenRepositoryInterface $accessTokenRepository; /** @var ScopeRepositoryInterface */ - private ScopeRepositoryInterface $scopeRepositoryInterface; + private ?ScopeRepositoryInterface $scopeRepositoryInterface; /** @var AuthorizationServer */ - private AuthorizationServer $authorizationServer; + private ?AuthorizationServer $authorizationServer; public function setUp(): void { From 22ff130c490659686444568ed851d78278ea7400 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 8 Feb 2024 13:37:54 +0900 Subject: [PATCH 09/18] =?UTF-8?q?fix:container=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tests/GraphQL/Mutation/UpdateProductStockMutationTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/GraphQL/Mutation/UpdateProductStockMutationTest.php b/Tests/GraphQL/Mutation/UpdateProductStockMutationTest.php index b21d5c7..b1d0941 100644 --- a/Tests/GraphQL/Mutation/UpdateProductStockMutationTest.php +++ b/Tests/GraphQL/Mutation/UpdateProductStockMutationTest.php @@ -31,8 +31,8 @@ class UpdateProductStockMutationTest extends EccubeTestCase public function setUp(): void { parent::setUp(); - $types = self::$container->get(Types::class); - $this->productClassRepository = self::$container->get(ProductClassRepository::class); + $types = self::getContainer()->get(Types::class); + $this->productClassRepository = self::getContainer()->get(ProductClassRepository::class); $this->updateProductStockMutation = new UpdateProductStockMutation($types, $this->productClassRepository, $this->entityManager); // テスト用の商品を作成 From 4a2132bf312abebf3ff06662ef13dc596063ee1c Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 8 Feb 2024 13:39:10 +0900 Subject: [PATCH 10/18] =?UTF-8?q?fix:Type=20Hinting=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/WebHookService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Service/WebHookService.php b/Service/WebHookService.php index 625e1a2..e40e9e7 100644 --- a/Service/WebHookService.php +++ b/Service/WebHookService.php @@ -31,17 +31,17 @@ class WebHookService implements EventSubscriberInterface /** * @var RouterInterface */ - private $router; + private RouterInterface $router; /** * @var WebHookRepository */ - private $webHookRepository; + private WebHookRepository $webHookRepository; /** * @var WebHookEvents */ - private $webHookEvents; + private WebHookEvents $webHookEvents; /** * WebHookService constructor. From 17933b7a851ddd689e51f1060b0fdf7a86692f42 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 8 Feb 2024 13:57:17 +0900 Subject: [PATCH 11/18] =?UTF-8?q?fix:Github=20Action=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e617397..0f6c641 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,14 +17,13 @@ on: jobs: run-on-linux: name: Run on Linux - runs-on: ${{ matrix.operating-system }} + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: - operating-system: [ ubuntu-18.04 ] - php: [ '7.4', '8.0', '8.1' ] + php: [ '7.4', '8.0', '8.1', '8.2', '8.3'] db: [ 'mysql', 'mysql8', 'pgsql' ] - eccube_version: [ '4.2' ] + eccube_version: [ '4.2', '4.3' ] plugin_code: [ 'Api42' ] include: - db: mysql @@ -39,6 +38,15 @@ jobs: database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db database_server_version: 14 database_charset: utf8 + exclude: + - eccube_version: 4.2 + php: 8.2 + - eccube_version: 4.2 + php: 8.3 + - eccube_version: 4.3 + php: 7.4 + - eccube_version: 4.3 + php: 8.0 services: mysql: image: mysql:5.7 @@ -72,7 +80,6 @@ jobs: - 1080:1080 - 1025:1025 steps: - - run: sudo apt-get purge -y hhvm - name: Checkout uses: actions/checkout@v2 From 471295297c0331e7a5770c7426faffcdac6254de Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 8 Feb 2024 14:15:48 +0900 Subject: [PATCH 12/18] =?UTF-8?q?fix:null=E8=A8=B1=E5=AE=B9=E5=9E=8B?= =?UTF-8?q?=E3=81=B8=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tests/Service/WebHookServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Service/WebHookServiceTest.php b/Tests/Service/WebHookServiceTest.php index 93d085b..04bb5d2 100644 --- a/Tests/Service/WebHookServiceTest.php +++ b/Tests/Service/WebHookServiceTest.php @@ -23,7 +23,7 @@ class WebHookServiceTest extends EccubeTestCase { /** @var WebHookService */ - private mixed $service; + private ?WebHookService $service; public function setUp(): void { From dd7f60d462a84b6813951a26c97ed45d0ccc9f39 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 8 Feb 2024 16:08:02 +0900 Subject: [PATCH 13/18] =?UTF-8?q?fix:action=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0f6c641..03b20ad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,9 +21,9 @@ jobs: strategy: fail-fast: false matrix: + eccube_version: [ '4.2', '4.3-symfony6' ] php: [ '7.4', '8.0', '8.1', '8.2', '8.3'] db: [ 'mysql', 'mysql8', 'pgsql' ] - eccube_version: [ '4.2', '4.3' ] plugin_code: [ 'Api42' ] include: - db: mysql @@ -43,9 +43,9 @@ jobs: php: 8.2 - eccube_version: 4.2 php: 8.3 - - eccube_version: 4.3 + - eccube_version: 4.3-symfony6 php: 7.4 - - eccube_version: 4.3 + - eccube_version: 4.3-symfony6 php: 8.0 services: mysql: @@ -174,7 +174,7 @@ jobs: working-directory: 'ec-cube' run: | bin/console cache:clear --no-warmup - bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests + ./vendor/bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests - name: Disable Plugin From 5ba65e50d6f21501045ce94620c824aa5accee5b Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 8 Feb 2024 16:33:34 +0900 Subject: [PATCH 14/18] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=AE=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tests/Web/ApiControllerTest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/Tests/Web/ApiControllerTest.php b/Tests/Web/ApiControllerTest.php index 02ea8fd..a04eade 100644 --- a/Tests/Web/ApiControllerTest.php +++ b/Tests/Web/ApiControllerTest.php @@ -45,8 +45,6 @@ class ApiControllerTest extends AbstractWebTestCase public function setUp(): void { parent::setUp(); - // containerの取得を修正 - // Error: Access to undeclared static property Plugin\Api42\Tests\Web\ApiControllerTest::$container $this->clientManager = self::getContainer()->get(ClientManager::class); $this->clientRepository = self::getContainer()->get(ClientRepositoryInterface::class); $this->accessTokenRepository = self::getContainer()->get(AccessTokenRepositoryInterface::class); @@ -107,7 +105,6 @@ private function newAccessToken($scopes) $accessTokenEntity->setClient($clientEntity); $accessTokenEntity->setExpiryDateTime(new \DateTimeImmutable('+1 days', new \DateTimeZone('Asia/Tokyo'))); $accessTokenEntity->setUserIdentifier('admin'); - //Error: Access to undeclared static property Plugin\Api42\Tests\Web\ApiControllerTest::$container $accessTokenEntity->setPrivateKey(new CryptKey(self::getContainer()->get(EccubeConfig::class)->get('kernel.project_dir').'/app/PluginData/Api42/oauth/private.key')); array_walk($scopes, function ($s) use ($accessTokenEntity) { From f89a1bfbda94762d04a4ab8560dc43b41d2ac977 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Thu, 8 Feb 2024 17:02:57 +0900 Subject: [PATCH 15/18] =?UTF-8?q?fix:=E4=B8=8D=E8=A6=81=E7=AE=87=E6=89=80?= =?UTF-8?q?=E3=81=AE=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 623fdc4..4ecf0da 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "ec-cube\/api42", + "name": "ec-cube/api42", "version": "4.3.0", "description": "Web API", "type": "eccube-plugin", From 8897e00f1b51034f94b2a22219a8b5ccbde4f4af Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Mon, 26 Feb 2024 15:01:43 +0900 Subject: [PATCH 16/18] fix:eccube version up --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 03b20ad..059bb33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - eccube_version: [ '4.2', '4.3-symfony6' ] + eccube_version: [ '4.2', '4.3' ] php: [ '7.4', '8.0', '8.1', '8.2', '8.3'] db: [ 'mysql', 'mysql8', 'pgsql' ] plugin_code: [ 'Api42' ] From 5b3e12cab43ef5d8bf63a8ef275cadfd03eb08d4 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Mon, 26 Feb 2024 15:30:36 +0900 Subject: [PATCH 17/18] =?UTF-8?q?fix:=E4=BF=AE=E6=AD=A3=E6=BC=8F=E3=82=8C?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 059bb33..75390db 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,9 +43,9 @@ jobs: php: 8.2 - eccube_version: 4.2 php: 8.3 - - eccube_version: 4.3-symfony6 + - eccube_version: 4.3 php: 7.4 - - eccube_version: 4.3-symfony6 + - eccube_version: 4.3 php: 8.0 services: mysql: From 7e4f4cac1874704b2f2d73b014e42230e7cd8e6d Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Mon, 26 Feb 2024 16:26:32 +0900 Subject: [PATCH 18/18] =?UTF-8?q?fix:PasswordEncoder=E3=81=8B=E3=82=89Pass?= =?UTF-8?q?wordHasher=E3=81=B8=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EventListener/UserResolveListener.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/EventListener/UserResolveListener.php b/EventListener/UserResolveListener.php index 58a446b..ef5d7c3 100644 --- a/EventListener/UserResolveListener.php +++ b/EventListener/UserResolveListener.php @@ -13,7 +13,7 @@ namespace Plugin\Api42\EventListener; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; +use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; use League\Bundle\OAuth2ServerBundle\Event\UserResolveEvent; @@ -25,18 +25,18 @@ final class UserResolveListener private $userProvider; /** - * @var UserPasswordEncoderInterface + * @var UserPasswordHasherInterface */ - private $userPasswordEncoder; + private $userPasswordHasher; /** * @param UserProviderInterface $userProvider - * @param UserPasswordEncoderInterface $userPasswordEncoder + * @param UserPasswordHasherInterface $userPasswordHasher */ - public function __construct(UserProviderInterface $userProvider, UserPasswordEncoderInterface $userPasswordEncoder) + public function __construct(UserProviderInterface $userProvider, UserPasswordHasherInterface $userPasswordHasher) { $this->userProvider = $userProvider; - $this->userPasswordEncoder = $userPasswordEncoder; + $this->userPasswordHasher = $userPasswordHasher; } /** @@ -50,7 +50,7 @@ public function onUserResolve(UserResolveEvent $event): void return; } - if (!$this->userPasswordEncoder->isPasswordValid($user, $event->getPassword())) { + if (!$this->userPasswordHasher->isPasswordValid($user, $event->getPassword())) { return; }