ApplicationController


			
class ApplicationController < ActionController::Base

  # Include the library needed for authentication functionality.
  include AuthenticationSystem

  def local_request?
    false
  end

module


			
module AuthenticationSystem

  class NotAuthorized < RuntimeError; end

  def self.included(base)
    base.class_eval do
      rescue_from AuthenticationSystem::NotAuthorized, :with => :not_authorized
    end
  end

  def not_authorized(exception)
    respond_to do |format|
    ...