google-code-export / rubycas-client

Automatically exported from code.google.com/p/rubycas-client
1 stars 1 forks source link

logout_url(controller) should allow overriding of service parameter #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When logging out of the web application, the logout action is called on the
Home controller. In this action, we call logout_url(self) to obtain the CAS
logout url to redirect to.

The difficulty is that after CAS logs the user out, the service is set to
myhost/home/logout. This results in the user returning to the logout action
should they log back into CAS. (e.g. to switch users on a shared machine)

Is it at all possible to support a second parameter that allows the action
on the current controller to be specified?

Original issue reported on code.google.com by ruby...@gmail.com on 24 Aug 2007 at 11:45

GoogleCodeExporter commented 9 years ago
Our strategy has been do something like this in our logout action:

def logout
  CAS::Filter.service_url = request.referer
  redirect_to CAS::Filter.logout_url(self)
end

This way the CAS server gets the URL of the referring URL. However, looking at 
it
now, I think this is actually really wrong! Setting the class variable 
service_url
will set it for the whole class and lead to unpredictable results (in fact I 
think i
just discovered the source of a long-lived bug in one of our applications that 
use
rubycas-client :)

So, to fix this I've added a second parameter to logout_url() that lets you 
override
the service. You should now be able to define your logout action as:

def logout
  redirect_to CAS::Filter.logout_url(self, request.referer)
end

(This fix is in svn trunk rev 97)

Original comment by matt.zuk...@gmail.com on 19 Sep 2007 at 5:05