MediaWiki  1.28.0
ParameterizedPassword Class Reference

Helper class for password hash types that have a delimited set of parameters inside of the hash. More...

Inheritance diagram for ParameterizedPassword:
Collaboration diagram for ParameterizedPassword:

Public Member Functions

 needsUpdate ()
 
 toString ()
 
- Public Member Functions inherited from Password
 __construct (PasswordFactory $factory, array $config, $hash=null)
 Construct the Password object using a string hash. More...
 
 crypt ($password)
 Hash a password and store the result in this object. More...
 
 equals ($other)
 Compare one Password object to this object. More...
 
 getType ()
 Get the type name of the password. More...
 
 needsUpdate ()
 Determine if the hash needs to be updated. More...
 
 toString ()
 Convert this hash to a string that can be stored in the database. More...
 

Protected Member Functions

 getDefaultParams ()
 Return an ordered array of default parameters for this password hash. More...
 
 getDelimiter ()
 Returns the delimiter for the parameters inside the hash. More...
 
 parseHash ($hash)
 
- Protected Member Functions inherited from Password
 parseHash ($hash)
 Perform any parsing necessary on the hash to see if the hash is valid and/or to perform logic for seeing if the hash needs updating. More...
 

Protected Attributes

array $args = []
 Extra arguments that were found in the hash. More...
 
array $params = []
 Named parameters that have default values for this password type. More...
 
- Protected Attributes inherited from Password
array $config
 Array of configuration variables injected from the constructor. More...
 
PasswordFactory $factory
 Factory that created the object. More...
 
string $hash
 String representation of the hash without the type. More...
 

Detailed Description

Helper class for password hash types that have a delimited set of parameters inside of the hash.

All passwords are in the form of :<TYPE>:... as explained in the main Password class. This class is for hashes in the form of :<TYPE>:<PARAM1>:<PARAM2>:... where <PARAM1>, <PARAM2>, etc. are parameters that determine how the password was hashed. Of course, the internal delimiter (which is : by convention and default), can be changed by overriding the ParameterizedPassword::getDelimiter() function.

This class requires overriding an additional function: ParameterizedPassword::getDefaultParams(). See the function description for more details on the implementation.

Since
1.24

Definition at line 38 of file ParameterizedPassword.php.

Member Function Documentation

ParameterizedPassword::getDefaultParams ( )
abstractprotected

Return an ordered array of default parameters for this password hash.

The keys should be the parameter names and the values should be the default values. Additionally, the order of the array should be the order in which they appear in the hash.

When parsing a password hash, the constructor will split the hash based on the delimiter, and consume as many parts as it can, matching each to a parameter in this list. Once all the parameters have been filled, all remaining parts will be considered extra arguments, except, of course, for the very last part, which is the hash itself.

Returns
array

Referenced by needsUpdate(), and parseHash().

ParameterizedPassword::getDelimiter ( )
abstractprotected

Returns the delimiter for the parameters inside the hash.

Returns
string

Referenced by parseHash(), LayeredParameterizedPassword\partialCrypt(), and toString().

ParameterizedPassword::needsUpdate ( )

Definition at line 81 of file ParameterizedPassword.php.

References getDefaultParams().

ParameterizedPassword::parseHash (   $hash)
protected

Definition at line 52 of file ParameterizedPassword.php.

References Password\$hash, getDefaultParams(), and getDelimiter().

ParameterizedPassword::toString ( )

Definition at line 85 of file ParameterizedPassword.php.

References Password\$hash, and getDelimiter().

Member Data Documentation

array ParameterizedPassword::$args = []
protected

Extra arguments that were found in the hash.

This may or may not make the hash invalid.

Definition at line 50 of file ParameterizedPassword.php.

Referenced by LayeredParameterizedPassword\crypt(), and LayeredParameterizedPassword\partialCrypt().

array ParameterizedPassword::$params = []
protected

Named parameters that have default values for this password type.

Definition at line 43 of file ParameterizedPassword.php.

Referenced by LayeredParameterizedPassword\crypt(), LayeredParameterizedPassword\getDefaultParams(), and LayeredParameterizedPassword\partialCrypt().


The documentation for this class was generated from the following file: