Filter to authenticate against an Unix htpasswd file.
It supports files created with the htpasswd command options -m (MD5 encryption - different than the PHP md5() function) -d (CRYPT encryption) -s (SHA encryption) -p (plain text)
The encryption used for the password field in the file will be detected automatically.
The password property can be specified as plain text or in encrypted form, depending on the option 'plain' in the ezcAuthenticationHtpasswdOptions object used as options.
Example:
Source for this file: /Authentication/src/filters/htpasswd/htpasswd_filter.php
ezcAuthenticationFilter | --ezcAuthenticationHtpasswdFilter
Version: | //autogen// |
STATUS_PASSWORD_INCORRECT
= 2
|
Password is incorrect. |
STATUS_USERNAME_INCORRECT
= 1
|
Username is not found in the htpasswd file. |
From ezcAuthenticationFilter: | |
---|---|
ezcAuthenticationFilter::STATUS_OK
|
Successful authentication. |
string | read/write |
$file
The path and file name of the htpasswd file to use. |
From ezcAuthenticationFilter | |
---|---|
protected |
ezcAuthenticationFilter::$options
|
public ezcAuthenticationHtpasswdFilter |
__construct(
$file
, [ $options
= null] )
Creates a new object of this class. |
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 |
---|---|---|
$file |
string | The path and file name of the htpasswd file to use |
$options |
ezcAuthenticationHtpasswdOptions | Options for this class |
Type | Description |
---|---|
ezcBaseValueException |
if the value provided is not correct for the property $file |
ezcBaseFileNotFoundException |
if $file does not exist |
ezcBaseFilePermissionException |
if $file cannot be opened for reading |
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. |