Module Picnic::Authentication::Cas
In: lib/picnic/authentication.rb

Picnic::Authentication::Cas provides basic CAS (Central Authentication System) authentication for your Camping app.

To learn more about CAS, see rubycas-client.googlecode.com and www.ja-sig.org/products/cas.

The module defines a service method that intercepts every request to check for CAS authentication. If the user has already been authenticated, the request proceeds as normal and the authenticated user‘s username is made available under <tt>@state[:cas_username]. Otherwise the request is redirected to your CAS server for authentication.

Getting Started

To activate CAS authentication for your application:

  1. Picnic-fy your Camping app (e.g: Camping.goes :your_app; YourApp.picnic!)
  2. Call YourApp.authenticate_using :cas.
  3. In your app‘s configuration YAML file add something like this:
      authentication:
         cas_base_url: https://login.example.com/cas
    

    Where the value for </tt>cas_base_url</tt> is the URL of your CAS server.

  4. That‘s it. Now whenever a user tries to access any of your controller‘s actions, the request will be checked for CAS authentication. If the user is authenticated, their username is availabe in @state[:cas_username]. Note that there is currently no way to apply CAS authentication only to certain controllers or actions. When enabled, CAS authentication applies to your entire application, except for items placed in the /public subdirectory (CSS files, JavaScripts, images, etc.). The public directory does not require CAS authentication, so anyone can access its contents.

Methods

Included Modules

Cas::Session

Classes and Modules

Module Picnic::Authentication::Cas::Session

Public Class methods

For some reason the Module#included callback is just not working for me, so I had to resort to overriding append_features(). If anyone has any ideas why, please let me know!

Public Instance methods

[Validate]