Extension to combine LDAP and DB authentication

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Ideas Centre
Post Reply
ryan77627
Registered User
Posts: 8
Joined: Thu Jul 19, 2018 6:24 pm

Extension to combine LDAP and DB authentication

Post by ryan77627 »

I need a really simple extension that simply combines the functions of the LDAP and DB authentication mechanisms. There are many posts in the archived forums about how to do this in PhpBB 3.0 however the authentication system got rewritten in 3.1

I need the extension to do the following:
  • Try to authenticate the user using the LDAP backend, if the user is found proceed to authenticate the user using that, same as the default LDAP auth. (If user exists in the LDAP but not in the board an account is made using the values from the LDAP like email and what-not)
  • If a user doesn't exist in the LDAP, meaning it's a regular user not staff (in my use case) and the LDAP authentication fails, try to authenticate the person using the DB next before throwing an auth error from LDAP. (This means I can keep registration open since the default LDAP auth method still registers users in the DB still, they just can't authenticate after making an account since the db check isn't in place)
  • If they both fail, then throw an error, either invalid username or invalid password.
I'm gonna try to throw something together but I have zero knowledge in PHP so if someone could do something way quicker than me that would be appreciated a lot!
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: Extension to combine LDAP and DB authentication

Post by martti »

Your extension has to define its own authentication provider like explained here. I did also do this for my Email Login extension. You can use the code or extend the existing Db and LDAP authentication providers.
ryan77627
Registered User
Posts: 8
Joined: Thu Jul 19, 2018 6:24 pm

Re: Extension to combine LDAP and DB authentication

Post by ryan77627 »

Thanks! I ended up combining the DB and LDAP auth methods, however the method I did was very choppy since it replaced core files (Ouch!) I am going to study your extension to develop my auth method properly as an extension. Then, I may just post it here!
abd
Registered User
Posts: 41
Joined: Fri Dec 05, 2003 3:57 pm

Re: Extension to combine LDAP and DB authentication

Post by abd »

Can you please explain how you accomplished this? I am trying to do the same thing.
Thank you
rokx
Registered User
Posts: 4
Joined: Sun Nov 30, 2008 7:21 pm

Re: Extension to combine LDAP and DB authentication

Post by rokx »

Just if anyone stumbles here:
I made an extension to combine the db and ldap already intergrated in phpbb forum.

https://www.phpbb.com/customise/db/exte ... b_or_ldap/
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Extension to combine LDAP and DB authentication

Post by david63 »

rokx wrote: Mon Feb 28, 2022 8:47 am Just if anyone stumbles here:
I made an extension to combine the db and ldap already intergrated in phpbb forum.

https://www.phpbb.com/customise/db/exte ... b_or_ldap/
Do you mean that you have submitted an extension to the CDB that has not as yet been approved?
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28619
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Extension to combine LDAP and DB authentication

Post by Paul »

Only you and the extensions team will be able to see that page, untill it is approved. And it might only get approved if you submit a revision of the extension.
baluchen
Registered User
Posts: 25
Joined: Sun Nov 13, 2016 2:03 pm

Re: Extension to combine LDAP and DB authentication

Post by baluchen »

rokx wrote: Mon Feb 28, 2022 8:47 am Just if anyone stumbles here:
I made an extension to combine the db and ldap already intergrated in phpbb forum.

https://www.phpbb.com/customise/db/exte ... b_or_ldap/
I do need this Extention. Please make it available for the community as the link was broken.

Thanks
Bala
rokx
Registered User
Posts: 4
Joined: Sun Nov 30, 2008 7:21 pm

Re: Extension to combine LDAP and DB authentication

Post by rokx »

I don't know how thing work so I tought I made everything ok. Will fix it.

In the mean time you have the source and instructions available at https://github.com/rokx/phpbb_ext_db_or_ldap.
rokx
Registered User
Posts: 4
Joined: Sun Nov 30, 2008 7:21 pm

Re: Extension to combine LDAP and DB authentication

Post by rokx »

.
baluchen
Registered User
Posts: 25
Joined: Sun Nov 13, 2016 2:03 pm

Re: Extension to combine LDAP and DB authentication

Post by baluchen »

rokx wrote: Tue Mar 15, 2022 8:30 am I don't know how thing work so I tought I made everything ok. Will fix it.

In the meantime you have the source and instructions available at https://github.com/rokx/phpbb_ext_db_or_ldap.
Thank you for your response. I tried as per the instruction. I enabled the extension. But, When I click ACP ->General ->Authentication - The page was broken with a 500 Error. I reviewed the Apache server log and I could find the below entries.

Code: Select all

[Tue Mar 15 05:25:14.750419 2022] [php7:error] [pid 17014] [client 10.71.22.32:51340] PHP Parse error:  syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /var/www/html/board/ext/rokx/dborldap/auth/provider/db_or_ldap.php on line 307, referer: https://forums.mycompany.com/board/adm/index.php?sid=e74aa259646788392b415827c0b1c68d&i=1
Please advise me If I'm missing something. My board version is 3.3.3 running on CentOS

Note: If I disable this plugin, I can navigate authentication page.

Thanks
Bala
rokx
Registered User
Posts: 4
Joined: Sun Nov 30, 2008 7:21 pm

Re: Extension to combine LDAP and DB authentication

Post by rokx »

@baluchen

I just submitted a revision and it's not yet validated.

Based on the pre-submission checks I tried to make some changes, but it went into the wrong way. You seem to have downloaded before I tested the changes completely. Sorry for that.

The repository on github is updated and I kindly ask you to redownload the content. You can just overwrite files.

I just tested it on 3.3.4 and it works as expected.

This extension is not so complicated. Its merely a merged copy of db and ldap authentication modules of core phpbb. I don't see a reason of why it not already present in the original phpbb installation.

Thank you for being the first one to test it :D
baluchen
Registered User
Posts: 25
Joined: Sun Nov 13, 2016 2:03 pm

Re: Extension to combine LDAP and DB authentication

Post by baluchen »

Excellent!. I tried this and it is working both DB and LDAP. Thank you very much for your support.
Last edited by Kailey on Fri Mar 18, 2022 11:48 am, edited 1 time in total.
Reason: Full quote of previous post was not needed :)
Post Reply

Return to “Extension Requests”