Thursday, 1 April 2010

RubyCAS Logout action

Here's a quick snippet for the CAS logout action. It logs the user out of the CAS-server and redirects them to the root_url of your application.

  def cas_logout
    @cas_current_user = @extra_attributes = nil
    CASClient::Frameworks::Rails::Filter.logout(self, root_url) and return

This is one article in a series on Rails single-sign-on with rubyCAS


Maurizio said...

Hi, i'cant get the redirect after logout to work :( ..

Is it possible that redirection has to be configured in rubycas server too?

Taryn said...

The code given is correct according to the docs:

The second parameter (called "service") is where the user will be redirected to after logout.

Perhaps make sure that you have passed a fully-qualified url instead of just a relative path?