PDA

View Full Version : External Authentication: The SIMPLEST thing that could possibly work?


cowboyd
03-12-2008, 11:51 PM
Hi there,

I'm migrating our current forum from drupal to vbulletin. Our main user database and profile data is in a java application running in the same domain. I've successfully integrated (mostly) our users but I'm running up against some problems when it comes to authenticating the user.

The way it works is this:

All the users in the java application have a forumId field which contains the vbulletin userid of that user's corresponding forum account. There is a REST api in the java application for converting a sessionids into forumId.

So, I wrote a little php hook in drupal to read the sessionid from a cookie (set by the main java application), then make the REST call to the java app to convert the sessionid into a userid, and then, load the user into the php request based on that id (if no id is found, then just load the anonymous user)

Now that I have the userid, I know they must have already been authenticated by the main application to have gotten a valid session id, so I don't need to do any other form of authentication. I know which user, and I know that they're authenticated, so I just want to have everything else just use that user.

I don't want vbulletin to do login at all. I don't want it to collect the username/password at all. I never want it to show a login form of any kind. I just want it to take the id it gets back from the java application and handle the request as though that user was logged in the entire time.

In cases where a login is required, I want it to redirect to the java application.

Does this clarify things?

Marco van Herwaarden
03-13-2008, 03:50 PM
The basics on how to integrate a vBulletin session can be found in the Articles section. A few articles should have information regarding this topic.

cowboyd
03-13-2008, 06:32 PM
This was about the closest thing I could find, but it doesn't really work because

1) We don't control the apache deployment, and
2) it requires you to have access to the vbulletin username and password.

Reeve of shinra
03-13-2008, 07:36 PM
There are two projects out there focusing on integrating drupal with vb... you may want to check into them as it sounds like it may be the best long term solution for you.

cowboyd
03-13-2008, 07:36 PM
Ok,

I was able to get it to work somewhat, by modifying init.php




$uid = 0;
$session_id = $_COOKIE['gameonleagues-signon'];
if ($session_id) {
$ch = curl_init();
//call out to java application.
$LEAGUE_LOOKUP = "http://localhost:8080/account/session2forumid";
curl_setopt($ch, CURLOPT_URL,"$LEAGUE_LOOKUP/$session_id");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_VERIFYHOST, false);
curl_exec($ch);
if (!curl_errno($ch)) {
$uid = curl_multi_getcontent($ch);
} else {
//curl error, java site is down.
}
}

$vbulletin->session->userinfo =& fetch_userinfo($uid);



that seems to load the user in their every time. Now, I just need to disable the login box, and the logout link, or, have the login form submit to my java application.

--------------- Added 1205441158 at 1205441158 ---------------

There are two projects out there focusing on integrating drupal with vb... you may want to check into them as it sounds like it may be the best long term solution for you.

Actually, I migrating away from drupal altogether. We were using them as our forum software. The drupal api is super slick, and I was able to integrate their site with single signon without any changes to the drupal core. However, the drupal forums are pretty lame on a good day.

What I want is for vbulletin to fulfill the role that drupal did. namely, the forum software that complements our main site (in java).

lhama
03-14-2008, 03:20 AM
Ok, I am reaallyy new to this, but from what I read here I understand that you guys are talking about the thing I wanna do. So I want to know little more about your way of doing it.
I also have a drupal website and a not so good forum with it. I have purchased vB and want to add to my website. Now, my users register their baby's birthday (and more) and I display them their baby's age and proper information on login, so I couldn't possibly use vB authentication for my main website, so instead i wanna use main registration for vB and don't want vB to have any login window etc. Sounds like you have made it little further that I am, so could you please, help with it? Little guidance, step by step? I would really apreciate.