Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (26 sloc) 895 Bytes
<?php
namespace Jane\OpenApi\Tests\Expected\Authentication;
class BearerAuthentication implements \Jane\OpenApiRuntime\Client\Authentication
{
private $token;
public function __construct(string $token)
{
$this->{'token'} = $token;
}
public function getPlugin() : \Http\Client\Common\Plugin
{
return new \Http\Client\Common\Plugin\AuthenticationPlugin(new class($this->{'token'}) implements \Http\Message\Authentication
{
private $token;
public function __construct(string $token)
{
$this->{'token'} = $token;
}
public function authenticate(\Psr\Http\Message\RequestInterface $request)
{
$header = sprintf('Bearer %s', $this->{'token'});
return $request->withHeader('Authorization', $header);
}
});
}
}
You can’t perform that action at this time.