General

  eZ Systems Website
  Technical documentation
  Editor documentation

This Documentation contains:
 
Technical documentation:



⚠ WARNING ! This documentation is deprecated !

Please go to the current Technical Documentation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
Note
titleVersion compatibility

This recipe is compatible with eZ Publish 5.3 / 2014.01

 

Table of Contents

Status
colourYellow
titleEZP >= 5.3 / 2014.01

Description

Symfony provides native support for multiple user providers. This makes it easy to integrate any kind of login handlers, including SSO and existing 3rd party bundles (e.g. FR3DLdapBundleHWIOauthBundleFOSUserBundleBeSimpleSsoAuthBundle, etc...).

However, to be able to use external user providers with eZ, a valid eZ user needs to be injected in into the repository. This is mainly for the kernel to be able to manage content-related permissions (but not limited to this).

Depending on your context, you will either want to create an eZ user on-the-fly, return an existing user, or even always use a generic user.

 

Solution

Whenever an external user is matched (i.e. that does not come from eZ repository, like coming from LDAP), eZ kernel fires an MVCEvents::INTERACTIVE_LOGIN event. Every service listening to this event will receive an eZ\Publish\Core\MVC\Symfony\Event\InteractiveLoginEvent object which contains the original security token (that holds the matched user) and the request.

It's then up to the listener to retrieve an eZ user from the repository and to assign it back to the event object. This user will be injected in into the repository and used for the rest of the request.

Info

If no eZ user is returned, the anonymous user will then be used.

User exposed and security token

When an external user is matched, a different token will be injected in into the security context, the InteractiveLoginToken. This token holds a UserWrapped instance which contains the originally matched user and the API user (the one from the eZ repository).

...

Note

Do not mix MVCEvents::INTERACTIVE_LOGIN event (specific to eZ PublishPlatform) and SecurityEvents::INTERACTIVE_LOGIN event (fired by Symfony security component)

...