r/PHPhelp • u/concernedesigner • Aug 31 '22
When to use LDAP?
Hey everyone,
My buddy and I are working on a project, he's more of an IT solutions guy and I'm a programmer/designer. The app we're building has a user registration system and the app also enables them to upload files. We would like to host the application on our own servers, that's where his role comes into play.
He came back to me suggesting we utilize Active Directory or LDAP whereas I already started building everything in MySql. After digging into Active Directory/LDAP, I must admit that it seems like a nice package but is it secure, safe & supported? Are these technologies better served in certain environments than others? Are thee any advantages for using LDAP overa SQL database to manage user credentials/authentication in addition to storing files? If we use LDAP for those things, would I be better off writing the entirety of my DB schema in LDAP or does a hybrid with MySql make sense?
Appreciate any insight - I'm a hobbyist PHP dev who works professionally in other languages so some of these more nuanced topics aren't as familiar to me.
Thanks!
2
u/gordonv Aug 31 '22
Deduplicating access via LDAP is a good idea. Less stuff to admin. The users will remember their username and password is the same as their "Windows Power On" password.
And if you have to lock down the account, easy to do it in one step.
1
u/projector_man Sep 01 '22
I use LDAP in one of my apps user accounts, works great in my context. So much less admin for managing user accounts.
You will still want to use mysql for a number of reasons.
Logging
At least one admin account that isn't tied to the LDAP, incase that goes down.
Setting permissions, my environment is a school. Teachers are allowed in, students are not, some teachers are allowed into certain parts of the app, others are not. All managed through my accounts table
0
Sep 01 '22
[deleted]
1
u/concernedesigner Sep 01 '22
For a public website site, I can think of no reason to add the complexity of LDAP or Active Directory. SSO is a different matter, but not essential either
Thanks, yeah I think you're exactly right. I think I jumped the gun when my buddy made the suggestions and I just kinda spiraled into these topics lol. The searching functionality in ldap seems like a nice benefit but if I track my user's uploads on the database I also have access to querying searches.
6
u/gordonv Aug 31 '22
So, there are actually 3 technologies you should be looking at:
Active Directory (Windows Login via Domain)
LDAP (The open Lightweight Directory Protocol for unsimilar systems to authenticate)
SSO (Single Sign On) (Authenticating with other big providers like Google, Facebook, AWS, Etc)
So when do you use what?
AD, Active Directory, if you're in an office environment and everyone logs into a domain. The Domain server is local to your network. And you want to integrate app permissions into the windows administrator's view. This is more secure, but requires the client to be connected to the business network.
LDAP, this is easy and is used for basic authentication. You can't embed permission levels like how you can with AD. Also, you need to be on the local network. In PHP, most people use LDAP to access their AD hosted logins. You have to login to the page manually. And your sessions can be sustained by cookies.
Single Sign On, SSO. This is where a web resource can authenticate with a workplace server from where ever. Best of all, it creates the illusion of a web page being magically logged in via your Windows sign on. Also, for extra security, you can bundle MFA.
I recommend using SSO. This removes that "immersion breaking" moment when users need to log in with a username and password, because windows in the background is logging you in. But for that to happen, you need to install an SSO software on your Primary Domain Controller, a windows server.
Also, many services are getting into using something like PingID with SSO+AD to create that "enter your pin that you just got on your phone" security system.