use of org.xdi.oxauth.model.common.IntrospectionResponse in project oxAuth by GluuFederation.
the class IntrospectionWebServiceEmbeddedTest method introspection.
@Test(dependsOnMethods = "requestTokenToIntrospect")
@Parameters({ "introspectionPath" })
public void introspection(final String introspectionPath) throws Exception {
Builder request = ResteasyClientBuilder.newClient().target(url.toString() + introspectionPath).request();
request.header("Accept", "application/json");
request.header("Authorization", "Bearer " + m_authorization.getAccessToken());
Response response = request.post(Entity.form(new Form("token", m_tokenToIntrospect.getAccessToken())));
String entity = response.readEntity(String.class);
showResponse("introspection", response, entity);
assertEquals(response.getStatus(), 200);
try {
final IntrospectionResponse t = ServerUtil.createJsonMapper().readValue(entity, IntrospectionResponse.class);
assertTrue(t != null && t.isActive());
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
use of org.xdi.oxauth.model.common.IntrospectionResponse in project oxAuth by GluuFederation.
the class IntrospectionWsHttpTest method test.
@Test
@Parameters({ "umaPatClientId", "umaPatClientSecret", "umaAatClientId", "umaAatClientSecret" })
public void test(final String umaPatClientId, final String umaPatClientSecret, final String umaAatClientId, final String umaAatClientSecret) throws Exception {
final Token authorization = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);
final Token tokenToIntrospect = UmaClient.requestAat(tokenEndpoint, umaAatClientId, umaAatClientSecret);
final IntrospectionService introspectionService = ClientFactory.instance().createIntrospectionService(introspectionEndpoint);
final IntrospectionResponse introspectionResponse = introspectionService.introspectToken("Bearer " + authorization.getAccessToken(), tokenToIntrospect.getAccessToken());
Assert.assertTrue(introspectionResponse != null && introspectionResponse.isActive());
}
Aggregations