Project:Google Apps Authentication
Version:5.x-1.0
Component:Code
Category:feature request
Priority:critical
Assigned:ssnider
Status:needs review

Issue Summary

I was wondering if there were any plans to port this module over to Drupal 6. It's such an awesome module that's quite flexible, and would provide a valuable asset to Drupal.

Keep up the good work!

Comments

#1

Ditto, would love to have this ported.

#2

Component:Miscellaneous» Code
Assigned to:Anonymous» Cwolly

I'm working on this. I've never ported anything before, but I'm making headway. I've got most things working but I get access denied on the /admin/settings/googleauth page. Something to do with how 6.2 handles authentication.

/**
* Implementation of hook_menu().
*/
function googleauth_menu() {
  $items['googleauth/signin'] = array(
    'title' => 'Provider',
    'page callback' => 'googleauth_sign_in',
    'access arguments' => array('use googleauth'),
    'type' => MENU_CALLBACK,
   );
  $items['googleauth/signout'] = array(
    'title' => 'Google Sign Out',
    'page callback' => 'googleauth_sign_out',
    'access arguments' => array('use googleauth'),
    'type' => MENU_CALLBACK
   );
  $items['admin/settings/googleauth'] = array(
    'title' => 'googleauth module settings',
    'description' => 'googleauth configuration settings for file paths',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('googleauth_adminpage'),
    'access arguements' => array('access administration pages'),
    'type' => MENU_NORMAL_ITEM,
   );
 
  return $items;
}

Any help would be appreciated.

#3

Priority:normal» critical
Assigned to:Cwolly» ssnider

Sorry for the communications lapse -- I definitely plan to attempt a port. I'd be interested in looking at anyones code that even partially implements a port.

#4

This is probably due to 'access administration pages' no longer being the admin privilege in drupal 6. if you can look in your db and see what the new value is, the code should start working.

#5

Okay I'm entirely new to this stuff and to be honest I'm just playing around but try this for the auth part:

/**
* Implementation of hook_menu().
*/
function googleauth_menu()
{
$items = array();
 
$items['googleauth/signin'] = array(
'title' => 'Provider',
'page callback' => 'googleauth_sign_in',
'access arguments' => array('use googleauth'),
'type' => MENU_CALLBACK
);
$items['googleauth/signout'] = array(
'title' => 'Google Sign Out',
'page callback' => 'googleauth_sign_out',
'access arguments' => array('use googleauth'),
'type' => MENU_CALLBACK
);
$items['admin/settings/googleauth'] = array(
'title' => 'googleauth module settings',
'description' => 'googleauth configuration settings for file paths',
'page callback' => 'drupal_get_form',
'page callback arguments' => 'googleauth_adminpage',
'access arguments' => array('access administration pages'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}

It still generates, some errors; different errors but we could do this conversion piece by piece.

#6

I've been having a time getting this working in Drupal 6. Anyone make progress? I have a testing environment set up if anyone needs code tested. I can't seem to it to work with Drupal 6.2.

#7

I think I got this working in Drupal 6, will do further testing tomorrow and submit patch.

#8

Status:active» needs review

Ok, so I've implemented the code for the googleauth.module and it is working with drupal 6. Submitting for review. This patch is working, but keep in mind you need to modify your googleauth.info to reflect Drupal 6 core for this to work.

Also, the bugs such as the SAML request bug that was never fixed in the 5.x version of this module are still there, as it is beyond the scope of my knowledge.

Patch incoming...

AttachmentSize
googleauth.module.patch 10.45 KB

#9

Seems this has gone stale... any chance we can see this updated officially for Drupal 6? If not, how do I apply the patch? Standard unix patch command against the original sources?

#10

Running the patch... seems to work, when I enter my google docs subdomain I am forwarded to the signin page, I login, but I am left in drupal. After signin I should be redirected to google apps, correct?

#11

I ran the patch, but it says not compatible with Drupal 6.9

#12

Has anybody checked this: http://drupal.org/project/google_auth

#13

I've got this working without any problems today in D6 using the sample code provided by google - so it does not use any of this module's code.

I've attached the code. I've called my module 'hs_gauth' and renamed the functions in a similar fashion. I would also be willing to become a co-maintainer for this module, if the author doesn't want to support it anymore.

The module comes with no UI. You have to fill in your domain (e.g. example.com) in the .module file. It will register the path /hs_gauth to handle all requests. So you should register the following paths on Google's SSO settings:
http://examle.com/hs_gauth/pw - to change the password (will redirect to the user/$id/edit page)
http://example.com/ - as your logout page (I don't want to log users out of my site when they log out of Google Apps)
http://example.com/hs_gauth/login - as your login page

If Javascript is enabled, you'll never even see the module in the frontend. It just takes the name of the current drupal user and throws it at Google.

You might want to enable the http://drupal.org/project/r4032login module, so that users are directed to the login page when they try to access GApps, get directed to the module's login handler but are not signed in (otherwise they'll see a 403 access denied message).

The sample source code can be found here:
http://code.google.com/intl/de-DE/apis/apps/sso/saml_reference_implement...

A guide on how to create the public/private keys is found here:
http://code.google.com/intl/de-DE/apis/apps/articles/sso-keygen.html
I've used these commands:
openssl dsaparam -out dsaparam.pem 1024
openssl gendsa -out dsaprivkey.pem dsaparam.pem
openssl dsa -in dsaprivkey.pem -outform DER -pubout -out dsapubkey.key
openssl req -new -x509 -key dsaprivkey.pem -out dsacert.pem (upload this file to Google Apps)

You can delete the dsparam.pem file now. You should not put these files in the module's directory so to not have anybody download your private key file. Fill in the key paths at line 112/113 of the .module file.

Please let me know what you think.

P.S. @jfha73: the google_auth module, as far as I understand it, uses this feature just the other way round: Google handles the login and then passes this information on to your site. This module, however, handles the login and passes the information on to Google.

AttachmentSize
hs_gauth.tar_.gz 4.94 KB

#14

subscribe

#15

subscribe

#16

I can confirm that the basics of the module posted to this thread works. The javascript redirect isn't working for me, but I'm looking into that now. Since the sample PHP code is basically good to go, this just needs a bit of massaging. I will report back once I get it working soundly, we're implementing this on a Drupal / CiviCRM / Google Apps implementation for a non-profit here in Philadelphia.

#17

Any report back would be greatly appreciated.

#18

subscribe

#19

I put together a D6 version based on the D5 one, EastWan's version, and some general tweaking.

I can't believe how long it took to even figure out this was the module to look into for basic SSO with Google Apps.

My current copy is attached; it's working great for me, hopefully it'll be useful.

What's the next step with getting this project to D6? I can make a patch if needed.

AttachmentSize
googleauth-6.x.tar_.gz 19.5 KB

#20

This sounds great, but I just tried it and when I enabled it it gave me this:

warning: Invalid argument supplied for foreach() in /path/to/Drupal/includes/menu.inc on line 258.

I disabled it and the warning went away.

#21

Thanks, brendanxc, this works really well.

The fix for #20: You used "'access arguments' => TRUE", instead of "'access callback' => TRUE," in googleauth_menu(). Probably a typo, as you don't want access arguments there (otherwise they'd have to be an array).

I've fixed this. Also, I've added the menu hook for the Change Password option in Google Apps, it's googleauth/pw and it simply redirects to the user's profile.

AttachmentSize
googleauth-6.x.tar_.gz 10.16 KB

#22

So that everyone knows, I have a sandbox for this module here: http://drupal.org/sandbox/cweagans/1414826

I'm going to be finishing up the port to Drupal 6 and cleaning it up for release, as well as porting to Drupal 7.