Login via External Database

Creating and modifying plugins.
Post Reply
queej
Regular
Posts: 6
Joined: Thu Aug 16, 2007 10:15 pm

Login via External Database

Post by queej »

I am trying (not very successfully) to have users of my application to be logged in automatically Serendipity authors when they use our login form. The serendipity blog is embedded into our app, and is used in various places, but it is not the central page.

Since we already use our own form, I can't have a second form that logs users into the blog portion of the site.

It would be great if I could get Serendipity to simply look at that table or one of my application routines to determine if the user is logged in, and what his role is. But I can't quite follow the code, so I am not sure where to put in a replacment call to my login logic.

As an alternative, I suppose I could keep dual entries in the Serendipity authors tables, but I still can't figure out where it determines whether a user is logged in.

Is there another way to think about this? Any help would be appreciated.
Cheers,
-queej
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Login via External Database

Post by garvinhicking »

Hi!

That's very hard to do. S9y requires his own authentication tables to do joins on.

You might want to have a look at the serendipity_event_externalauth plugin that offers LDAP proxy authentication, which you might be able to adapt for your application. Another way is to use MySQL 5 views to redirect authentication tables to match serendipity's expected serendipity_authors DB table scheme.

For serendipity to work, it needs to have a serendipity_authorid because those are required for several SQL lookups to display entries. Also, s9y has an intensive user/group management with permissions and privileges, and it can only map those privileges with a valid author id. So you can't operate s9y on a foreign user table.
As an alternative, I suppose I could keep dual entries in the Serendipity authors tables, but I still can't figure out where it determines whether a user is logged in.
that works through cookies, have a look at include/functions_Config.inc.php the serendipity_userLoggedIn() routine.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
queej
Regular
Posts: 6
Joined: Thu Aug 16, 2007 10:15 pm

Re: Login via External Database

Post by queej »

Thanks, Garvin. I'm using Postgres, and I'm using different databases distributed across several servers, so the MySQL option would not work in my case.

I think I am going to have to take the duplicate authors approach. I don't mind inserting automatically into the authors table from my app's login page. I'll keep looking at the functions_config.inc.php file to see if I can set whatever variables I need automatically when users fill in my app login form.
Cheers,
-queej
Post Reply