diff --git a/lib/Conf.php b/lib/Conf.php index 5decf1d7..6a8115c9 100644 --- a/lib/Conf.php +++ b/lib/Conf.php @@ -25,7 +25,6 @@ class Conf { public $dbMySQLAutoUpd = false; public $userDriver = User\Internal\Driver::class; - public $userAuthPreferHTTP = false; public $userComposeNames = true; public $userTempPasswordLength = 20; diff --git a/lib/Feed.php b/lib/Feed.php index 3c48f545..8c1e9a98 100644 --- a/lib/Feed.php +++ b/lib/Feed.php @@ -266,7 +266,7 @@ class Feed { // if there are no tentatively new articles and/or the number of stored articles is less than the size of the feed, don't do a second pass; assume any tentatively new items are in fact new $new = $tentative; } - // FIXME: fetch full content when appropriate + // TODO: fetch full content when appropriate foreach($new as $index) { $this->newItems[] = $items[$index]; } diff --git a/lib/User.php b/lib/User.php index 26cb7639..dd2f7a6a 100644 --- a/lib/User.php +++ b/lib/User.php @@ -87,20 +87,6 @@ class User { } public function credentials(): array { - if(Data::$conf->userAuthPreferHTTP) { - return $this->credentialsHTTP(); - } else { - return $this->credentialsForm(); - } - } - - public function credentialsForm(): array { - // FIXME: stub - $this->id = "john.doe@example.com"; - return ["user" => "john.doe@example.com", "password" => "secret"]; - } - - public function credentialsHTTP(): array { if($_SERVER['PHP_AUTH_USER']) { $out = ["user" => $_SERVER['PHP_AUTH_USER'], "password" => $_SERVER['PHP_AUTH_PW']]; } else if($_SERVER['REMOTE_USER']) { @@ -117,8 +103,7 @@ class User { public function auth(string $user = null, string $password = null): bool { if($user===null) { - if(Data::$conf->userAuthPreferHTTP) return $this->authHTTP(); - return $this->authForm(); + return $this->authHTTP(); } else { $this->id = $user; $this->actor = []; @@ -135,17 +120,10 @@ class User { } } - public function authForm(): bool { - $cred = $this->credentialsForm(); - if(!$cred["user"]) return $this->challengeForm(); - if(!$this->auth($cred["user"], $cred["password"])) return $this->challengeForm(); - return true; - } - public function authHTTP(): bool { - $cred = $this->credentialsHTTP(); - if(!$cred["user"]) return $this->challengeHTTP(); - if(!$this->auth($cred["user"], $cred["password"])) return $this->challengeHTTP(); + $cred = $this->credentials(); + if(!$cred["user"]) return false; + if(!$this->auth($cred["user"], $cred["password"])) return false; return true; } @@ -358,11 +336,6 @@ class User { } } - // FIXME: stubs - public function challenge(): bool {throw new User\Exception("authFailed");} - public function challengeForm(): bool {throw new User\Exception("authFailed");} - public function challengeHTTP(): bool {throw new User\Exception("authFailed");} - protected function composeName(string $user): string { if(preg_match("/.+?@[^@]+$/",$user)) { return $user; diff --git a/tests/User/TestAuthorization.php b/tests/User/TestAuthorization.php index c7a68568..7ababbbe 100644 --- a/tests/User/TestAuthorization.php +++ b/tests/User/TestAuthorization.php @@ -50,7 +50,6 @@ class TestAuthorization extends \PHPUnit\Framework\TestCase { $this->clearData(); $conf = new Conf(); $conf->userDriver = $drv; - $conf->userAuthPreferHTTP = true; $conf->userComposeNames = true; Data::$conf = $conf; if($db !== null) { diff --git a/tests/lib/User/CommonTests.php b/tests/lib/User/CommonTests.php index 48275445..c7d66970 100644 --- a/tests/lib/User/CommonTests.php +++ b/tests/lib/User/CommonTests.php @@ -13,7 +13,6 @@ trait CommonTests { $this->clearData(); $conf = new Conf(); $conf->userDriver = $this->drv; - $conf->userAuthPreferHTTP = true; Data::$conf = $conf; Data::$db = new Database(); Data::$user = Phake::PartialMock(User::class); diff --git a/tests/test.php b/tests/test.php index bf0018af..3fffe213 100644 --- a/tests/test.php +++ b/tests/test.php @@ -10,7 +10,6 @@ $_SERVER['PHP_AUTH_USER'] = $user; $_SERVER['PHP_AUTH_PW'] = $pass; $conf = new Conf(); $conf->dbSQLite3File = ":memory:"; -$conf->userAuthPreferHTTP = true; Data::load($conf); Data::$db->schemaUpdate();