Need to add a single sign out support for the cas server module.
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | 1176704-6-backport-26.patch | 5.71 KB | bfroehle |
| #25 | 1176704-7-follow-up-reponse-25.patch | 1.5 KB | bfroehle |
| #23 | 6.x-3.x-1176704-backport.patch | 5.21 KB | bfroehle |
| #21 | cas_server_sso-1176704-7.patch | 5 KB | metzlerd |
| #18 | cas_server_sso-1176704-7.patch | 4.78 KB | metzlerd |
Comments
Comment #1
bfroehle commentedMarked #1270952: CAS Server module: Logout does not work as expected as a duplicate.
Comment #2
slayne40 commentedHy,
First, excuse me for my english.
Secondly, excuse me because it is a solution for version 6.x-3.x... but that should work with version 7.x-1.x.
I used the hook_user (logout operator) to get services and tickets in the database, and initiate http requests to warn disconnection.
Unfortunately I had to remove the deletion of ticket in _cas_server_validate function.
I think it just add a field in the table cas_server_tickets, to mark a ticket unavailable.
What do you think?
Comment #3
bfroehle commentedOverall, I think we are definitely on the right track here. Thanks for taking the initiative. You are correct that the code should be mostly identical for the 6.x and 7.x versions.
I have a few comments... let me know what you think of these ideas:
We'll need to either:
1) Add a field indicating whether the ticket has been used; or
2) Have two separate tables, one for used and one for unused tickets.
I think the first option would be better.
I think it'd be worth turning this into a function, so that others can call it if necessary. (e.g., maybe we'll implement hook_cron to automatically log out sessions after a certain period of time?) Or maybe an admin interface for logging folks out?
This should probably be a theme function, similar to how we handle other sorts of login/logout responses.
Comment #4
slayne40 commentedTotally agree with you.
Thanks.
Comment #5
metzlerd commentedAlthough I agree with putitng this in a function, because I like the idea of hooks being clean, one should be careful about calling this remotely as it would not destroy the user session on the cas server itself. A controlled graceful cron based on a login hook should probably execute hook_logout anyway for other sessions. This begs the question about whether the logout hook fires for session cleanup where the cookies time out, etc. Anyone know the answer to this?
I meant to mention that I've also started this work, but from the other end. Starting with the database modifications. I took the route of an additional "valid" column rather than a separate table. I'm working in the 7.x.1-dev branch and will get to posting some patches soon. Will likely use this work as a basis.
Comment #6
metzlerd commentedHere's a 7.x-1 patch based off of this one that appears to work. Tried to incorperate the requested changes.
Comment #8
bfroehle commentedDave: I think you need to update your repository.
For the new database field, 'valid', should the default value be 0 or 1? I see arguments both ways, and I'm okay with 0, but since insertions will generally be when we create a new ticket, it would also make sense for it to be 1.
Is this necessary?
drupal_http_request doesn't use the 'query' parameter... Does
$response = drupal_http_request($client->service, ...)not work?I think it is a best practice to do as few DB queries as possible. In this case, we should consider deleting all of the tickets in one go:
Comment #9
metzlerd commentedYes, I just did a branch rebase to update the repository. Didn't go as well with EGit as I'd hoped.
I was thinking 0 because at install time any tickets in the system would be invalid. (Otherwise would've been deleted already).
I was having some problems with a cas enabled site without clean URL's. I'll do some additional testing to see if it is still a problem. Another post meslead me into thinking it needed query.
Comment #10
bfroehle commentedI've attached David's patch in #6, cleaned up slightly (removed tabs, extra whitespace, and added a docstring).
Wouldn't the existing tickets be valid?
Comment #11
metzlerd commentedYes of course...... being a ditz..... 1 is correct.
Here's a revised patch with futher cleanup, as well as an added test to make sure we don't send logout requests for tickets that haven't been validated yet. We further delete these tickets so that they aren't valid anymore.
Comment #13
metzlerd commentedForgot silly egit checkbox.
Comment #14
metzlerd commentedForgot silly egit checkbox.
Comment #16
metzlerd commentedTrying to appease the test bot gods.
For some reason test bot executes with no expired tickets.
Comment #17
bfroehle commentedI set the status to "Needs Review", but it's going to fail since $ticket->valid isn't defined.
Overall this seems to be coming together nicely. Good catches with:
1) Not calling db_delete unless $expired_tickets is non-empty.
2) Remembering to invalidate existing tickets.
Comment #18
metzlerd commentedYep.... silly coding error.
Here's another attempt (I hope the last).
Comment #19
metzlerd commentedAnd the test bot says?
Comment #20
metzlerd commentedWrong format again!
Comment #21
metzlerd commentedOne more time with feeling.
Comment #22
metzlerd commentedCommited this patch. Ready to begin the backport to drupal 6.x-3
Comment #23
bfroehle commentedQuick backport attempt. Hasn't been tested yet.
Comment #24
paulihuhtiniemi commentedAt least one small typo in latest patches, using variable $reponse, should be $response.
Comment #25
bfroehle commentedThanks for the catch. Patch for 7.x-1.x attached, revised 6.x-3.x patch to follow.
Comment #26
bfroehle commentedPatch in #25 (reponse -> response) committed to 7.x-1.x.
Revised backport to 6.x-3.x attached.
Comment #27
bircherThis looks pretty good!
I just wanted to answer on reply #3, maybe a function is not a bad idea.
I was just thinking about the possibility to have a user interface to see all the services one is logged into.
If it was a function one could log out of the different clients individually as well.
Do you think that could be interesting?
See you
Comment #28
bfroehle commentedCommitted #26 to 6.x-3.x in 226a5ec0066db72013a932a6654784a6aba0f284. Thanks.