初始化仓库
This commit is contained in:
23
vendor/qcloud/cos-sdk-v5/src/SignatureMiddleware.php
vendored
Normal file
23
vendor/qcloud/cos-sdk-v5/src/SignatureMiddleware.php
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Qcloud\Cos;
|
||||
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
class SignatureMiddleware {
|
||||
private $nextHandler;
|
||||
protected $signature;
|
||||
|
||||
/**
|
||||
* @param callable $nextHandler Next handler to invoke.
|
||||
*/
|
||||
public function __construct(callable $nextHandler, $accessKey, $secretKey, $options) {
|
||||
$this->nextHandler = $nextHandler;
|
||||
$this->signature = new Signature($accessKey, $secretKey, $options);
|
||||
}
|
||||
|
||||
public function __invoke(RequestInterface $request, array $options) {
|
||||
$fn = $this->nextHandler;
|
||||
return $fn($this->signature->signRequest($request), $options);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user