handling logout for an SSO
We're using a SSO developed at UMich called CoSign (www.weblogin.org). We're working on integrating cosign w/ drupal. Currently, we're using the webserver_auth module to handle log in - cosign just sets $_SERVER[ 'REMOTE_USER' ] and creates some cookies, so webserver_auth is working fine.
We need to be able to handle logout tho, and since cosign logout is handled by a cgi, I pretty much just need to have a logout action that redirects to our logout cgi.
Sorry, I'm a complete noob and this is my first attempt at a drupal module. I'm trying this:
function cosign_user($op, &$edit, &$account, $category = NULL) {
global $user;
if( $op == 'logout' ) {
watchdog( 'cosign', "logout: $user->name" );
cosign_logout();
}
} // function cosign_user
function cosign_logout() {
global $user;
module_invoke_all('user', 'logout', NULL, $user);
header('Location: https://' . $_SERVER[ 'SERVER_NAME' ] . '/cgi-bin/logout?'
. 'https://' . $_SERVER[ 'SERVER_NAME' ] . '/drupal/' );
} // function cosign_logoutand it sooooo does not work. I get redirected to https://www.example.org/drupal/?q=logout (not surprising) and I get pages upon pages of my watchdog message.
There are other things this module will need to do eventually (require all editing to be done on the https side, display our login link, etc)... but I'm just trying to get logout working to start. I'd appreciate any suggestions.
thanks!
Liam

One problem I see
One problem I see is the call
module_invoke_all('user', 'logout', NULL, $user);in cosign_logout(). This effectively produces a recursive call to cosign_user() which calls cosign_logout() which call module_invoke_all(), etc. My guess is a) you do not want the call to module_invoke_all() and b) you want to set the weight of your module high so it runs last in the chain. The weight is in the system table and can be set from you install file or manually.drupal_goto..
Ok, I cranked the weight of my module up to 10, and dcommenting out the module_invoke_all. I think I'm getting stuck in user_logout() in the user.module, tho, which has a...
// The time prevents caching.drupal_goto(NULL, 'time='. time());
at the very end of it (~ ln 1042).
My module is trying to issue...
header('Location: https://' . $_SERVER[ 'SERVER_NAME' ] . '/cgi-bin/logout?'. 'https://' . $_SERVER[ 'SERVER_NAME' ] . '/drupal/' );
which I'm assuming isn't working because the output has already been sent.
The comments in include/common.inc say I should use drupal_goto instead of php's header(). If I put
drupal_goto('admin/access/roles');into my function, it does go to the roles screen. So, can I use drupal_goto to point to a URL outside of drupal? Mebbe by installing something in the url_alias table?
Hi, I am looking at setting
Hi,
I am looking at setting up a Drupal website at my university, and I need to integrate it with our single-sign-on service, which is cosign-based.
Has this module been released? I would be interested in using it.
Mike.
contributed
I just contributed the code today.
Right now, the project page says "There are no published releases for this project. Recently added releases will not be published until the packaging scripts have run.", so let me know if you would like a copy before a release is ready.