This is a template for authorizer plugins. To define a new type of authorizer, you need only inherit from
this class and define an authenticate() method. This method takes two arguments: the username and
password and returns an empty list if authentication fails, or a list of (username, fullname, email) if
authentication succeeds (fullname and email are optional).
In addition, you may override the user_in_group() method, which takes two argumetns: the username and
group. Return true if the user belongs to the group, and false otherwise.
Other methods you may wish to override include:
* authentication_hint()
* authentication_help()
* configure_form()
* reconfigure()
* credentials()
These are described below.
Methodsyouwillneedtooverride
$boolean = $plugin->authenticate($username,$password)
Return true if username and password are correct. False otherwise.
$boolean = $plugin->user_in_group($username,$groupname)
Return true if user belongs to group. False otherwise.
Methodsthatyoumaywanttocustomize
$message = $plugin->authentication_hint
Returns a message printed at the top of the login dialog, that will help the user know which
credentials he is expected to present. For example, returning "Acme Corp Single Sign-on" will present
the user with "Please log into your Acme Corp Single Sign-on".
The default behavior is to take this value from the "login hint" option in a stanza named
[AuthPlugin:plugin]. Example:
$message = $plugin->authentication_help
Returns a message printed at the bottom of the login dialog. It is expected to be used for a help
message or link that will give the user help with logging in. For example, it can take him to a link
to reset his password.
The default behavior is to take this value from the "login help" option in a stanza named
[AuthPlugin:plugin].
[AuthPlugin:plugin]
login hint = your Acme Corp Single Sign-on Account
login help = <a href="www.acme.com/passwd_help">Recover forgotten password</a>
Methodsthatyoumaywanttooverride
$html = $plugin->configure_form()
This method returns the contents of the login form. The default behavior is to produce two text
fields, one named 'name' and the other named 'password'.
$plugin->reconfigure()
This method is called to copy the values from the filled-out form into the plugin's hash of
configuration variables. If you add fields to configure_form() will you need to adjust this method as
well.
$plugin->config_defaults()
Set up defaults for the configuration hash. Use this if you wish to default to a particular username.
$plugin->credentials()
This returns a two-element list containing the username and password last entered into the
authentication dialog. It reads these values from the configuration hash returned by
$self->configuration(). If you add additional types of credentials to the login dialog, you may need
to override this method.