Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-21-2011, 02:43 PM   PM User | #1
Stooshie
Regular Coder

 
Stooshie's Avatar
 
Join Date: Mar 2008
Location: Dundee, Scotland
Posts: 376
Thanks: 9
Thanked 39 Times in 39 Posts
Stooshie is on a distinguished road
Question Authenticate against LDAP and sync with MySQL

I have built an application in PHP/MySQL. To access it, users log in against a users table in MySQL. That all works fine.

Now there is a possibility we will be asked to authenticate against an LDAP server.

I have written a script that can search for a user in an LDAP server.

However, if I get a successful return from LDAP how do I link all the other tables in the Database (that were originally linked to the users table) to the LDAP user?

Any help is appreciated.
__________________
Regards, Stooshie
O
Stooshie is offline   Reply With Quote
Old 09-21-2011, 03:44 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Create an aliasing between an LDAP user and its MySQL user equivalent. This will take a new table to establish the relationship between the current mysql user and its ldap account (can you get the sid from an ldap, or maybe just stuck with dn). Then write an adapter to stand between the mysql account and the ldap account which is capable of resolving a ldap name as a mysql id. This can now be used to associate anything owned by the mysql user with the ldap user.
If you're OO, its likely that this will only take a few minutes. If you're procedural, I'd expect it to take a lot longer.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
Stooshie (09-21-2011)
Old 09-21-2011, 03:49 PM   PM User | #3
Stooshie
Regular Coder

 
Stooshie's Avatar
 
Join Date: Mar 2008
Location: Dundee, Scotland
Posts: 376
Thanks: 9
Thanked 39 Times in 39 Posts
Stooshie is on a distinguished road
Thanks Fou-Lou. Will try that.
__________________
Regards, Stooshie
O
Stooshie is offline   Reply With Quote
Reply

Bookmarks

Tags
authentication, ldap, mysql, php, synchronization

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:19 AM.


Advertisement
Log in to turn off these ads.