From f83a838b8093341bfd209f433b9799da835c2567 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 29 May 2025 11:42:22 -0600 Subject: feat: start to stub out the metadata endpoint --- bin/test | 18 ++++++++++++++++++ public/metadata.json | 2 ++ src/main.rs | 3 +++ 3 files changed, 23 insertions(+) create mode 100644 public/metadata.json diff --git a/bin/test b/bin/test index 12dde30..9d67fc7 100755 --- a/bin/test +++ b/bin/test @@ -33,5 +33,23 @@ class ServerTest < Minitest::Test response = client.get(base_url + "/404") assert_equal "404", response.code end + + # /.well-known/oauth-authorization-server https://datatracker.ietf.org/doc/html/rfc8414#section-3.1 + def test_metadata + response = client.get(base_url + "/.well-known/oauth-authorization-server") + assert_equal "200", response.code + end + + # /token - Token endpoint https://datatracker.ietf.org/doc/html/rfc8693#section-2.3 + def test_token + end + + # /introspect - Token introspection https://datatracker.ietf.org/doc/html/rfc7662#section-2 + def test_introspect + end + + # /revoke - Token revocation # https://datatracker.ietf.org/doc/html/rfc7009#section-2.1 + def test_revoke + end end diff --git a/public/metadata.json b/public/metadata.json new file mode 100644 index 0000000..2c63c08 --- /dev/null +++ b/public/metadata.json @@ -0,0 +1,2 @@ +{ +} diff --git a/src/main.rs b/src/main.rs index ee71aac..993d72b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,9 @@ fn handle(mut stream: TcpStream) { let (status_line, filename) = match &request_line[..] { "GET / HTTP/1.1" => ("HTTP/1.1 200 OK", "./public/index.html"), + "GET /.well-known/oauth-authorization-server HTTP/1.1" => { + ("HTTP/1.1 200 OK", "./public/metadata.json") + } _ => ("HTTP/1.1 404 NOT FOUND", "./public/404.html"), }; -- cgit v1.2.3