Class | Autumn::Authentication::Hostname |
In: |
lib/autumn/authentication.rb
|
Parent: | Base |
Authenticates by the host portion of an IRC message. A hostmask is used to match the relevant portion of the address with a whitelist of accepted host addresses.
This method can be a secure way of preventing unauthorized access if you choose an appropriately narrow hostmask. However, you must configure in advance the computers you may want to administrate your leaves from.
Creates a new authenticator. You provide a hostmask via the hostmask option — either a Regexp with one capture (that captures the portion of the hostmask you are interested in), or a Proc, which takes a host as an argument and returns true if the host is authorized, false if not. If the hostmask option is not provided, a standard hostmask regexp will be used. This regexp strips everything left of the first period; for the example hostmask "wsd1.ca.widgetcom.net", it would return "ca.widgetcom.net" to be used for comparison.
You also provide an authorized host with the host option, or a list of such hosts with the hosts option. If neither is given, an exception is raised.