From a255f9818c4fab5c2e1c3e9ded61d37991b2cebb Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 17 Mar 2025 21:38:32 -0600 Subject: feat: add a token introspection endpoint --- test/e2e_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/e2e_test.go b/test/e2e_test.go index c88f5fc..40ed943 100644 --- a/test/e2e_test.go +++ b/test/e2e_test.go @@ -277,6 +277,19 @@ func TestAuthx(t *testing.T) { project := x.Must(serde.FromJSON[map[string]string](response.Body)) assert.Equal(t, "foo", project["name"]) }) + + t.Run("token can be introspected", func(t *testing.T) { + client := conf.Client(ctx, credentials) + + io := bytes.NewBuffer(nil) + assert.NoError(t, serde.ToJSON(io, map[string]string{"token": credentials.AccessToken})) + response := x.Must(client.Post("http://idp.example.com:8080/oauth/introspect", "application/json", io)) + require.Equal(t, http.StatusOK, response.StatusCode) + + claims := x.Must(serde.FromJSON[map[string]interface{}](response.Body)) + assert.Equal(t, true, claims["active"]) + assert.Equal(t, "gid://example/Authn::User/1", claims["sub"]) + }) }) }) } -- cgit v1.2.3