From 68c7e68b3f90fd980661774fdb2bb2d6140a34d0 Mon Sep 17 00:00:00 2001 From: winter Date: Mon, 16 Dec 2024 20:27:01 +0000 Subject: implement the other side of auth (hopefully?) also mostly untested for the same reason as last time --- Digitigrade/Job/ExpireInboundAuthToken.php | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Digitigrade/Job/ExpireInboundAuthToken.php (limited to 'Digitigrade/Job/ExpireInboundAuthToken.php') diff --git a/Digitigrade/Job/ExpireInboundAuthToken.php b/Digitigrade/Job/ExpireInboundAuthToken.php new file mode 100644 index 0000000..dfb5ae6 --- /dev/null +++ b/Digitigrade/Job/ExpireInboundAuthToken.php @@ -0,0 +1,34 @@ +domain = $domain; + $this->token = $token; + $this->when = $when; + $this->remainingTries = 5; + } + + public function run() { + Logger::getInstance()->info("expiring token for $this->domain"); + $instance = Instance::findByDomain($this->domain); + if ($instance->auth->inboundToken != $this->token) { + Logger::getInstance()->info("actually not expiring the token because it's been refreshed"); + return; + } + $instance->auth->inboundToken = null; + } + + public function submit() { + JobQueue::getInstance()->submitDelayedUntil($this, $this->when); + } +} \ No newline at end of file -- cgit v1.3