Total Complexity | 2 |
Total Lines | 19 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class HttpBearer extends HttpHeader |
||
13 | { |
||
14 | protected string $headerName = 'Authorization'; |
||
15 | protected string $pattern = '/^Bearer\s+(.*?)$/'; |
||
16 | /** |
||
17 | * @var string The HTTP authentication realm. |
||
18 | */ |
||
19 | private string $realm = 'api'; |
||
20 | |||
21 | 3 | public function challenge(ResponseInterface $response): ResponseInterface |
|
22 | { |
||
23 | 3 | return $response->withHeader('WWW-Authenticate', "{$this->headerName} realm=\"{$this->realm}\""); |
|
24 | } |
||
25 | |||
26 | 1 | public function withRealm(string $realm): self |
|
31 | } |
||
32 | } |
||
33 |