mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-05 06:23:53 +09:00
changes
This commit is contained in:
44
vendor/php-http/message/src/Authentication/BasicAuth.php
vendored
Normal file
44
vendor/php-http/message/src/Authentication/BasicAuth.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Message\Authentication;
|
||||
|
||||
use Http\Message\Authentication;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
* Authenticate a PSR-7 Request using Basic Auth.
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*/
|
||||
final class BasicAuth implements Authentication
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $password;
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
*/
|
||||
public function __construct($username, $password)
|
||||
{
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authenticate(RequestInterface $request)
|
||||
{
|
||||
$header = sprintf('Basic %s', base64_encode(sprintf('%s:%s', $this->username, $this->password)));
|
||||
|
||||
return $request->withHeader('Authorization', $header);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user