ILIAS  release_7 Revision v7.30-3-g800a261c036
ilMd5PasswordEncoder Class Reference
+ Inheritance diagram for ilMd5PasswordEncoder:
+ Collaboration diagram for ilMd5PasswordEncoder:

Public Member Functions

 encodePassword (string $raw, string $salt)
 @inheritDoc More...
 
 isPasswordValid (string $encoded, string $raw, string $salt)
 @inheritDoc More...
 
 getName ()
 @inheritDoc More...
 
- Public Member Functions inherited from ilBasePasswordEncoder
 isSupportedByRuntime ()
 @inheritDoc More...
 
 requiresSalt ()
 @inheritDoc More...
 
 requiresReencoding (string $encoded)
 @inheritDoc 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 or not the encoder requires a salt. More...
 
 requiresReencoding (string $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 (string $knownString, string $userString)
 Compares two passwords. More...
 
 isPasswordTooLong (string $password)
 Checks if the password is too long. More...
 

Detailed Description

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

Member Function Documentation

◆ encodePassword()

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

@inheritDoc

Exceptions
ilPasswordException

Implements ilPasswordEncoder.

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

21 : string
22 {
23 if ($this->isPasswordTooLong($raw)) {
24 throw new ilPasswordException('Invalid password.');
25 }
26
27 return md5($raw);
28 }
isPasswordTooLong(string $password)
Checks if the password is too long.
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 ( )

@inheritDoc

Implements ilPasswordEncoder.

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

42 : string
43 {
44 return 'md5';
45 }

Referenced by ilMd5PasswordEncoderTest\testNameShouldBeMd5().

+ Here is the caller graph for this function:

◆ isPasswordValid()

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

@inheritDoc

Exceptions
ilPasswordException

Implements ilPasswordEncoder.

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

34 : bool
35 {
36 return !$this->isPasswordTooLong($raw) && $this->comparePasswords($encoded, $this->encodePassword($raw, $salt));
37 }
comparePasswords(string $knownString, string $userString)
Compares two passwords.
encodePassword(string $raw, string $salt)
@inheritDoc

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: