87 $server->
on(
'beforeMethod', [$this,
'beforeMethod'], 10);
132 if ($this->currentPrincipal) {
150 $authResult = $this->
check($request, $response);
152 if ($authResult[0]) {
154 $this->currentPrincipal = $authResult[1];
155 $this->loginFailedReasons = null;
163 $this->currentPrincipal = null;
164 $this->loginFailedReasons = $authResult[1];
166 if ($this->autoRequireLogin) {
193 if (!$this->backends) {
194 throw new \Sabre\DAV\Exception(
'No authentication backends were configured on this server.');
197 foreach ($this->backends as $backend) {
205 throw new \Sabre\DAV\Exception(
'The authentication backend did not return a correct value from the check() method.');
209 $this->currentPrincipal =
$result[1];
217 return [
false, $reasons];
234 foreach ($this->backends as $backend) {
235 $backend->challenge($request, $response);
279 'description' =>
'Generic authentication plugin',
280 'link' =>
'http://sabre.io/dav/authentication/',
check(RequestInterface $request, ResponseInterface $response)
Checks authentication credentials, and logs the user in if possible.
This interface represents a HTTP response.
$backends
authentication backends
The RequestInterface represents a HTTP request.
getPluginName()
Returns a plugin name.
The baseclass for all server plugins.
on($eventName, callable $callBack, $priority=100)
Subscribe to an event.
This plugin provides Authentication for a WebDAV server.
foreach($paths as $path) $request
__construct(Backend\BackendInterface $authBackend=null)
Creates the authentication plugin.
initialize(Server $server)
Initializes the plugin.
challenge(RequestInterface $request, ResponseInterface $response)
This method sends authentication challenges to the user.
addBackend(Backend\BackendInterface $authBackend)
Adds an authentication backend to the plugin.
$autoRequireLogin
By default this plugin will require that the user is authenticated, and refuse any access if the user...
getLoginFailedReasons()
Returns a list of reasons why login was unsuccessful.
getCurrentPrincipal()
Returns the currently logged-in principal.
getPluginInfo()
Returns a bunch of meta-data about the plugin.
beforeMethod(RequestInterface $request, ResponseInterface $response)
This method is called before any HTTP method and forces users to be authenticated.