| 111 | } |
| 112 | |
| 113 | func IntrospectToken(t testing.TB, token string, adminTS *httptest.Server) gjson.Result { |
| 114 | require.NotEmpty(t, token) |
| 115 | |
| 116 | req := httpx.MustNewRequest("POST", adminTS.URL+"/admin/oauth2/introspect", |
| 117 | strings.NewReader((url.Values{"token": {token}}).Encode()), |
| 118 | "application/x-www-form-urlencoded") |
| 119 | |
| 120 | res, err := adminTS.Client().Do(req) |
| 121 | require.NoError(t, err) |
| 122 | defer res.Body.Close() //nolint:errcheck |
| 123 | body, err := io.ReadAll(res.Body) |
| 124 | require.NoError(t, err) |
| 125 | require.Equalf(t, http.StatusOK, res.StatusCode, "Response body: %s", body) |
| 126 | return gjson.ParseBytes(body) |
| 127 | } |
| 128 | |
| 129 | func RevokeToken(t testing.TB, conf *oauth2.Config, token string, publicTS *httptest.Server) gjson.Result { |
| 130 | require.NotEmpty(t, token) |