Zeta Components Manual :: Docs For Class ezcAuthenticationHtpasswdFilter
Authentication::ezcAuthenticationHtpasswdFilter
Class ezcAuthenticationHtpasswdFilter
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:
- $credentials = new ezcAuthenticationPasswordCredentials( 'jan.modaal', 'b1b3773a05c0ed0176787a4f1574ff0075f7521e' );
- // add other filters if needed
- {
- // authentication did not succeed, so inform the user
- $status = $authentication->getStatus();
- $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/filters/htpasswd/htpasswd_filter.php
ezcAuthenticationFilter | --ezcAuthenticationHtpasswdFilter
Version: | //autogen// |
Constants
STATUS_PASSWORD_INCORRECT
= 2
|
Password is incorrect. |
STATUS_USERNAME_INCORRECT
= 1
|
Username is not found in the htpasswd file. |
Inherited Constants
From ezcAuthenticationFilter: | |
---|---|
ezcAuthenticationFilter::STATUS_OK
|
Successful authentication. |
Properties
string | read/write |
$file
The path and file name of the htpasswd file to use. |
Inherited Member Variables
From ezcAuthenticationFilter | |
---|---|
protected |
ezcAuthenticationFilter::$options
|
Method Summary
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. |
Inherited Methods
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. |
Methods
__construct
ezcAuthenticationHtpasswdFilter
__construct(
string
$file
, [ezcAuthenticationHtpasswdOptions
$options
= null] )
Creates a new object of this class.
Parameters:
Name | Type | Description |
---|---|---|
$file |
string | The path and file name of the htpasswd file to use |
$options |
ezcAuthenticationHtpasswdOptions | Options for this class |
Exceptions:
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 |
run
int
run(
ezcAuthenticationPasswordCredentials
$credentials
)
Runs the filter and returns a status code when finished.
Parameters:
Name | Type | Description |
---|---|---|
$credentials |
ezcAuthenticationPasswordCredentials | Authentication credentials |
Redefinition of:
Method | Description |
---|---|
ezcAuthenticationFilter::run() |
Runs the filter and returns a status code when finished. |
Documentation generated by phpDocumentor 1.4.3