|
| 1 | +<?php |
| 2 | + /* |
| 3 | + IMPORTANT WARNING! |
| 4 | +
|
| 5 | + This class is a user backend that accepts 'all'. |
| 6 | + Any user, and password is currently accepted as true. |
| 7 | + |
| 8 | + The reason this is here is that Solid clients will use basic |
| 9 | + authentication to do a POST request to the token endpoint, |
| 10 | + where the actual authorization happens. |
| 11 | +
|
| 12 | + The security for this user backend lies in the fact that it |
| 13 | + is only activated for the token endpoint in the Solid app. |
| 14 | +
|
| 15 | + In /lib/AppInfo/Application.php there is a check for the |
| 16 | + token endpoint before this thing activates. |
| 17 | + |
| 18 | + It is completely unsuitable as an actual user backend in the |
| 19 | + normal sense of the word. |
| 20 | + |
| 21 | + It is here to allow the token requests with basic |
| 22 | + authentication requests to pass to us. |
| 23 | + */ |
| 24 | + |
| 25 | + namespace OCA\Solid; |
| 26 | + |
| 27 | + use OCP\User\Backend\ABackend; |
| 28 | + use OCP\User\Backend\ICheckPasswordBackend; |
| 29 | + |
| 30 | + /** |
| 31 | + * @package OCA\Solid |
| 32 | + */ |
| 33 | + class ClientAuth extends ABackend implements ICheckPasswordBackend { |
| 34 | + public function __construct() { |
| 35 | + } |
| 36 | + |
| 37 | + public function checkPassword(string $username, string $password) { |
| 38 | + return true; |
| 39 | + } |
| 40 | + |
| 41 | + public function getBackendName() { |
| 42 | + return "Solid"; |
| 43 | + } |
| 44 | + public function deleteUser($uid) { |
| 45 | + return false; |
| 46 | + } |
| 47 | + public function getUsers($search = "", $limit = null, $offset = null, $callback = null) { |
| 48 | + return []; |
| 49 | + } |
| 50 | + public function userExists($uid) { |
| 51 | + return true; |
| 52 | + } |
| 53 | + public function getDisplayName($uid) { |
| 54 | + return "Solid client"; |
| 55 | + } |
| 56 | + public function getDisplayNames($search = "", $limit = null, $offset = null) { |
| 57 | + return []; |
| 58 | + } |
| 59 | + public function hasUserListings() { |
| 60 | + return false; |
| 61 | + } |
| 62 | + } |
0 commit comments