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

Public Member Functions | Private Member Functions | Private Attributes | List of all members
eZ\Publish\Core\REST\Server\Security\RestAuthenticator Class Reference

Authenticator for REST API, mainly used for session based authentication (session creation resource). More...

Inheritance diagram for eZ\Publish\Core\REST\Server\Security\RestAuthenticator:

## Public Member Functions
| __construct (TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, $providerKey, EventDispatcherInterface $dispatcher, ConfigResolverInterface $configResolver, SessionStorageInterface $sessionStorage, ?LoggerInterface $logger=null)
| handle (GetResponseEvent $event)
| Doesn't do anything as we don't use this service with main Firewall listener. More...
| authenticate (Request $request)
| Runs authentication against provided request and returns the authenticated security token. More...
| addLogoutHandler (LogoutHandlerInterface $handler)
| logout (Request $request)
| Performs logout by running configured logout handlers. More...

## Private Member Functions
| attemptAuthentication (Request $request)
| isUserConflict (EzUser $user, TokenInterface $previousToken=null)
| Checks if newly matched user is conflicting with previously non-anonymous logged in user, if any. More...

## Private Attributes
| $logger
| $authenticationManager
| $providerKey
| $tokenStorage
| $dispatcher
| $configResolver
| $sessionStorage
| $logoutHandlers = []

## Detailed Description

Authenticator for REST API, mainly used for session based authentication (session creation resource).

Implements \Symfony\Component\Security\Http\Firewall\ListenerInterface to be able to receive the provider key (firewall identifier from configuration).

Definition at line 37 of file RestAuthenticator.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::__construct | ( | TokenStorageInterface | $tokenStorage,
|  | AuthenticationManagerInterface | $authenticationManager,
|  |  | $providerKey,
|  | EventDispatcherInterface | $dispatcher,
|  | ConfigResolverInterface | $configResolver,
|  | SessionStorageInterface | $sessionStorage,
|  | ?LoggerInterface | $logger = `null`
| ) |  |

Definition at line 62 of file RestAuthenticator.php.

References eZ\Publish\Core\REST\Server\Security\RestAuthenticator\$authenticationManager, eZ\Publish\Core\REST\Server\Security\RestAuthenticator\$configResolver, eZ\Publish\Core\REST\Server\Security\RestAuthenticator\$dispatcher, eZ\Publish\Core\REST\Server\Security\RestAuthenticator\$logger, eZ\Publish\Core\REST\Server\Security\RestAuthenticator\$providerKey, eZ\Publish\Core\REST\Server\Security\RestAuthenticator\$sessionStorage, and eZ\Publish\Core\REST\Server\Security\RestAuthenticator\$tokenStorage.

## Member Function Documentation

## ◆ addLogoutHandler()

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::addLogoutHandler | ( | LogoutHandlerInterface | $handler | ) |

Definition at line 183 of file RestAuthenticator.php.

## ◆ attemptAuthentication()

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::attemptAuthentication | ( | Request | $request | ) |
| private

Parameters

  \Symfony\Component\HttpFoundation\Request | $request |

Returns
  \Symfony\Component\Security\Core\Authentication\Token\TokenInterface

Definition at line 148 of file RestAuthenticator.php.

Referenced by eZ\Publish\Core\REST\Server\Security\RestAuthenticator\authenticate().

## ◆ authenticate()

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::authenticate | ( | Request | $request | ) |

Runs authentication against provided request and returns the authenticated security token.

This method typically does:

- The authentication by itself (i.e. matching a user)
- User type checks (e.g. check user activation)
- Inject authenticated token in the SecurityContext
- (optional) Trigger SecurityEvents::INTERACTIVE_LOGIN event

Parameters

  \Symfony\Component\HttpFoundation\Request | $request |

Returns
  \Symfony\Component\Security\Core\Authentication\Token\TokenInterface

Exceptions

Implements eZ\Publish\Core\MVC\Symfony\Security\Authentication\AuthenticatorInterface.

Definition at line 90 of file RestAuthenticator.php.

References eZ\Publish\Core\REST\Server\Security\RestAuthenticator\attemptAuthentication(), and eZ\Publish\Core\REST\Server\Security\RestAuthenticator\isUserConflict().

## ◆ handle()

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::handle | ( | GetResponseEvent | $event | ) |

Doesn't do anything as we don't use this service with main Firewall listener.

Parameters

  \Symfony\Component\HttpKernel\Event\GetResponseEvent | $event |

Definition at line 85 of file RestAuthenticator.php.

## ◆ isUserConflict()

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::isUserConflict | ( | EzUser | $user,
|  | TokenInterface | $previousToken = `null`
| ) |  |
| private

Checks if newly matched user is conflicting with previously non-anonymous logged in user, if any.

Parameters

  EzUser | $user |
  TokenInterface | $previousToken |

Returns
  bool

Definition at line 167 of file RestAuthenticator.php.

Referenced by eZ\Publish\Core\REST\Server\Security\RestAuthenticator\authenticate().

## ◆ logout()

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::logout | ( | Request | $request | ) |

Performs logout by running configured logout handlers.

Parameters

  \Symfony\Component\HttpFoundation\Request | $request |

Returns
  \Symfony\Component\HttpFoundation\Response

Implements eZ\Publish\Core\MVC\Symfony\Security\Authentication\AuthenticatorInterface.

Definition at line 188 of file RestAuthenticator.php.

## Member Data Documentation

## ◆ $authenticationManager

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::$authenticationManager
| private

Definition at line 43 of file RestAuthenticator.php.

Referenced by eZ\Publish\Core\REST\Server\Security\RestAuthenticator\__construct().

## ◆ $configResolver

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::$configResolver
| private

Definition at line 54 of file RestAuthenticator.php.

Referenced by eZ\Publish\Core\REST\Server\Security\RestAuthenticator\__construct().

## ◆ $dispatcher

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::$dispatcher
| private

Definition at line 51 of file RestAuthenticator.php.

Referenced by eZ\Publish\Core\REST\Server\Security\RestAuthenticator\__construct().

## ◆ $logger

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::$logger
| private

Definition at line 40 of file RestAuthenticator.php.

Referenced by eZ\Publish\Core\REST\Server\Security\RestAuthenticator\__construct().

## ◆ $logoutHandlers

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::$logoutHandlers = []
| private

Definition at line 60 of file RestAuthenticator.php.

## ◆ $providerKey

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::$providerKey
| private

Definition at line 45 of file RestAuthenticator.php.

Referenced by eZ\Publish\Core\REST\Server\Security\RestAuthenticator\__construct().

## ◆ $sessionStorage

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::$sessionStorage
| private

Definition at line 57 of file RestAuthenticator.php.

Referenced by eZ\Publish\Core\REST\Server\Security\RestAuthenticator\__construct().

## ◆ $tokenStorage

eZ\Publish\Core\REST\Server\Security\RestAuthenticator::$tokenStorage
| private

Definition at line 48 of file RestAuthenticator.php.

Referenced by eZ\Publish\Core\REST\Server\Security\RestAuthenticator\__construct().

The documentation for this class was generated from the following file:

- RestAuthenticator.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.