Bearer
HTTP Bearer authentication utility.
This class helps you setup bearer auth. The process is fairly simple:
- Instantiate the class.
- Call getToken (this will return null or a token as string)
-
If you didn't get a valid token, call 'requireLogin'
-
Full name:
\Sabre\HTTP\Auth\Bearer
- Parent class:
\Sabre\HTTP\Auth\AbstractAuth
Methods
getToken
This method returns a string with an access token.
If no token was found, this method returns null.
requireLogin
This method sends the needed HTTP header and status code (401) to force authentication.
Inherited methods
__construct
Creates the object.
public __construct(string $realm, \Sabre\HTTP\RequestInterface $request, \Sabre\HTTP\ResponseInterface $response): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$realm |
string | |
$request |
\Sabre\HTTP\RequestInterface | |
$response |
\Sabre\HTTP\ResponseInterface |
requireLogin
This method sends the needed HTTP header and status code (401) to force the user to login.
- This method is abstract.
getRealm
Returns the HTTP realm.
Automatically generated on 2025-03-18