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

RestSessionBasedFactory.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishRestBundle\DependencyInjection\Security;
8
9 use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FormLoginFactory;
10 use Symfony\Component\DependencyInjection\DefinitionDecorator;
11 use Symfony\Component\DependencyInjection\Reference;
12
13 class RestSessionBasedFactory extends FormLoginFactory
14 {
15 public function __construct()
16 {
17 parent::__construct();
18 unset($this->options['check_path']);
19 $this->defaultSuccessHandlerOptions = [];
20 $this->defaultFailureHandlerOptions = [];
21 }
22
23 protected function isRememberMeAware($config)
24 {
25 return false;
26 }
27
28 protected function createListener($container, $id, $config, $userProvider)
29 {
30 $listenerId = $this->getListenerId();
31 $listener = new DefinitionDecorator($listenerId);
32 $listener->replaceArgument(2, $id);
33
34 /* @var \Symfony\Component\DependencyInjection\ContainerBuilder $container */
35 $listenerId .= '.' . $id;
36 $container->setDefinition($listenerId, $listener);
37 $container->setAlias('ezpublish_rest.session_authenticator', $listenerId);
38
39 if ($container->hasDefinition('security.logout_listener.' . $id)) {
40 // Copying logout handlers to REST session authenticator, to allow proper logout using it.
41 $logoutListenerDef = $container->getDefinition('security.logout_listener.' . $id);
42 $logoutListenerDef->addMethodCall(
43 'addHandler',
44 [new Reference('ezpublish_rest.security.authentication.logout_handler')]
45 );
46
47 foreach ($logoutListenerDef->getMethodCalls() as $callArray) {
48 if ($callArray[0] !== 'addHandler') {
49 continue;
50 }
51
52 $listener->addMethodCall('addLogoutHandler', $callArray[1]);
53 }
54 }
55
56 return $listenerId;
57 }
58
59 protected function getListenerId()
60 {
61 return 'ezpublish_rest.security.authentication.listener.session';
62 }
63
64 public function getPosition()
65 {
66 return 'http';
67 }
68
69 public function getKey()
70 {
71 return 'ezpublish_rest_session';
72 }
73
74 protected function createEntryPoint($container, $id, $config, $defaultEntryPoint)
75 {
76 return $defaultEntryPoint;
77 }
78 }
eZ\Bundle\EzPublishRestBundle\DependencyInjection\Security\RestSessionBasedFactory
Definition: RestSessionBasedFactory.php:14
eZ\Bundle\EzPublishRestBundle\DependencyInjection\Security\RestSessionBasedFactory\getKey
getKey()
Definition: RestSessionBasedFactory.php:69
eZ\Bundle\EzPublishRestBundle\DependencyInjection\Security\RestSessionBasedFactory\createListener
createListener($container, $id, $config, $userProvider)
Definition: RestSessionBasedFactory.php:28
eZ\Bundle\EzPublishRestBundle\DependencyInjection\Security\RestSessionBasedFactory\createEntryPoint
createEntryPoint($container, $id, $config, $defaultEntryPoint)
Definition: RestSessionBasedFactory.php:74
eZ\Bundle\EzPublishRestBundle\DependencyInjection\Security\RestSessionBasedFactory\__construct
__construct()
Definition: RestSessionBasedFactory.php:15
eZ\Bundle\EzPublishRestBundle\DependencyInjection\Security\RestSessionBasedFactory\getListenerId
getListenerId()
Definition: RestSessionBasedFactory.php:59
eZ\Bundle\EzPublishRestBundle\DependencyInjection\Security\RestSessionBasedFactory\isRememberMeAware
isRememberMeAware($config)
Definition: RestSessionBasedFactory.php:23
eZ\Bundle\EzPublishRestBundle\DependencyInjection\Security\RestSessionBasedFactory\getPosition
getPosition()
Definition: RestSessionBasedFactory.php:64
eZ\Bundle\EzPublishRestBundle\DependencyInjection\Security
Definition: RestSessionBasedFactory.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.