-
-
Save prophile/477652 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("auth.php"); | |
class NoCredentialsAuth extends AuthBackend | |
{ | |
private $authed = false; | |
private $user; | |
private function __construct() | |
{ | |
$config = Configuration::getInstance(); | |
$this->user = $config->getConfig("user.default"); | |
} | |
public function getCurrentUser() | |
{ | |
if ($this->authed) | |
{ | |
return null; | |
} | |
else | |
{ | |
return $this->user; | |
} | |
} | |
public function authUser($authtoken) | |
{ | |
if (isset($authtoken["user"]) && isset($authtoken["password"])) | |
{ | |
$this->authed = true; | |
return 1; | |
} | |
else | |
{ | |
return 0; | |
} | |
} | |
public function getNextAuthToken() | |
{ | |
return 1; | |
} | |
public function deauthUser($authtoken) | |
{ | |
if ($authtoken != 1) | |
{ | |
throw new Exception("invalid deauth token", 0x34); | |
} | |
$this->authed = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment