diff options
| author | mo khan <mo@mokhan.ca> | 2025-03-17 21:38:32 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-03-17 21:38:32 -0600 |
| commit | a255f9818c4fab5c2e1c3e9ded61d37991b2cebb (patch) | |
| tree | 91fb5be83ec57fdddb6515d69de01fec36f078ea /test | |
| parent | 66edae4510b51570e6e4a21ef38dfc7defb63982 (diff) | |
feat: add a token introspection endpoint
Diffstat (limited to 'test')
| -rw-r--r-- | test/e2e_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
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"]) + }) }) }) } |
