Базовая версия сервера авторизации по протоколу OAuth2
This commit is contained in:
66
app/Components/MD5Hasher.php
Normal file
66
app/Components/MD5Hasher.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Components;
|
||||
|
||||
use Illuminate\Contracts\Hashing\Hasher;
|
||||
use Illuminate\Hashing\HashManager;
|
||||
|
||||
/**
|
||||
* Description of Md5Hasher
|
||||
*
|
||||
* @author Andrey Pokidov <pokidov@e-traffic.ru>
|
||||
*/
|
||||
class MD5Hasher extends HashManager
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(app());
|
||||
}
|
||||
/**
|
||||
* Get information about the given hashed value.
|
||||
*
|
||||
* @param string $hashedValue
|
||||
* @return array
|
||||
*/
|
||||
public function info($hashedValue)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash the given value.
|
||||
*
|
||||
* @param string $value
|
||||
* @param array $options
|
||||
* @return string
|
||||
*/
|
||||
public function make($value, array $options = [])
|
||||
{
|
||||
return md5($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the given plain value against a hash.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $hashedValue
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
public function check($value, $hashedValue, array $options = [])
|
||||
{
|
||||
return strtolower(md5($value)) == strtolower($hashedValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given hash has been hashed using the given options.
|
||||
*
|
||||
* @param string $hashedValue
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
public function needsRehash($hashedValue, array $options = [])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user