Skip to content
This repository

A thin rails plugin on top of Warden for Authentication

branch: master
README.textile

Rails Warden

Provides authentication for Rails applications via the Warden Rack authentication framework.

Require the gem:

config/environment.rb


  config.gem "rails_warden"

Setup an initializer:

config/initializers/warden.rb


  Rails.configuration.middleware.use RailsWarden::Manager do |manager|
    manager.default_strategies :my_strategy
    manager.failure_app = LoginController
  end

  # Setup Session Serialization
  class Warden::SessionSerializer
    def serialize(record)
      [record.class.name, record.id]
    end

    def deserialize(keys)
      klass, id = keys
      klass.find(:first, :conditions => { :id => id })
    end
  end

  # Declare your strategies here
  #Warden::Strategies.add(:my_strategy) do
  #  def authenticate!
  #    # do stuff
  #  end
  #end
  
Something went wrong with that request. Please try again.