12.3. AuthGeneric Previous topic Parent topic Child topic Next topic

This is a generic authentication module superclass. It implements behaviour that will be required in most authentication modules, and therefore most modules should inherit from it. Most simple authentication can be handled merely by overriding the findUser() method, which is expected to find and return a User object given a user name. The AuthGeneric::handle_request handles all the cascading of DEFAULT users, checking of check items, assembling replies etc. All you have to do is find the user in your database and return it in findUser().
AuthGeneric only responds to Access-Request messages. Accounting-Requests are accepted but ignored (i.e. it does nothing with them). If you want to do something with accounting messages (other than what Realm.pm does, such as logging to the accounting log file or wtmp file), you will probably want to override handle_request, pass Access-Request messages to $self->SUPER::handle_request(), and process Accounting- Request messages yourself.
If your handler needs to fork so it can do a “slow” authentication or accounting task, you can call AuthGeneric::handlerFork, which will arrange for the handler to fork(2), and also arrange for the child to exit after handling is complete.
AuthGeneric has a number of other methods that you can override for specific functions like:
  • log($p, $s) Logs a message that originated in that class. $p is a message priority (see Log.pm). $s is a message. The base class behaviour is to log to the all the logging systems configured into Radiator by calling main::log($p, $s).