Filter to authenticate against a database.
The database instance to use is specified using a ezcAuthenticationDatabaseInfo structure. Table name and field names are specified in the same structure.
Example:
Extra data can be fetched from the database during the authentication process, by registering the data to be fetched before calling run(). Example:
The $data array will be something like:
Source for this file: /AuthenticationDatabaseTiein/src/filters/database/database_filter.php
ezcAuthenticationFilter | --ezcAuthenticationDatabaseFilter
Version: | //autogentag// |
STATUS_PASSWORD_INCORRECT
= 2
|
Password is incorrect. |
STATUS_USERNAME_INCORRECT
= 1
|
Username is not found in the database. |
From ezcAuthenticationFilter: | |
---|---|
ezcAuthenticationFilter::STATUS_OK
|
Successful authentication. |
ezcAuthenticationDatabaseInfo | read/write |
$database
Structure which holds a database instance, table name and fields which are used for authentication. |
protected array(string=>mixed) |
$data
= array()
Holds the extra data fetched during the authentication process. Usually it has this structure:
|
protected array(string) |
$requestedData
= array()
Holds the attributes which will be requested during the authentication process. Usually it has this structure:
|
From ezcAuthenticationFilter | |
---|---|
protected |
ezcAuthenticationFilter::$options
|
public ezcAuthenticationDatabaseFilter |
__construct(
$database
, [ $options
= null] )
Creates a new object of this class. |
public array(string=>mixed) |
fetchData(
)
Returns the extra data which was fetched during the authentication process. |
public void |
registerFetchData(
[ $data
= array()] )
Registers the extra data which will be fetched by the filter during the authentication process. |
public int |
run(
$credentials
)
Runs the filter and returns a status code when finished. |
From ezcAuthenticationFilter | |
---|---|
public ezcAuthenticationFilterOptions |
ezcAuthenticationFilter::getOptions()
Returns the options of this class. |
public abstract int |
ezcAuthenticationFilter::run()
Runs the filter and returns a status code when finished. |
public void |
ezcAuthenticationFilter::setOptions()
Sets the options of this class to $options. |
Creates a new object of this class.
Name | Type | Description |
---|---|---|
$database |
ezcAuthenticationDatabaseInfo | Database to use in authentication |
$options |
ezcAuthenticationDatabaseOptions | Options for this class |
Returns the extra data which was fetched during the authentication process.
Example of returned array:
Registers the extra data which will be fetched by the filter during the authentication process.
The input $data should be an array of attributes, for example:
Name | Type | Description |
---|---|---|
$data |
array(string) | The extra data to fetch during authentication |
Runs the filter and returns a status code when finished.
Name | Type | Description |
---|---|---|
$credentials |
ezcAuthenticationPasswordCredentials | Authentication credentials |
Method | Description |
---|---|
ezcAuthenticationFilter::run() |
Runs the filter and returns a status code when finished. |