wordpress-seo
/
vendor_prefixed
/
league
/
oauth2-client
/
src
/
Tool
/
BearerAuthorizationTrait.php
BearerAuthorizationTrait.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.8, at vendor_prefixed/league/oauth2-client/src/Tool/BearerAuthorizationTrait.php
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is part of the league/oauth2-client library |
| 5 | * |
| 6 | * For the full copyright and license information, please view the LICENSE |
| 7 | * file that was distributed with this source code. |
| 8 | * |
| 9 | * @copyright Copyright (c) Alex Bilbie <[email protected]> |
| 10 | * @license http://opensource.org/licenses/MIT MIT |
| 11 | * @link http://thephpleague.com/oauth2-client/ Documentation |
| 12 | * @link https://packagist.org/packages/league/oauth2-client Packagist |
| 13 | * @link https://github.com/thephpleague/oauth2-client GitHub |
| 14 | */ |
| 15 | namespace YoastSEO_Vendor\League\OAuth2\Client\Tool; |
| 16 | |
| 17 | use YoastSEO_Vendor\League\OAuth2\Client\Token\AccessTokenInterface; |
| 18 | /** |
| 19 | * Enables `Bearer` header authorization for providers. |
| 20 | * |
| 21 | * @link http://tools.ietf.org/html/rfc6750 Bearer Token Usage (RFC 6750) |
| 22 | */ |
| 23 | trait BearerAuthorizationTrait |
| 24 | { |
| 25 | /** |
| 26 | * Returns authorization headers for the 'bearer' grant. |
| 27 | * |
| 28 | * @param AccessTokenInterface|string|null $token Either a string or an access token instance |
| 29 | * @return array |
| 30 | */ |
| 31 | protected function getAuthorizationHeaders($token = null) |
| 32 | { |
| 33 | return ['Authorization' => 'Bearer ' . $token]; |
| 34 | } |
| 35 | } |
| 36 |