This file is indexed.

/usr/share/doc/php-sabre-http/examples/basicauth.php is in php-sabre-http 4.2.1-3ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php

/**
 * This example shows how to do Basic authentication.
 * *
 * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
 * @author Evert Pot (http://evertpot.com/)
 * @license http://sabre.io/license/ Modified BSD License
 */
$userList = [
    "user1" => "password",
    "user2" => "password",
];

use Sabre\HTTP\Sapi;
use Sabre\HTTP\Response;
use Sabre\HTTP\Auth;

// Find the autoloader
$paths = [
    '/usr/share/php/Sabre/HTTP/autoload.php',
    __DIR__ . '/../vendor/autoload.php',
    __DIR__ . '/../../../autoload.php',
    __DIR__ . '/vendor/autoload.php',

];

foreach ($paths as $path) {
    if (file_exists($path)) {
        include $path;
        break;
    }
}

$request = Sapi::getRequest();
$response = new Response();

$basicAuth = new Auth\Basic("Locked down area", $request, $response);
if (!$userPass = $basicAuth->getCredentials()) {

    // No username or password given
    $basicAuth->requireLogin();

} elseif (!isset($userList[$userPass[0]]) || $userList[$userPass[0]] !== $userPass[1]) {

    // Username or password are incorrect
    $basicAuth->requireLogin();
} else {

    // Success !
    $response->setBody('You are logged in!');

}

// Sending the response
Sapi::sendResponse($response);