snappymail/rainloop/v/0.0.0/app/libraries/RainLoop/SabreDAV/AuthDigest.php

38 lines
783 B
PHP
Raw Normal View History

2013-12-20 07:28:03 +08:00
<?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;
}
}