Rack::Webauth

Rack middleware to acquire authentication information from a Stanford WebAuth system.

Usage in any rack based app:


  # In a rack environment:
  use(Rack::Webauth)

  # In a view or controller:
  include(Rack::Webauth::Helpers)

  # In a before filter or helper
  # or other middleware:
  @current_user = User.(webauth.)

  # or whatever...

Usage in rails:


  # config/application.rb:
    require 'rack-webauth'
    config.middleware.use(Rack::Webauth)

  # ApplicationController:
    include(Rack::Webauth::Helpers)
    # optionally:
    delegate :logged_in?, :to => :webauth

WebAuthOptional

If you want to make your site publicly available, but still enable WebAuth and have that information in your Rails application, you need a patch to WebAuth. It is available from here. Also see the corresponding thread for more information.