Extension of the Authlogic library to add RADIUS support
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION
authlogic_radius.gemspec

README.rdoc

Authlogic RADIUS

This is a simple gem to allow authentication against a radius server

Mostly it is a duplication of authlogic_ldap, with a global replace of “ldap” with “radius”… with a few RADIUS specific bits.

This version is tested only with ruby 2.0 and Rail 3 and 4

Links

Installation

1. Add fields to your database

class AddRadiusFields < ActiveRecord::Migration
  def self.up
    add_column :users, :radius_login, :string
    add_index :users, :radius_login

    change_column :users, :login, :string, :default => nil, :null => true
    change_column :users, :crypted_password, :string, :default => nil, :null => true
    change_column :users, :password_salt, :string, :default => nil, :null => true
  end

  def self.down
    remove_column :users, :radius_login

    [:login, :crypted_password, :password_salt].each do |field|
      User.all(:conditions => "#{field} is NULL").each { |user| user.update_attribute(field, "") if user.send(field).nil? }
      change_column :users, field, :string, :default => "", :null => false
    end
  end
end

2. Install authlogic_radius gem

 Add the gem to your environment's list of gems
     config.gem "authlogic_radius"
$ sudo rake gems:install

3. Update your views to use :radius_login and :radius_password

4. Add/update configuration in your UserSession model with the RADIUS details

class UserSession < Authlogic::Session::Base
  ...
  self.radius_host = "your.radius.server"
  self.radius_shared_secret = 'super-secret' #not the same as the user password...
  #optionally
  self.radius_port = 1812
  self.radius_timeout = 2
  self.auto_register = true
  self.auto_register_domain = nil #will create user objects with :email = radius_login@auto_register_domain
  self.auto_register_method = :method_in_user_model_that_configures_new_radius_user
  ...
end