From 2f4c1de3509141880df019ef1a6cc65981b3f6ea Mon Sep 17 00:00:00 2001 From: winter Date: Sat, 14 Dec 2024 21:24:48 +0000 Subject: implement outbound auth? untested untested because i don't have another instance to test it against .... --- routes/auth.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 routes/auth.php (limited to 'routes') diff --git a/routes/auth.php b/routes/auth.php new file mode 100644 index 0000000..b44d76a --- /dev/null +++ b/routes/auth.php @@ -0,0 +1,22 @@ +mount('/auth/dialback', function (array $args) { + // just respond to the dialback challenge! + if (!isset($_POST['origin'], $_POST['secret'])) { + throw new BadRequest('send the `origin` and `secret` parameters as POST data please :3'); + } + $instance = Instance::findByDomain($_POST['origin']); + if ($instance == null) { + throw new BadRequest("i can't seem to find your instance information!"); + } + if (!isset($instance->endpoints->auth)) { + throw new BadRequest("you don't seem to have an auth endpoint"); + } + + (new RequestOutboundAuthToken($instance->domain, $_POST['secret']))->submit(); +}); \ No newline at end of file -- cgit v1.3