ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMd5PasswordEncoder Class Reference
+ Inheritance diagram for ilMd5PasswordEncoder:
+ Collaboration diagram for ilMd5PasswordEncoder:

Public Member Functions

 encodePassword (string $raw, string $salt)
 Encodes the raw password. More...
 
 isPasswordValid (string $encoded, string $raw, string $salt)
 Checks a raw password against an encoded password. More...
 
 getName ()
 Returns a unique name/id of the concrete password encoder. More...
 
- Public Member Functions inherited from ilBasePasswordEncoder
 isSupportedByRuntime ()
 Returns whether the encoder is supported by the runtime (PHP, HHVM, ...) More...
 
 requiresSalt ()
 Returns whether the encoder requires a salt. More...
 
 requiresReencoding (string $encoded)
 Returns whether the encoded password needs to be re-encoded. More...
 
 encodePassword (string $raw, string $salt)
 Encodes the raw password. More...
 
 isPasswordValid (string $encoded, string $raw, string $salt)
 Checks a raw password against an encoded password. More...
 
 getName ()
 Returns a unique name/id of the concrete password encoder. More...
 
 requiresSalt ()
 Returns whether the encoder requires a salt. More...
 
 requiresReencoding (string $encoded)
 Returns whether the encoded password needs to be re-encoded. More...
 
 isSupportedByRuntime ()
 Returns whether the encoder is supported by the runtime (PHP, HHVM, ...) More...
 

Additional Inherited Members

- Protected Member Functions inherited from ilBasePasswordEncoder
 comparePasswords (string $knownString, string $userString)
 Compares two passwords. More...
 
 isPasswordTooLong (string $password)
 

Detailed Description

Definition at line 30 of file class.ilMd5PasswordEncoder.php.

Member Function Documentation

◆ encodePassword()

ilMd5PasswordEncoder::encodePassword ( string  $raw,
string  $salt 
)

Encodes the raw password.

Parameters
string$rawThe password to encode
string$saltThe salt
Returns
string The encoded password

Implements ilPasswordEncoder.

Definition at line 32 of file class.ilMd5PasswordEncoder.php.

32 : string
33 {
34 if ($this->isPasswordTooLong($raw)) {
35 throw new ilPasswordException('Invalid password.');
36 }
37
38 return md5($raw);
39 }
Class for user password exception handling in ILIAS.

References ilBasePasswordEncoder\isPasswordTooLong().

Referenced by isPasswordValid(), and ilMd5PasswordEncoderTest\testPasswordShouldBeCorrectlyEncoded().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getName()

ilMd5PasswordEncoder::getName ( )

Returns a unique name/id of the concrete password encoder.

Implements ilPasswordEncoder.

Definition at line 46 of file class.ilMd5PasswordEncoder.php.

46 : string
47 {
48 return 'md5';
49 }

Referenced by ilMd5PasswordEncoderTest\testNameShouldBeMd5().

+ Here is the caller graph for this function:

◆ isPasswordValid()

ilMd5PasswordEncoder::isPasswordValid ( string  $encoded,
string  $raw,
string  $salt 
)

Checks a raw password against an encoded password.

The raw password has to be injected into the encoder instance before.

Parameters
string$encodedAn encoded password
string$rawA raw password
string$saltThe salt, may be empty
Returns
Boolean true if the password is valid, false otherwise

Implements ilPasswordEncoder.

Definition at line 41 of file class.ilMd5PasswordEncoder.php.

41 : bool
42 {
43 return !$this->isPasswordTooLong($raw) && $this->comparePasswords($encoded, $this->encodePassword($raw, $salt));
44 }
comparePasswords(string $knownString, string $userString)
Compares two passwords.
encodePassword(string $raw, string $salt)
Encodes the raw password.

References ilBasePasswordEncoder\comparePasswords(), encodePassword(), and ilBasePasswordEncoder\isPasswordTooLong().

Referenced by ilMd5PasswordEncoderTest\testPasswordCanBeVerified().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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