From 6e1579ca1f2d2ff57ad303eb5188032f3734f72c Mon Sep 17 00:00:00 2001 From: Kevin Traini Date: Fri, 7 Jun 2024 18:28:03 +0200 Subject: [PATCH] feat: Inject dependencies of UserProvider and UserAccessChecker Closes #18 They can have Service dependencies --- README.md | 6 +- composer.json | 2 +- composer.lock | 226 ++++++++++++++++--------------------------- include/Firewall.php | 18 +--- 4 files changed, 93 insertions(+), 159 deletions(-) diff --git a/README.md b/README.md index f907678..ee8d373 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,8 @@ interface UserProvider } ``` -The class you pass in the config must implement this interface. +The class you pass in the config must implement this interface. It can have dependencies like a Service, they will be +injected during instantiation. `User` is an interface also provided by this Brick: @@ -97,7 +98,8 @@ interface UserAccessChecker ``` This method returns `true` if user is authorized to see resource. It can throw an exception the same way as defined -in [`Archict\router`](https://github.com/Archict/router). +in [`Archict\router`](https://github.com/Archict/router). Implementation of this interface can have some dependencies in +its constructor, they will be injected during instantiation. Then you can provide the class name to your rule with the tag `checker`: diff --git a/composer.json b/composer.json index 0d811b0..b58c2cb 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "phpunit/phpunit": "^10", "squizlabs/php_codesniffer": "^3.9", "slevomat/coding-standard": "^8.15", - "archict/core": "^0", + "archict/core": "^0.3", "guzzlehttp/psr7": "^2.6" }, "scripts": { diff --git a/composer.lock b/composer.lock index f38d7cb..3359645 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cee968430ece34b47aa7528e7382a24d", + "content-hash": "9edeec42c0ee05edea7f4c9567ae45d5", "packages": [ { "name": "archict/brick", @@ -48,23 +48,23 @@ }, { "name": "archict/core", - "version": "v0.2.1", + "version": "v0.3.1", "source": { "type": "git", "url": "https://github.com/Archict/core.git", - "reference": "8c18791403f1596a5762753e89fa3c2d99ed5a1d" + "reference": "6a7ab537c43df994de363c4622b25ef541ab7b82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Archict/core/zipball/8c18791403f1596a5762753e89fa3c2d99ed5a1d", - "reference": "8c18791403f1596a5762753e89fa3c2d99ed5a1d", + "url": "https://api.github.com/repos/Archict/core/zipball/6a7ab537c43df994de363c4622b25ef541ab7b82", + "reference": "6a7ab537c43df994de363c4622b25ef541ab7b82", "shasum": "" }, "require": { "archict/brick": "^0", "azjezz/psl": "^2.9", "composer-runtime-api": "^2.2", - "composer/class-map-generator": "^1.1", + "composer/class-map-generator": "^1.3", "cuyz/valinor": "^1.12", "php": ">= 8.2", "psr/simple-cache": "^3.0", @@ -91,27 +91,27 @@ "description": "Heart of Archict, this library load and manage Bricks", "support": { "issues": "https://github.com/Archict/core/issues", - "source": "https://github.com/Archict/core/tree/v0.2.1" + "source": "https://github.com/Archict/core/tree/v0.3.1" }, - "time": "2024-05-14T06:54:08+00:00" + "time": "2024-06-07T16:01:21+00:00" }, { "name": "archict/router", - "version": "v0.1.0", + "version": "v0.3.0", "source": { "type": "git", "url": "https://github.com/Archict/router.git", - "reference": "26f8cc51ca4c59eb3e0a09b2838ead26e2dd7263" + "reference": "b6567b9e6ae6079a33673bd0b22e26b03b0ca419" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Archict/router/zipball/26f8cc51ca4c59eb3e0a09b2838ead26e2dd7263", - "reference": "26f8cc51ca4c59eb3e0a09b2838ead26e2dd7263", + "url": "https://api.github.com/repos/Archict/router/zipball/b6567b9e6ae6079a33673bd0b22e26b03b0ca419", + "reference": "b6567b9e6ae6079a33673bd0b22e26b03b0ca419", "shasum": "" }, "require": { "archict/brick": "^0", - "archict/core": "^0.2", + "archict/core": "^0.3", "cuyz/valinor": "^1.12", "ext-simplexml": "*", "guzzlehttp/psr7": "^2.6", @@ -138,9 +138,9 @@ "description": "Simple HTTP router", "support": { "issues": "https://github.com/Archict/router/issues", - "source": "https://github.com/Archict/router/tree/v0.1.0" + "source": "https://github.com/Archict/router/tree/v0.3.0" }, - "time": "2024-05-08T07:32:06+00:00" + "time": "2024-06-07T16:12:33+00:00" }, { "name": "azjezz/psl", @@ -218,16 +218,16 @@ }, { "name": "composer/class-map-generator", - "version": "1.1.1", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/composer/class-map-generator.git", - "reference": "8286a62d243312ed99b3eee20d5005c961adb311" + "reference": "acd227952154850d0bb7d65caa4f9edf9cd806a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/class-map-generator/zipball/8286a62d243312ed99b3eee20d5005c961adb311", - "reference": "8286a62d243312ed99b3eee20d5005c961adb311", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/acd227952154850d0bb7d65caa4f9edf9cd806a7", + "reference": "acd227952154850d0bb7d65caa4f9edf9cd806a7", "shasum": "" }, "require": { @@ -271,7 +271,7 @@ ], "support": { "issues": "https://github.com/composer/class-map-generator/issues", - "source": "https://github.com/composer/class-map-generator/tree/1.1.1" + "source": "https://github.com/composer/class-map-generator/tree/1.3.2" }, "funding": [ { @@ -287,20 +287,20 @@ "type": "tidelift" } ], - "time": "2024-03-15T12:53:41+00:00" + "time": "2024-05-31T19:45:56+00:00" }, { "name": "composer/pcre", - "version": "3.1.3", + "version": "3.1.4", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8" + "reference": "04229f163664973f68f38f6f73d917799168ef24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", - "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", + "url": "https://api.github.com/repos/composer/pcre/zipball/04229f163664973f68f38f6f73d917799168ef24", + "reference": "04229f163664973f68f38f6f73d917799168ef24", "shasum": "" }, "require": { @@ -342,7 +342,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.3" + "source": "https://github.com/composer/pcre/tree/3.1.4" }, "funding": [ { @@ -358,7 +358,7 @@ "type": "tidelift" } ], - "time": "2024-03-19T10:26:25+00:00" + "time": "2024-05-27T13:40:54+00:00" }, { "name": "cuyz/valinor", @@ -963,16 +963,16 @@ }, { "name": "symfony/finder", - "version": "v7.0.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "4d58f0f4fe95a30d7b538d71197135483560b97c" + "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/4d58f0f4fe95a30d7b538d71197135483560b97c", - "reference": "4d58f0f4fe95a30d7b538d71197135483560b97c", + "url": "https://api.github.com/repos/symfony/finder/zipball/fbb0ba67688b780efbc886c1a0a0948dcf7205d6", + "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6", "shasum": "" }, "require": { @@ -1007,7 +1007,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.0.7" + "source": "https://github.com/symfony/finder/tree/v7.1.1" }, "funding": [ { @@ -1023,7 +1023,7 @@ "type": "tidelift" } ], - "time": "2024-04-28T11:44:19+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1266,16 +1266,16 @@ }, { "name": "symfony/yaml", - "version": "v7.0.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "0d3916ae69ea28b59d94b60c4f2b50f4e25adb5c" + "reference": "fa34c77015aa6720469db7003567b9f772492bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/0d3916ae69ea28b59d94b60c4f2b50f4e25adb5c", - "reference": "0d3916ae69ea28b59d94b60c4f2b50f4e25adb5c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/fa34c77015aa6720469db7003567b9f772492bf2", + "reference": "fa34c77015aa6720469db7003567b9f772492bf2", "shasum": "" }, "require": { @@ -1317,7 +1317,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v7.0.7" + "source": "https://github.com/symfony/yaml/tree/v7.1.1" }, "funding": [ { @@ -1333,7 +1333,7 @@ "type": "tidelift" } ], - "time": "2024-04-28T11:44:19+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "vlucas/phpdotenv", @@ -2391,16 +2391,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", "shasum": "" }, "require": { @@ -2449,9 +2449,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" }, - "time": "2024-04-09T21:13:58+00:00" + "time": "2024-05-21T05:55:05+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -2513,16 +2513,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.0", + "version": "1.29.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", "shasum": "" }, "require": { @@ -2554,22 +2554,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" }, - "time": "2024-05-06T12:04:23+00:00" + "time": "2024-05-31T08:52:43+00:00" }, { "name": "phpstan/phpstan", - "version": "1.11.1", + "version": "1.11.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b" + "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e524358f930e41a2b4cca1320e3b04fc26b39e0b", - "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9100a76ce8015b9aa7125b9171ae3a76887b6c82", + "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82", "shasum": "" }, "require": { @@ -2614,7 +2614,7 @@ "type": "github" } ], - "time": "2024-05-15T08:00:59+00:00" + "time": "2024-06-06T12:19:22+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4192,16 +4192,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.2", + "version": "3.10.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", "shasum": "" }, "require": { @@ -4268,20 +4268,20 @@ "type": "open_collective" } ], - "time": "2024-04-23T20:25:34+00:00" + "time": "2024-05-22T21:24:41+00:00" }, { "name": "symfony/console", - "version": "v7.0.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c981e0e9380ce9f146416bde3150c79197ce9986" + "reference": "9b008f2d7b21c74ef4d0c3de6077a642bc55ece3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c981e0e9380ce9f146416bde3150c79197ce9986", - "reference": "c981e0e9380ce9f146416bde3150c79197ce9986", + "url": "https://api.github.com/repos/symfony/console/zipball/9b008f2d7b21c74ef4d0c3de6077a642bc55ece3", + "reference": "9b008f2d7b21c74ef4d0c3de6077a642bc55ece3", "shasum": "" }, "require": { @@ -4345,7 +4345,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.0.7" + "source": "https://github.com/symfony/console/tree/v7.1.1" }, "funding": [ { @@ -4361,7 +4361,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4432,22 +4432,24 @@ }, { "name": "symfony/filesystem", - "version": "v7.0.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "cc168be6fbdcdf3401f50ae863ee3818ed4338f5" + "reference": "802e87002f919296c9f606457d9fa327a0b3d6b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/cc168be6fbdcdf3401f50ae863ee3818ed4338f5", - "reference": "cc168be6fbdcdf3401f50ae863ee3818ed4338f5", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/802e87002f919296c9f606457d9fa327a0b3d6b2", + "reference": "802e87002f919296c9f606457d9fa327a0b3d6b2", "shasum": "" }, "require": { "php": ">=8.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-mbstring": "~1.8" + }, + "require-dev": { "symfony/process": "^6.4|^7.0" }, "type": "library", @@ -4476,7 +4478,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.0.7" + "source": "https://github.com/symfony/filesystem/tree/v7.1.1" }, "funding": [ { @@ -4492,7 +4494,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -4653,67 +4655,6 @@ ], "time": "2024-01-29T20:11:03+00:00" }, - { - "name": "symfony/process", - "version": "v7.0.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "3839e56b94dd1dbd13235d27504e66baf23faba0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/3839e56b94dd1dbd13235d27504e66baf23faba0", - "reference": "3839e56b94dd1dbd13235d27504e66baf23faba0", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Executes commands in sub-processes", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/process/tree/v7.0.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-04-18T09:29:19+00:00" - }, { "name": "symfony/service-contracts", "version": "v3.5.0", @@ -4799,16 +4740,16 @@ }, { "name": "symfony/string", - "version": "v7.0.7", + "version": "v7.1.1", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63" + "reference": "60bc311c74e0af215101235aa6f471bcbc032df2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e405b5424dc2528e02e31ba26b83a79fd4eb8f63", - "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63", + "url": "https://api.github.com/repos/symfony/string/zipball/60bc311c74e0af215101235aa6f471bcbc032df2", + "reference": "60bc311c74e0af215101235aa6f471bcbc032df2", "shasum": "" }, "require": { @@ -4822,6 +4763,7 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { + "symfony/emoji": "^7.1", "symfony/error-handler": "^6.4|^7.0", "symfony/http-client": "^6.4|^7.0", "symfony/intl": "^6.4|^7.0", @@ -4865,7 +4807,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.0.7" + "source": "https://github.com/symfony/string/tree/v7.1.1" }, "funding": [ { @@ -4881,7 +4823,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-06-04T06:40:14+00:00" }, { "name": "theseer/tokenizer", @@ -5111,5 +5053,5 @@ "php": ">= 8.2" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.6.0" } diff --git a/include/Firewall.php b/include/Firewall.php index d77adaf..f5611e8 100644 --- a/include/Firewall.php +++ b/include/Firewall.php @@ -6,6 +6,7 @@ use Archict\Brick\ListeningEvent; use Archict\Brick\Service; +use Archict\Core\Services\ServiceManager; use Archict\Firewall\Config\AccessControlRepresentation; use Archict\Firewall\Config\AccessControlValidator; use Archict\Firewall\Config\ConfigValidator; @@ -18,8 +19,6 @@ use Archict\Router\Middleware; use Archict\Router\RouteCollectorEvent; use Psr\Http\Message\ServerRequestInterface; -use ReflectionClass; -use ReflectionException; /** * This service doesn't need to be used outside of this Brick. @@ -34,6 +33,7 @@ */ public function __construct( private FirewallConfiguration $configuration, + private ServiceManager $service_manager, ) { $this->validateConfiguration(); } @@ -51,9 +51,6 @@ private function validateConfiguration(): void $validator->validate($this->configuration); } - /** - * @throws ReflectionException - */ #[ListeningEvent] public function addMiddlewares(RouteCollectorEvent $collector): void { @@ -66,9 +63,6 @@ public function addMiddlewares(RouteCollectorEvent $collector): void } } - /** - * @throws ReflectionException - */ private function createMiddlewareFromRepresentation(AccessControlRepresentation $representation): Middleware { if ($representation->checker === FirewallAccessChecker::class) { @@ -104,24 +98,20 @@ public function process(ServerRequestInterface $request): ServerRequestInterface /** * @param class-string $class_name - * @throws ReflectionException */ private function instantiateProvider(string $class_name): UserProvider { - $reflection = new ReflectionClass($class_name); - $instance = $reflection->newInstance(); + $instance = $this->service_manager->instantiateWithServices($class_name); assert($instance instanceof UserProvider); return $instance; } /** * @param class-string $class_name - * @throws ReflectionException */ private function instantiateChecker(string $class_name): UserAccessChecker { - $reflection = new ReflectionClass($class_name); - $instance = $reflection->newInstance(); + $instance = $this->service_manager->instantiateWithServices($class_name); assert($instance instanceof UserAccessChecker); return $instance; }