ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMd5PasswordEncoder Class Reference
+ Inheritance diagram for ilMd5PasswordEncoder:
+ Collaboration diagram for ilMd5PasswordEncoder:

Public Member Functions

 __construct (array $config=array())
 
 encodePassword ($raw, $salt)
 {Encodes the raw password.
Parameters
string$rawThe password to encode
string$saltThe salt
Returns
string The encoded password
} More...
 
 isPasswordValid ($encoded, $raw, $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
Returns
Boolean true if the password is valid, false otherwise
} More...
 
 getName ()
 {Returns a unique name/id of the concrete password encoder.
Returns
string
} More...
 
- Public Member Functions inherited from ilBasePasswordEncoder
 isSupportedByRuntime ()
 {Returns whether or not the encoder is supported by the runtime (PHP, HHVM, ...)
Returns
boolean
} More...
 
 requiresSalt ()
 {Returns whether or not the encoder requires a salt.
Returns
boolean
} More...
 
 requiresReencoding ($encoded)
 {Returns whether or not the a encoded password needs to be re-encoded.
Parameters
$encodedstring
Returns
boolean
} More...
 
 encodePassword ($raw, $salt)
 Encodes the raw password. More...
 
 isPasswordValid ($encoded, $raw, $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 or not the encoder requires a salt. More...
 
 requiresReencoding ($encoded)
 Returns whether or not the a encoded password needs to be re-encoded. More...
 
 isSupportedByRuntime ()
 Returns whether or not the encoder is supported by the runtime (PHP, HHVM, ...) More...
 

Additional Inherited Members

- Data Fields inherited from ilBasePasswordEncoder
const MAX_PASSWORD_LENGTH = 4096
 
- Protected Member Functions inherited from ilBasePasswordEncoder
 comparePasswords ($known_string, $user_string)
 Compares two passwords. More...
 
 isPasswordTooLong ($password)
 Checks if the password is too long. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilMd5PasswordEncoder::__construct ( array  $config = array())
Parameters
array$config

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

20 {
21 }

Member Function Documentation

◆ encodePassword()

ilMd5PasswordEncoder::encodePassword (   $raw,
  $salt 
)

{Encodes the raw password.

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

Exceptions
ilPasswordException

Implements ilPasswordEncoder.

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

28 {
29 if($this->isPasswordTooLong($raw))
30 {
31 require_once 'Services/Password/exceptions/class.ilPasswordException.php';
32 throw new ilPasswordException('Invalid password.');
33 }
34
35 return md5($raw);
36 }
isPasswordTooLong($password)
Checks if the password is too long.
Class for user password exception handling in ILIAS.

References ilBasePasswordEncoder\isPasswordTooLong().

Referenced by isPasswordValid(), ilMd5PasswordEncoderTest\testExceptionIsRaisedIfThePasswordExceedsTheSupportedLengthOnEncoding(), 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.

Returns
string
}

Implements ilPasswordEncoder.

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

50 {
51 return 'md5';
52 }

Referenced by ilMd5PasswordEncoderTest\testNameShouldBeMd5().

+ Here is the caller graph for this function:

◆ isPasswordValid()

ilMd5PasswordEncoder::isPasswordValid (   $encoded,
  $raw,
  $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
Returns
Boolean true if the password is valid, false otherwise
}

Implements ilPasswordEncoder.

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

42 {
43 return !$this->isPasswordTooLong($raw) && $this->comparePasswords($encoded, $this->encodePassword($raw, $salt));
44 }
comparePasswords($known_string, $user_string)
Compares two passwords.
encodePassword($raw, $salt)
{Encodes the raw password.string The encoded password}

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

Referenced by ilMd5PasswordEncoderTest\testPasswordCanBeVerified(), and ilMd5PasswordEncoderTest\testPasswordVerificationShouldFailIfTheRawPasswordExceedsTheSupportedLength().

+ 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: