MediaWiki
REL1_24
|
Factory class for creating and checking Password objects. More...
Public Member Functions | |
getTypes () | |
Get the list of types of passwords. | |
init (Config $config) | |
Initialize the internal static variables using the global variables. | |
needsUpdate (Password $password) | |
Determine whether a password object needs updating. | |
newFromCiphertext ($hash) | |
Create a new Hash object from an existing string hash. | |
newFromPlaintext ($password, Password $existing=null) | |
Create a new Hash object from a plaintext password. | |
newFromType ($type) | |
Make a new default password of the given type. | |
register ($type, array $config) | |
Register a new type of password hash. | |
setDefaultType ($type) | |
Set the default password type. | |
Private Attributes | |
string | $default = '' |
The default PasswordHash type. | |
array | $types |
Mapping of password types to classes. |
Factory class for creating and checking Password objects.
Definition at line 28 of file PasswordFactory.php.
Get the list of types of passwords.
Definition at line 87 of file PasswordFactory.php.
PasswordFactory::init | ( | Config $ | config | ) |
Initialize the internal static variables using the global variables.
Config | $config | Configuration object to load data from |
Definition at line 74 of file PasswordFactory.php.
PasswordFactory::needsUpdate | ( | Password $ | password | ) |
Determine whether a password object needs updating.
Check whether the given password is of the default type. If it is, pass off further needsUpdate checks to Password::needsUpdate.
Password | $password |
Definition at line 169 of file PasswordFactory.php.
PasswordFactory::newFromCiphertext | ( | $ | hash | ) |
Create a new Hash object from an existing string hash.
Parse the type of a hash and create a new hash object based on the parsed type. Pass the raw hash to the constructor of the new object. Use InvalidPassword type if a null hash is given.
string | null | $hash | Existing hash or null for an invalid password |
PasswordError | If hash is invalid or type is not recognized |
Definition at line 102 of file PasswordFactory.php.
PasswordFactory::newFromPlaintext | ( | $ | password, |
Password $ | existing = null |
||
) |
Create a new Hash object from a plaintext password.
If no existing object is given, make a new default object. If one is given, clone that object. Then pass the plaintext to Password::crypt().
string | $password | Plaintext password |
Password | null | $existing | Optional existing hash to get options from |
Definition at line 146 of file PasswordFactory.php.
PasswordFactory::newFromType | ( | $ | type | ) |
Make a new default password of the given type.
string | $type | Existing type |
PasswordError | If hash is invalid or type is not recognized |
Definition at line 126 of file PasswordFactory.php.
PasswordFactory::register | ( | $ | type, |
array $ | config | ||
) |
Register a new type of password hash.
string | $type | Unique type name for the hash |
array | $config | Array of configuration options |
Definition at line 51 of file PasswordFactory.php.
PasswordFactory::setDefaultType | ( | $ | type | ) |
Set the default password type.
InvalidArgumentException | If the type is not registered |
string | $type | Password hash type |
Definition at line 62 of file PasswordFactory.php.
string PasswordFactory::$default = '' [private] |
The default PasswordHash type.
Definition at line 34 of file PasswordFactory.php.
array PasswordFactory::$types [private] |
Mapping of password types to classes.
Definition at line 41 of file PasswordFactory.php.