20 lines
341 B
PHP
20 lines
341 B
PHP
<?php
|
|
|
|
namespace lib\Core\Http;
|
|
|
|
class BearerToken extends Http
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
public function token(): ?string
|
|
{
|
|
$header = $this->getHeader('Authorization');
|
|
if ($header && str_starts_with($header, 'Bearer ')) {
|
|
return substr($header, 7);
|
|
}
|
|
return null;
|
|
}
|
|
}
|