ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilMd5PasswordEncoder.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Password/classes/class.ilBasePasswordEncoder.php';
5
15{
19 public function __construct(array $config = array())
20 {
21 }
22
27 public function encodePassword($raw, $salt)
28 {
29 if ($this->isPasswordTooLong($raw)) {
30 require_once 'Services/Password/exceptions/class.ilPasswordException.php';
31 throw new ilPasswordException('Invalid password.');
32 }
33
34 return md5($raw);
35 }
36
40 public function isPasswordValid($encoded, $raw, $salt)
41 {
42 return !$this->isPasswordTooLong($raw) && $this->comparePasswords($encoded, $this->encodePassword($raw, $salt));
43 }
44
48 public function getName()
49 {
50 return 'md5';
51 }
52}
An exception for terminatinating execution or to throw for unit testing.
comparePasswords($known_string, $user_string)
Compares two passwords.
isPasswordTooLong($password)
Checks if the password is too long.
isPasswordValid($encoded, $raw, $salt)
{Checks a raw password against an encoded password.The raw password has to be injected into the encod...
encodePassword($raw, $salt)
{Encodes the raw password.string The encoded password}
getName()
{Returns a unique name/id of the concrete password encoder.string}
__construct(array $config=array())
Class for user password exception handling in ILIAS.