1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of php-scaffold |
5
|
|
|
* |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
declare(strict_types=1); |
11
|
|
|
|
12
|
|
|
namespace Slick\WebStack\Infrastructure\Http\Authenticator\Factory; |
13
|
|
|
|
14
|
|
|
use Slick\WebStack\Domain\Security\Authentication\Token\TokenStorageInterface; |
15
|
|
|
use Slick\WebStack\Domain\Security\Exception\LogicException; |
16
|
|
|
use Slick\WebStack\Domain\Security\Http\AuthenticatorFactoryInterface; |
17
|
|
|
use Slick\WebStack\Domain\Security\Http\RememberMe\RememberMeHandlerInterface; |
18
|
|
|
use Slick\WebStack\Domain\Security\Http\SecurityProfile\EntryPointAwareInterface; |
19
|
|
|
use Slick\WebStack\Domain\Security\Signature\SignatureHasher; |
|
|
|
|
20
|
|
|
use Slick\WebStack\Domain\Security\UserInterface; |
21
|
|
|
use Slick\WebStack\Infrastructure\Http\Authenticator\RememberMeAuthenticator; |
22
|
|
|
use Psr\Container\ContainerExceptionInterface; |
23
|
|
|
use Psr\Container\NotFoundExceptionInterface; |
24
|
|
|
use Psr\Log\LoggerInterface; |
25
|
|
|
use Slick\Di\ContainerInterface; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* RememberMeAuthenticatorFactory |
29
|
|
|
* |
30
|
|
|
* @package Slick\WebStack\Infrastructure\Http\Authenticator\Factory |
31
|
|
|
* @template-covariant TUser of UserInterface |
32
|
|
|
* @implements AuthenticatorFactoryInterface<TUser> |
33
|
|
|
*/ |
34
|
|
|
final class RememberMeAuthenticatorFactory implements AuthenticatorFactoryInterface |
35
|
|
|
{ |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param ContainerInterface $container |
39
|
|
|
* @param array<string, mixed> $properties |
40
|
|
|
* @param EntryPointAwareInterface|null $factoryHandler |
41
|
|
|
* @inheritDoc |
42
|
|
|
* @phpstan-return RememberMeAuthenticator<UserInterface> |
43
|
|
|
*/ |
44
|
|
|
public static function create( |
45
|
|
|
ContainerInterface $container, |
46
|
|
|
array $properties = [], |
47
|
|
|
?EntryPointAwareInterface $factoryHandler = null |
48
|
|
|
): RememberMeAuthenticator { |
49
|
|
|
$container->register(SignatureHasher::class, new SignatureHasher( |
50
|
|
|
$properties['secret'], |
51
|
|
|
$properties['properties'] ?? [], |
52
|
|
|
)); |
53
|
|
|
$container->register('remember.me.cookie.options', $properties); |
54
|
|
|
try { |
55
|
|
|
return new RememberMeAuthenticator( |
56
|
|
|
$container->get(RememberMeHandlerInterface::class), |
57
|
|
|
$properties['secret'] ?? '', |
58
|
|
|
$container->get(TokenStorageInterface::class), |
59
|
|
|
$properties['cookieName'] ?? RememberMeAuthenticator::COOKIE_NAME, |
60
|
|
|
$container->get(LoggerInterface::class) |
61
|
|
|
); |
62
|
|
|
} catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) { |
63
|
|
|
throw new LogicException($e->getMessage()); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths