Module: AuthlogicRadius::Session::Config

Defined in:
lib/authlogic_radius/session.rb

Instance Method Summary collapse

Instance Method Details

#auto_register(value = nil) ⇒ Object Also known as: auto_register=

Set to indicate whether users should be created here upon successful authentication

  • Defaults: true

  • Accepts: Boolean



62
63
64
# File 'lib/authlogic_radius/session.rb', line 62

def auto_register(value=nil)
  rw_config(:auto_register,value, true)
end

#auto_register_domain(value = nil) ⇒ Object Also known as: auto_register_domain=

The domain part added to the login to generate an email address

  • Defaults: nil

  • Accepts: String



70
71
72
# File 'lib/authlogic_radius/session.rb', line 70

def auto_register_domain(value=nil)
  rw_config(:auto_register_domain, value)
end

#auto_register_method(value = nil) ⇒ Object Also known as: auto_register_method=

Defines a method to call when a user is auto registered. This is intended to allow for custom user configuration (i.e. adding roles, etc).

  • Default: :configure_new_radius_user

  • Accepts: Symbol



80
81
82
# File 'lib/authlogic_radius/session.rb', line 80

def auto_register_method(value=nil)
  rw_config(:auto_register_method, value, :configure_new_radius_user)
end

#find_by_radius_login_method(value = nil) ⇒ Object Also known as: find_by_radius_login_method=

Once RADIUS authentication has succeeded we need to find the user in the database. By default this just calls the find_by_radius_login method provided by ActiveRecord. If you have a more advanced set up and need to find users differently specify your own method and define your logic in there.

For example, if you allow users to store multiple radius logins with their account, you might do something like:

class User < ActiveRecord::Base
  def self.()
    first(:conditions => ["#{RadiusLogin.table_name}.login = ?", ], :join => :radius_logins)
  end
end
  • Default: :find_by_radius_login

  • Accepts: Symbol



99
100
101
# File 'lib/authlogic_radius/session.rb', line 99

def (value = nil)
  rw_config(:find_by_radius_login_method, value, :find_by_radius_login)
end

#radius_host(value = nil) ⇒ Object Also known as: radius_host=

The host of your RADIUS server.

  • Default: nil

  • Accepts: String



19
20
21
# File 'lib/authlogic_radius/session.rb', line 19

def radius_host(value = nil)
  rw_config(:radius_host, value)
end

#radius_login_field(value = nil) ⇒ Object Also known as: radius_login_field=

Which database field should be used to store the radius login

  • Defaults: :radius_login

  • Accepts: Symbol



54
55
56
# File 'lib/authlogic_radius/session.rb', line 54

def (value=nil)
  rw_config(:radius_login_field, value, :radius_login)
end

#radius_port(value = nil) ⇒ Object Also known as: radius_port=

The port of your RADIUS server.

  • Default: 18121

  • Accepts: Fixnum, integer



28
29
30
# File 'lib/authlogic_radius/session.rb', line 28

def radius_port(value = nil)
  rw_config(:radius_port, value, 1812)
end

#radius_shared_secret(value = nil) ⇒ Object Also known as: radius_shared_secret=

The shared secret issued by your RADIUS server

  • Default: nil

  • Accepts: String



37
38
39
# File 'lib/authlogic_radius/session.rb', line 37

def radius_shared_secret(value = nil)
  rw_config(:radius_shared_secret, value)
end

#radius_timeout(value = 2) ⇒ Object Also known as: radius_timeout=

How long to wait for a response from the RADIUS server

  • Default: 2 seconds

  • Accepts: Fixnum, integer



46
47
48
# File 'lib/authlogic_radius/session.rb', line 46

def radius_timeout(value = 2)
  rw_config(:radius_timeout, value)
end