Custom Joomla 4 Authentication Plugin Topic is solved

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
mr412
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Jun 02, 2023 2:49 pm

Custom Joomla 4 Authentication Plugin

Post by mr412 » Fri Jun 02, 2023 2:55 pm

Hello

I need a custom authentication plugin to login with our ERP System. I tried this documentation:
https://docs.joomla.org/J4.x:Creating_a ... for_Joomla

This plugin does not work even without customizations.

from our ERP system it is relatively simple, only it seems to be very complicated in Joomla.

Credentials --> ERP REST --> return success = Login...

Does anyone have an example for Joomla 4? I have looked at all the Facebook Auth plugins, etc. but they are all too extensive to rebuild.

Thank you in advance!

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17438
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Custom Joomla 4 Authentication Plugin

Post by toivo » Sat Jun 03, 2023 7:10 am

Welcome to the Joomla forum!
mr412 wrote:
Fri Jun 02, 2023 2:55 pm
This plugin does not work even without customizations.
The plugin if the example is very simple. Which type of error messages are displayed on the login page or written to the log file?

Which ERP system are you using? Which authentication protocols does it support?
Toivo Talikka, Global Moderator

mr412
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Jun 02, 2023 2:49 pm

Re: Custom Joomla 4 Authentication Plugin

Post by mr412 » Tue Jun 06, 2023 6:07 am

thank you very much for the feedback.

even that doesn't work because the plugin can't be loaded.

Code: Select all

 public function onUserAuthenticate($credentials, $options, &$response) { 
  $response->status = Authentication::STATUS_SUCCESS;  
  }
The error message is:
Cant load Authentication Plugin 'authenticate'

I have now solved this by modifying the LDAP plugin. The difference is that the LDAP plugin registers itself as a provider. A tutorial for this would be ingenious.

mdr6273
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Jan 16, 2017 8:56 pm

Re: Custom Joomla 4 Authentication Plugin

Post by mdr6273 » Sat Mar 02, 2024 7:53 pm

mr412 wrote:
Tue Jun 06, 2023 6:07 am
I have now solved this by modifying the LDAP plugin. The difference is that the LDAP plugin registers itself as a provider. A tutorial for this would be ingenious.
I'd be interested in how exactly! I'm having the same issue with the example code; the plugin fails to load.

I get a page warning: JAuthentication: :authenticate: Failed to load plugin:

I have modified the plugin to accept ANY username and check for reverse password like the example, no other changes and it does authenticate.

robbiej
Joomla! Apprentice
Joomla! Apprentice
Posts: 43
Joined: Wed Apr 06, 2016 11:22 am

Re: Custom Joomla 4 Authentication Plugin

Post by robbiej » Sun Mar 03, 2024 8:02 pm

There were a couple of problems with the code which I've fixed and updated that joomla docs page. I've tested it and it now seems to work ok.

The method has to be called onUserAuthenticate as it's called directly by Joomla. Joomla checks if that method exists and gives the error "Failed to load plugin" if it doesn't.

I'd be grateful if you guys gave it another try to check it's all ok now, thanks!

mdr6273
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Jan 16, 2017 8:56 pm

Re: Custom Joomla 4 Authentication Plugin

Post by mdr6273 » Sun Mar 24, 2024 12:17 am

The plugin will load now and not give the error, however autnetication is not working. Using the exact example, unmodified, username exists and password is username reversed (not the actual password obviously) and the error:

Username and password do not match or you do not have an account yet


Post Reply

Return to “Joomla! 4.x Coding”