public
Description: Casablanca is a ruby client for the CAS 2.0 protocol.
Homepage:
Clone URL: git://github.com/p8/casablanca.git
name age message
file .gitignore Sun May 24 23:33:09 -0700 2009 Improved gitignore [p8]
file History.txt Sat Feb 21 03:22:49 -0800 2009 Removed Hoe dependency from gemspec [p8]
file Manifest.txt Wed Feb 18 14:47:28 -0800 2009 Fixed gatewaying [p8]
file README.txt Fri Feb 20 01:50:42 -0800 2009 Improved doc [p8]
file Rakefile Mon Feb 16 00:21:39 -0800 2009 Added my name [p8]
directory bin/ Thu Jan 22 11:52:29 -0800 2009 Added logger. Changing rails client. Started im... [p8]
file casablanca.gemspec Sat Feb 21 03:22:49 -0800 2009 Removed Hoe dependency from gemspec [p8]
file init.rb Sun Jan 25 07:14:59 -0800 2009 Started adding proxy callback controller [p8]
directory lib/ Sat Feb 28 05:10:12 -0800 2009 Started implementing proxy_callback in client [p8]
directory test/ Sat Feb 28 05:10:12 -0800 2009 Started implementing proxy_callback in client [p8]
README.txt
= Casablanca

* http://rubyforge.org/projects/casablanca/

== DESCRIPTION:

Casablanca is a ruby single sign-on client for the CAS 2.0 protocol.

== FEATURES:

* Includes a commandline Client to test getting service tickets from a CAS server
* It can be run as a Rails plugin
* Supports gatewaying and renewing

== TODO:

* Implement proxying
* Check for single signout

== SYNOPSIS:

=== Commandline:

  % casablanca

In IRB:

  require 'casablanca'

  C = Casablanca::CommandLineClient.new({ :cas_server_url => "http://localhost:4567",
                                        :service_url => "http://localhost:3000" })

  ticket = C.get_service_ticket('admin', 'admin')
  C.authenticate_ticket(ticket)


=== Rails:
Configure your Cas server url in environment.rb:

  Casablanca::Rails::Config.config do |config|
     config[:cas_server_url]  = "http://localhost:4567"
  end
  

Add filters to the protected controllers.
For most cases you would want the default filter:

  before_filter Casablanca::Rails::Filter
  
If you want users without credentials to view the page as well use the Gateway filter

  before_filter Casablanca::Rails::GatewayFilter
  
If you want users to always require new credentials for authentication use the renew filter

  before_filter Casablanca::Rails::RenewFilter  

Add something like the following to application.rb to get the current user from the Cas session:
  
  def current_user
    if session[:cas_user] && @user.nil?
        @user = User.find_by_name(session[:cas_user])
        logout_killing_session! unless @user
    end
    @user
  end

Your logout action could look like:

  def logout
    Casablanca::Rails::Filter.logout(self)
    redirect_to Casablanca::RailsFilter.logout_url(self)
  end
  
  
== REQUIREMENTS:

== INSTALL:

Stable version
* sudo gem install casablanca
Development version
* gem sources -a http://gems.github.com; sudo gem install p8-casablanca

== LICENSE:

(The MIT License)

Copyright (c) 2009 Petrik de Heus

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.