Apache Zeta Components Manual :: Docs For Class ezcAuthentication
Authentication::ezcAuthentication
Class ezcAuthentication
Container for authentication filters.
This is the main class of the authentication component. Filters are added to an object of this class, which will run the filters in sequence. At the end of this process, the status property will contain the statuses of the filters, and the developer can use those statuses to display to the user messages such as "Password incorrect".
The session property is optional and it is used to store the authentication information between requests.
The credentials property will be passed to all the filters in the queue.
Example (using the Htpasswd filter):
- $credentials = new ezcAuthenticationPasswordCredentials( 'jan.modaal', 'b1b3773a05c0ed0176787a4f1574ff0075f7521e' );
- // add other filters if needed
- {
- // authentication did not succeed, so inform the user
- $err = array(
- 'ezcAuthenticationHtpasswdFilter' => array(
- )
- );
- foreach ( $status as $line )
- {
- echo $err[$key][$value] . "\n";
- }
- }
- else
- {
- // authentication succeeded, so allow the user to see his content
- }
Source for this file: /Authentication/src/authentication.php
Version: | //autogen// |
Properties
ezcAuthenticationCredentials | read/write |
$credentials
The user credentials to pass to the authentication filters. |
ezcAuthenticationSession | read/write |
$session
The session object to use during authentication to store the authentication information between requests. |
ezcAuthenticationStatus | read/write |
$status
The status object which holds the status of the run filters. |
Member Variables
protected array(ezcAuthenticationFilter) |
$filters
= array()
The filter queue of the authentication process. |
protected ezcAuthenticationOptions |
$options
Options for the Authentication object. |
Method Summary
public ezcAuthentication |
__construct(
$credentials
, [ $options
= null] )
Creates a new object of this class. |
public void |
addFilter(
$filter
, [ $stop
= false] )
Adds an authentication filter at the end of the filter list. |
public ezcAuthenticationOptions |
getOptions(
)
Returns the options of this class. |
public array(string=>mixed) |
getStatus(
)
Returns the status of authentication. |
public bool |
run(
)
Runs through all the filters in the filter list. |
public void |
setOptions(
$options
)
Sets the options of this class to $options. |
Methods
__construct
Creates a new object of this class.
Parameters:
Name | Type | Description |
---|---|---|
$credentials |
ezcAuthenticationCredentials | Authentication credentials |
$options |
ezcAuthenticationOptions | Options for this class |
addFilter
Adds an authentication filter at the end of the filter list.
By specifying the second parameter as true, the authentication process (triggered by calling the run() method) will stop after processing this filter regardless of its success.
Parameters:
Name | Type | Description |
---|---|---|
$filter |
ezcAuthenticationFilter | The authentication filter to add |
$stop |
bool | If authentication should continue past this filter |
getOptions
Returns the options of this class.
getStatus
Returns the status of authentication.
The format of the returned array is array( array( class => code ) ).
Example:
- array(
- array( 'ezcAuthenticationDatabaseFilter' => ezcAuthenticationDatabaseFilter::STATUS_PASSWORD_INCORRECT )
- );
run
Runs through all the filters in the filter list.
setOptions
Sets the options of this class to $options.
Parameters:
Name | Type | Description |
---|---|---|
$options |
ezcAuthenticationOptions | Options for this class |