mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-11 09:18:07 +08:00
37 lines
783 B
PHP
37 lines
783 B
PHP
<?php
|
|
|
|
namespace RainLoop\SabreDAV;
|
|
|
|
class AuthDigest extends \Sabre\DAV\Auth\Backend\AbstractDigest
|
|
{
|
|
/**
|
|
* @var \RainLoop\Providers\PersonalAddressBook
|
|
*/
|
|
private $oPersonalAddressBook;
|
|
|
|
/**
|
|
* @param \RainLoop\Providers\PersonalAddressBook $oPersonalAddressBook
|
|
*/
|
|
public function __construct($oPersonalAddressBook)
|
|
{
|
|
$this->oPersonalAddressBook = $oPersonalAddressBook;
|
|
}
|
|
|
|
/**
|
|
* @param string $sRealm
|
|
* @param string $sUserName
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getDigestHash($sRealm, $sUserName)
|
|
{
|
|
$sHash = $this->oPersonalAddressBook->GetUserHashByEmail($sUserName, true);
|
|
if (!empty($sHash))
|
|
{
|
|
$this->currentUser = $sUserName;
|
|
return \md5($sUserName.':'.$sRealm.':'.$sHash);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|