Sunday 12 March 2017 8:29:07 pm - 9 replies
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.
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.
Sunday 12 March 2017 11:36:04 pm
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:
* Note: We forgot to package and release this extension some time ago but have been using it as part of our open source ezpedia.org code base. We thank you for reminding us and prompting us to package the code for individual usage.
Concerning double authentication we did something similar but actually quite different with this solution:
Now code sharing asside. 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 truely 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!
Modified on Sunday 12 March 2017 11:37:23 pm by // Heath
Sunday 12 March 2017 11:36:59 pm
This thread is also cross posted on stackoverflow.com:
Sunday 12 March 2017 11:48:31 pm
For further examples of how to create a module view (or a copy of a default module view) research the following extensions which provide module views (non-copies):
Also ezpedia.org overrides the default rss module view (in a less than perfect / clean way) which you can learn from the code:
Again we hope this helps!
Monday 13 March 2017 6:58:09 pm
thank you, your answers helped. Specifically the https://github.com/brookinsconsulting/bckernelmoduleoverride which helps to override other kernel modules.
Monday 13 March 2017 7:55:13 pm
Congratulations! Your very welcome.
Happy to help.
Would you take a minute and mark this thread as solved?
If you have already solved your problem please remember to mark your original post as solved by clicking the checkbox image at the top of the title of this thread and it will turn green indicating solved status. Thank you.
Tuesday 14 March 2017 8:14:20 pm
I was wondering if you would be willing to help contribute to a shared open source solution to the "Duo Multifactor Authentication" user/login need?
I would love to speak with you over email about being able to abstract your work into a clean publicly available example solution which might help others in the future.
What do you think? Would you be willing to contribute?
Wednesday 15 March 2017 3:59:35 pm
Thank you for your willingness to collaborate and contribute!
I have sent you a message via the share.ez.no user contact system.
Please check your email and reply back to me
As to the question 'how to mark thread as answered' you must login to share.ez.no, navigate to the original forum thread and at the top of the thread display near the start of the thread title you will find a image greyed out that looks like a checkbox, when you click it it might take a second but it will turn green which means the thread has been correctly marked as answered.
Look forward to speaking with you soon.
You must be logged in to post messages in this topic!