38 lines
715 B
PHP
38 lines
715 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace davigil\overwrites;
|
||
|
|
|
||
|
|
require_once('vendor/autoload.php');
|
||
|
|
require_once('sources/_interface.php');
|
||
|
|
require_once('overwrites/auths/none.php');
|
||
|
|
require_once('overwrites/auths/basic.php');
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
*/
|
||
|
|
function make_auth_backend(
|
||
|
|
\davigil\sources\interface_source $source,
|
||
|
|
array $descriptor
|
||
|
|
) : \Sabre\DAV\Auth\Backend\BackendInterface
|
||
|
|
{
|
||
|
|
switch ($descriptor['kind'])
|
||
|
|
{
|
||
|
|
case 'none':
|
||
|
|
{
|
||
|
|
return (new \davigil\overwrites\class_auth_backend_none());
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
case 'basic':
|
||
|
|
{
|
||
|
|
return (new \davigil\overwrites\class_auth_backend_basic($source));
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
default:
|
||
|
|
{
|
||
|
|
throw (new \Exception(\sprintf('unhandled auth backend kind: %s', $descriptor['kind'])));
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
?>
|