ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Bearer.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\HTTP\Auth;
4 
18 class Bearer extends AbstractAuth {
19 
27  function getToken() {
28 
29  $auth = $this->request->getHeader('Authorization');
30 
31  if (!$auth) {
32  return null;
33  }
34 
35  if (strtolower(substr($auth, 0, 7)) !== 'bearer ') {
36  return null;
37  }
38 
39  return substr($auth, 7);
40 
41  }
42 
49  function requireLogin() {
50 
51  $this->response->addHeader('WWW-Authenticate', 'Bearer realm="' . $this->realm . '"');
52  $this->response->setStatus(401);
53 
54  }
55 
56 }
HTTP Bearer authentication utility.
Definition: Bearer.php:18
$auth
Definition: fileserver.php:48
requireLogin()
This method sends the needed HTTP header and statuscode (401) to force authentication.
Definition: Bearer.php:49
getToken()
This method returns a string with an access token.
Definition: Bearer.php:27
HTTP Authentication base class.