2017 © Pedro Peláez
 

library identitymanagementbundle

Kaliop Identity Management Bundle

image

kaliop/identitymanagementbundle

Kaliop Identity Management Bundle

  • Sunday, June 24, 2018
  • by gggeek
  • Repository
  • 2 Watchers
  • 3 Stars
  • 1,565 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 24 Versions
  • 10 % Grown

The README.md

Kaliop Identity Management Bundle

An eZ5 bundle designed to cater all your needs for custom user authentication scenarios: - log in user by his IP - log in user using his email instead of login - get user accounts from an LDAP server (including MS Active Directory) - get user accounts from an external service (needs custom code) - allow logging in to the eZ backoffice using the customized symfony login handlers, (*1)

The base idea is that it should be easy to swap/add remote user services without having to learn the intricate details of the Symfony auth component (firewall/authenticator/userprovider/factory)., (*2)

As such, the logic of the 'ldap login handler' from eZP4 is replicated: 1. when the user tries to log in the 1st time, retrieve his/her profile on the remote system, and create a corresponding eZ user on the fly 2. when the user tries to log in after the 1st time, retrieve his/her profile on the remote system, and update the corresponding eZ user if needed, (*3)

Some nice bits are still missing, but the bundle should be sufficient to get started with simple LDAP integrations., (*4)

Contributions are welcome :-), (*5)

Allow Log In By Email

  • This happens without the need to save the user email in the 'login field', (*6)

  • To activate it: enable the following parameters in parameters.yml:, (*7)

    parameters:
        # take over the default user provider - to log him in other ways than login field
        ezpublish.security.user_provider.class: Kaliop\IdentityManagementBundle\Security\User\Provider\EmailUser
        # take over the auth provider as well, in accord
        security.authentication.provider.dao.class: Kaliop\IdentityManagementBundle\Security\Authentication\Provider\RepositoryAuthenticationProvider

Allow Log In By IP

  • This is implemented via a custom firewall named ip_login in the firewalls section of security.yml. The firewall depends on a separate service for the mapping IP => user account name, (*8)

  • To activate it: ..., (*9)

Log In By Remote Services (LDAP/Active Directory or other)

  • Support for LDAP is built-in, and needs some config and minimal php code, (*10)

  • For other custom external services you wll need to write more php code, (*11)

  • This is implemented via a custom firewall named remoteuser_login in the firewalls section of security.yml, (*12)

  • The firewall depends on two additional services for:, (*13)

    • communicating to the remote webservice
    • creating an instance of (a subclass of) Kaliop\IdentityManagementBundle\Security\User\RemoteUser when user logs in
    • mapping that instance into eZPubish users (creating/updating them on the fly at login time)

Getting started: integrating an LDAP directory

  1. configure the connection to the ldap server, eg:, (*14)

    services:
        # The ldap client config
        my.ldap:
            class: Symfony\Component\Ldap\LdapClient
            arguments:
                - ldap.server.com
                - 636
                - 3
                - true
  2. configure the retrieval of user account information from the ldap server, eg:, (*15)

    # The service used to communicate with the LDAP server
    my.ldap_auth.client:
        class: Kaliop\IdentityManagementBundle\Adapter\LDAP\Client
        arguments:
            # NB: here you can pass in either one ldap client, or an array of clients, to achieve high-availability
            - "@my.ldap"
            -
                # the credentials used to serach the ldap
                search_dn: Lookup.Service@domain.com
                search_password: abcdefg
                # the filter used to look up the user account
                base_dn: dc=domain,dc=com,
                filter: "(sAMAccountName={username})"
                # The ldap attributes to retrieve to build the user profile.
                # NB: by default, when the value of any of these changes, the ez user account is updated
                attributes:
                    - displayname
                    - mail
                    - telephonenumber
                    - memberof
                    - thumbnailphoto
                    - title
                # The name of the ldap attribute used to hold the user email
                email_attribute: mail
                # The name of attribute used to log-in to ldap and validate the password
                ldap_login_attribute: mail
        calls:
            - [ setLogger, [ @?logger ] ]
  3. create a handler class, which converts the RemoteUser into eZ users. Subclass Kaliop\IdentityManagementBundle\Security\User\RemoteUserHandler, implement setFieldValuesFromProfile and getGroupsFromProfile, (*16)

  4. declare it as a service, eg:, (*17)

    # The service which creates repo users out of ldap users
    my.ldap_auth.remoteuser_handler:
        class: My\LdapAuthBundle\Adapter\LDAP\RemoteUserHandler
        arguments:
            - "@my.ldap_auth.client"
            - "@ezpublish.api.repository"
            -
                user_contenttype: user
                default_content_language: eng-GB
                group_mapping:
                    "CN=LTD_Intranet_Administrator": 12
                    "CN=LTD_Intranet_CorpContentManager": 13
  5. tie your new service to the RemoteUser class returned by the ldap client:, (*18)

    parameters:
        kaliop_identity.remoteuser_service_map:
            Kaliop\IdentityManagementBundle\Adapter\LDAP\RemoteUser: my.ldap_auth.remoteuser_handler
  6. set up a firewall definition which activates the whole thing: in security.yml:, (*19)

    ezpublish_front:
        pattern: ^/
        anonymous: ~
        # Allow users to log in via LDAP.
        # The name HAS TO BE 'remoteuser_login'
        remoteuser_login:
            # the service used to connect to the LDAP server
            client: my.ldap_auth.client
        form_login:
            require_previous_session: false
        logout: ~

Allowing remote-service login to the Legacy Admin interface

  1. enable the identitymangementextension extension (bundled in this bundle), (*20)

  2. if you have renamed the firewall in security.yml to anything but ezpublish_front, set up identitymanagement.ini.append.php, (*21)

  3. clear caches, test, done!, (*22)

Advanced usage

Creating a remote-user-provider service for non-ldap services

  1. create a subclass of Kaliop\IdentityManagementBundle\Security\User\RemoteUser, (*23)

  2. create a client class, implementing ClientInterface (take a look at Kaliop\IdentityManagementBundle\Adapter\LDAP\Client as an example), (*24)

  3. declare the new class as a service, (*25)

  4. put the service id in a remoteuser_login in the firewall section of security.yml, (*26)

  5. create a handler class, which converts the RemoteUser into eZ users, implementing RemoteUserHandlerInterface (probably subclassing Kaliop\IdentityManagementBundle\Security\User\RemoteUserHandler is a good idea), (*27)

  6. declare it as a service, (*28)

  7. add it the the handler map in the parameter kaliop_identity.remoteuser_service_map, (*29)

The logical flow is the following: - when a site visitor tries to log in, the client will query the remote system, and, if login is ok, build and return a remoteUser object from the data it gets - immediately afterwards, the handler takes care of matching the remoteUser with an eZuser account, updating/creating it if needed, (*30)

License Latest Stable Version Total Downloads, (*31)

Scrutinizer Code Quality SensioLabsInsight, (*32)

The Versions

24/06 2018

dev-master

9999999-dev

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

24/06 2018

0.8.1

0.8.1.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

16/01 2018

0.8.0

0.8.0.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

31/10 2017

0.7.2

0.7.2.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

31/10 2017

0.7.1

0.7.1.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

31/10 2017

0.7.0

0.7.0.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

01/02 2017

0.6.1

0.6.1.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

05/05 2016

0.6.0

0.6.0.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

04/05 2016

0.5.1

0.5.1.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

04/05 2016

0.5.0

0.5.0.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

12/04 2016

0.4.1

0.4.1.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

12/04 2016

0.4.0

0.4.0.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

06/04 2016

0.3.2

0.3.2.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

06/04 2016

0.3.1

0.3.1.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

06/04 2016

0.3

0.3.0.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

04/04 2016

0.2.3

0.2.3.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

30/03 2016

0.2.2

0.2.2.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

26/02 2016

0.2.1

0.2.1.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

26/02 2016

0.2.0

0.2.0.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

26/02 2016

0.1.4

0.1.4.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

23/02 2016

0.1.3

0.1.3.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

22/02 2016

0.1.2

0.1.2.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

22/02 2016

0.1.1

0.1.1.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires

 

21/02 2016

0.1.0

0.1.0.0

Kaliop Identity Management Bundle

  Sources   Download

GPL-2.0

The Requires