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/HttpResponseStatus/Forbidden.php | 21 +++++++++++++++++++++ Digitigrade/HttpResponseStatus/Unauthorized.php | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Digitigrade/HttpResponseStatus/Forbidden.php create mode 100644 Digitigrade/HttpResponseStatus/Unauthorized.php (limited to 'Digitigrade/HttpResponseStatus') diff --git a/Digitigrade/HttpResponseStatus/Forbidden.php b/Digitigrade/HttpResponseStatus/Forbidden.php new file mode 100644 index 0000000..4c3588f --- /dev/null +++ b/Digitigrade/HttpResponseStatus/Forbidden.php @@ -0,0 +1,21 @@ +message = $reason ?? 'The provided authorization is invalid for this request'; + } + + public function httpCode(): int { + return 403; + } + + public function httpReason(): string { + return "Forbidden"; + } + + public function httpHeaders() { + } +} \ No newline at end of file diff --git a/Digitigrade/HttpResponseStatus/Unauthorized.php b/Digitigrade/HttpResponseStatus/Unauthorized.php new file mode 100644 index 0000000..ab8b080 --- /dev/null +++ b/Digitigrade/HttpResponseStatus/Unauthorized.php @@ -0,0 +1,21 @@ +message = $reason ?? 'This request requires authorization'; + } + + public function httpCode(): int { + return 401; + } + + public function httpReason(): string { + return "Unauthorized"; + } + + public function httpHeaders() { + } +} \ No newline at end of file -- cgit v1.3