1 | <?php |
||
2 | |||
3 | namespace CodeCloud\Bundle\ShopifyBundle\Security; |
||
4 | |||
5 | use CodeCloud\Bundle\ShopifyBundle\EventListener\SessionAuthenticationListener; |
||
6 | use Symfony\Component\HttpFoundation\RedirectResponse; |
||
7 | use Symfony\Component\HttpFoundation\Request; |
||
8 | use Symfony\Component\HttpFoundation\Response; |
||
9 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
||
10 | use Symfony\Component\Security\Core\User\UserInterface; |
||
0 ignored issues
–
show
|
|||
11 | use Symfony\Component\Security\Guard\AbstractGuardAuthenticator; |
||
0 ignored issues
–
show
The type
Symfony\Component\Securi...tractGuardAuthenticator was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths
Loading history...
|
|||
12 | use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; |
||
0 ignored issues
–
show
The type
Symfony\Component\Securi...on\Token\TokenInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths
Loading history...
|
|||
13 | use Symfony\Component\Security\Core\Exception\AuthenticationException; |
||
0 ignored issues
–
show
The type
Symfony\Component\Securi...AuthenticationException was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths
Loading history...
|
|||
14 | use Symfony\Component\Security\Core\User\UserProviderInterface; |
||
0 ignored issues
–
show
The type
Symfony\Component\Securi...r\UserProviderInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths
Loading history...
|
|||
15 | |||
16 | /** |
||
17 | * Authenticates users via session parameter. |
||
18 | */ |
||
19 | class SessionAuthenticator extends AbstractGuardAuthenticator |
||
20 | { |
||
21 | /** |
||
22 | * @var UrlGeneratorInterface |
||
23 | */ |
||
24 | private $urlGenerator; |
||
25 | |||
26 | /** |
||
27 | * @param UrlGeneratorInterface $urlGenerator |
||
28 | */ |
||
29 | public function __construct(UrlGeneratorInterface $urlGenerator) |
||
30 | { |
||
31 | $this->urlGenerator = $urlGenerator; |
||
32 | } |
||
33 | |||
34 | public function getCredentials(Request $request) |
||
35 | { |
||
36 | if (!$session = $request->getSession()) { |
||
37 | return false; |
||
38 | } |
||
39 | |||
40 | if (!$session->has(SessionAuthenticationListener::SESSION_PARAMETER)) { |
||
41 | return false; |
||
42 | } |
||
43 | |||
44 | return [ |
||
45 | 'shop' => $session->get(SessionAuthenticationListener::SESSION_PARAMETER), |
||
46 | ]; |
||
47 | } |
||
48 | |||
49 | public function getUser($credentials, UserProviderInterface $userProvider) |
||
50 | { |
||
51 | return $userProvider->loadUserByUsername($credentials['shop']); |
||
52 | } |
||
53 | |||
54 | public function checkCredentials($credentials, UserInterface $user) |
||
55 | { |
||
56 | return true; |
||
57 | } |
||
58 | |||
59 | public function onAuthenticationFailure(Request $request, AuthenticationException $exception) |
||
60 | { |
||
61 | } |
||
62 | |||
63 | public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) |
||
64 | { |
||
65 | } |
||
66 | |||
67 | public function supportsRememberMe() |
||
68 | { |
||
69 | return false; |
||
70 | } |
||
71 | |||
72 | public function start(Request $request, AuthenticationException $authException = null) |
||
73 | { |
||
74 | if (!$request->get('shop')) { |
||
75 | return new Response('Your session has expired. Please access the app via Shopify Admin again.'); |
||
76 | } |
||
77 | |||
78 | return new RedirectResponse( |
||
79 | $this->urlGenerator->generate('codecloud_shopify_auth', [ |
||
80 | 'shop' => $request->get('shop'), |
||
81 | ]) |
||
82 | ); |
||
83 | } |
||
84 | } |
||
85 |
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