Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

AnonymousAuthenticationProvider.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\Security\Authentication;
8
9 use eZ\Publish\API\Repository\Repository;
10 use eZ\Publish\Core\MVC\ConfigResolverInterface;
11 use eZ\Publish\Core\Repository\Values\User\UserReference;
12 use Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider as BaseAnonymousProvider;
13 use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
14
15 class AnonymousAuthenticationProvider extends BaseAnonymousProvider
16 {
18 private $repository;
19
21 private $configResolver;
22
23 public function setRepository(Repository $repository)
24 {
25 $this->repository = $repository;
26 }
27
28 public function setConfigResolver(ConfigResolverInterface $configResolver)
29 {
30 $this->configResolver = $configResolver;
31 }
32
33 public function authenticate(TokenInterface $token)
34 {
35 $token = parent::authenticate($token);
36 $this->repository->setCurrentUser(new UserReference($this->configResolver->getParameter('anonymous_user_id')));
37
38 return $token;
39 }
40 }
eZ\Publish\Core\MVC\Symfony\Security\Authentication\AnonymousAuthenticationProvider
Definition: AnonymousAuthenticationProvider.php:16
eZ\Publish\Core\MVC\Symfony\Security\Authentication\AnonymousAuthenticationProvider\authenticate
authenticate(TokenInterface $token)
Definition: AnonymousAuthenticationProvider.php:33
eZ\Publish\Core\MVC\Symfony\Security\Authentication\AnonymousAuthenticationProvider\setRepository
setRepository(Repository $repository)
Definition: AnonymousAuthenticationProvider.php:23
eZ\Publish\Core\MVC\Symfony\Security\Authentication\AnonymousAuthenticationProvider\$repository
$repository
Definition: AnonymousAuthenticationProvider.php:18
eZ\Publish\Core\MVC\Symfony\Security\Authentication\AnonymousAuthenticationProvider\setConfigResolver
setConfigResolver(ConfigResolverInterface $configResolver)
Definition: AnonymousAuthenticationProvider.php:28
eZ\Publish\Core\MVC\Symfony\Security\Authentication\AnonymousAuthenticationProvider\$configResolver
$configResolver
Definition: AnonymousAuthenticationProvider.php:21
eZ\Publish\Core\Repository\Values\User\UserReference
This class represents a user reference for use in sessions and Repository.
Definition: Core/Repository/Values/User/UserReference.php:17
eZ\Publish\API\Repository\Repository
Repository interface.
Definition: API/Repository/Repository.php:16
eZ\Publish\Core\MVC\ConfigResolverInterface
Interface for config resolvers.
Definition: ConfigResolverInterface.php:19
eZ\Publish\Core\MVC\Symfony\Security\Authentication
Definition: AnonymousAuthenticationProvider.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.