[英]How to get user's plain password in PDO class of Sabre DAV?
How can I get hold of the current logged-in user's plaintext password in the following file of Sabre DAV library?如何在 Sabre DAV 库的以下文件中获取当前登录用户的明文密码?
https://github.com/sabre-io/dav/tree/master/lib/CardDAV/Backend
in Baikal, this file is at:
\baikal\vendor\sabre\dav\lib\CardDAV\Backend\PDO.php
<?php
declare(strict_types=1);
namespace Sabre\CardDAV\Backend;
use Sabre\CardDAV;
use Sabre\DAV;
use Sabre\DAV\PropPatch;
/**
* PDO CardDAV backend.
*
* This CardDAV backend uses PDO to store addressbooks
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class PDO extends AbstractBackend implements SyncSupport
...
...
}
For Basic Authentication, the file is this:对于基本身份验证,文件是这样的:
\baikal\Core\Frameworks\Baikal\Core\PDOBasicAuth.php \baikal\Core\Frameworks\Baikal\Core\PDOBasicAuth.php
plain password is at the validateUserPass function and it can be stored at a global var (or in the session as mentioned in the comments of the question):普通密码位于 validateUserPass function 中,它可以存储在全局变量中(或问题评论中提到的 session 中):
function validateUserPass($username, $password) {
global $ptp;
$stmt = $this->pdo->prepare('SELECT username, digesta1 FROM ' . $this->tableName . ' WHERE username = ?');
$stmt->execute([$username]);
$result = $stmt->fetchAll();
if (!count($result)) {
return false;
}
$hash = md5($username . ':' . $this->authRealm . ':' . $password);
if ($result[0]['digesta1'] === $hash) {
$this->currentUser = $username;
$ptp = $password;
return true;
}
return false;
}
}
Then, at the \baikal\vendor\sabre\dav\lib\CardDAV\Backend\PDO.php file, the value of the $ptp var can be retrieved using global $ptp;
然后,在 \baikal\vendor\sabre\dav\lib\CardDAV\Backend\PDO.php 文件中,可以使用global $ptp;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.