An example of how to use CAS authentication in a Devise app. Forked from the original devise_cas_example app and modified as little as possible.
Set up a CAS server if you don’t already have one. JA-SIG’s official CAS server is very robust but tricky to configure unless you’re very familiar with J2EE apps. rubycas-server is possibly more familiar for Rubyists, but is less conformant with the CAS specification.
Edit config/initializers/devise.rb to set the URL of your CAS server:
config.cas_base_url = "http://your-cas-server-here"
Install the required gems:
sudo gem install warden devise sudo gem install --pre devise_cas_authenticatable
Migrate your database:
rake db:migrate
(Running rake devise:setup might work too; I haven’t tested that. I suspect it may do some weirdness because it tries to create default users, which may not work with your CAS setup.)
The example is using “rails-footnotes”:github.com/josevalim/rails-footnotes gem. If you don’t have it installed, run the following command to install the gem:
sudo gem install rails-footnotes
If you don’t want to install this gem, just comment the line in the environment.rb file.
MIT License. Copyright 2010 Nat Budin. natbudin@gmail.com Based on code that is Copyright 2009 Plataforma Tecnologia. blog.plataformatec.com.br