ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AbstractBearer.php
Go to the documentation of this file.
1<?php
2
4
5use Sabre\DAV;
6use Sabre\HTTP;
9
23abstract class AbstractBearer implements BackendInterface {
24
33 protected $realm = 'sabre/dav';
34
44 abstract protected function validateBearerToken($bearerToken);
45
52 function setRealm($realm) {
53
54 $this->realm = $realm;
55
56 }
57
87
89 $this->realm,
92 );
93
94 $bearerToken = $auth->getToken($request);
95 if (!$bearerToken) {
96 return [false, "No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured"];
97 }
98 $principalUrl = $this->validateBearerToken($bearerToken);
99 if (!$principalUrl) {
100 return [false, "Bearer token was incorrect"];
101 }
102 return [true, $principalUrl];
103
104 }
105
128
130 $this->realm,
131 $request,
133 );
134 $auth->requireLogin();
135
136 }
137
138}
foreach($paths as $path) $request
Definition: asyncclient.php:32
An exception for terminatinating execution or to throw for unit testing.
HTTP Bearer authentication backend class.
setRealm($realm)
Sets the authentication realm for this backend.
validateBearerToken($bearerToken)
Validates a Bearer token.
check(RequestInterface $request, ResponseInterface $response)
When this method is called, the backend must check if authentication was successful.
challenge(RequestInterface $request, ResponseInterface $response)
This method is called when a user could not be authenticated, and authentication was required for the...
HTTP Bearer authentication utility.
Definition: Bearer.php:18
$auth
Definition: fileserver.php:48
This is the base class for any authentication object.
The RequestInterface represents a HTTP request.
This interface represents a HTTP response.
$response