phpcontent-management-systemezpublish

eZPublish 5 - Custom user authentication (multifactor)


We have eZPublish 5. The authentication is handled by User kernel module kernel/user/login.php. This PHP script is called when trying to access a siteaccess which requires authentication.

Example scenario:

When trying to access http://example.com/marketing

it redirects me (when not logged in) to http://example.com/marketing/user/login

Which is expected behaviour.

What I would like to achieve is to rewrite the kernel/user/login.php file and preferably keep the url the same (this is not mandatory).

I need to do this because I need to integrate Duo Security Multifactor Authentication, so I need to handle the logging in in a custom way.

So on the first page I need to display the login form, then when it is submitted I need to verify if credentials are correct (but not log in the user at this phase) then I need to return another view where an iframe is present for the second authentication, and when the second authentication is successful only after that I can login the user and redirect him/her to the desired page.

Is there any way how to do this? I tried to create an extension with a module user and view login.php but it doesn't worked - the User kernel login.php is executed always when http://example.com/marketing/user/login is hit.

I am trying to do this for several days now but no luck and I'm out of ideas.

Thanks in advance for any help.


Solution

  • Welcome to the eZ Community!

    What you want / need is both possible and quite simple to implement :)

    First based on your description I recommend the following:

    https://github.com/brookinsconsulting/bckernelmoduleoverride

    Concerning double authentication we did something similar but actually quite different with this solution:

    https://github.com/brookinsconsulting/bcconfirmpassword

    Now code sharing aside. You may want to first study the login handler system which provides for many forms of custom user authentication system. https://en.ezpedia.org/en/ez/login_handler

    Yet from your description and some intuition on our part it truly sounds like without more information that you very well do need to both override the default user/login module view (what we call a kernel module view copy override; copy the default module and customize the code within an extension module). We have done this -a lot- for special customer use cases and it's not very hard.

    Most of the time the hard part is getting all the module and module view identifiers to not conflict once within an module extension and we think that will be less of a problem for you if you simply use / leverage the bckernelmoduleoverride extension which provides for using default kernel modules and module views customized within a module view extension.

    Please feel free to ask further questions or share more information about your custom authentication system your trying to integrate. Frames in this day and age sounds like a painful system to be required to implement for a secondary authentication system.

    We hope this helps!

    Note: This thread is cross posted from: http://share.ez.no/forums/ez-publish-5-platform/ezpublish-5-custom-user-authentication-multifactor