use of org.gluu.oxauth.model.uma.RptIntrospectionResponse in project oxAuth by GluuFederation.
the class UmaSpontaneousScopeHttpTest method rptStatus.
@Test(dependsOnMethods = { "successfulRptRequest" })
@Parameters()
public void rptStatus() {
showTitle("rptStatus");
final RptIntrospectionResponse status = this.rptStatusService.requestRptStatus("Bearer " + pat.getAccessToken(), rpt, "");
assert_(status);
// at the end scope registered by permission must be present in RPT permission with scope allowed by spontaneous scope check
assertTrue(status.getPermissions().get(0).getScopes().contains(USER_2_SCOPE));
}
use of org.gluu.oxauth.model.uma.RptIntrospectionResponse in project oxAuth by GluuFederation.
the class TTokenRequest method requestRptStatus.
public RptIntrospectionResponse requestRptStatus(String p_umaRptStatusPath, final String rpt) {
final Holder<RptIntrospectionResponse> h = new Holder<RptIntrospectionResponse>();
try {
Builder request = ResteasyClientBuilder.newClient().target(baseUri.toString() + p_umaRptStatusPath).request();
request.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
// todo uma2
// request.header("Authorization", "Bearer " + p_aat.getAccessToken());
Response response = request.post(Entity.form(new Form("token", rpt)));
String entity = response.readEntity(String.class);
// try {
// final String json =
// ServerUtil.createJsonMapper().writeValueAsString(rpt);
// request.setContent(Util.getBytes(json));
// request.setContentType(UmaConstants.JSON_MEDIA_TYPE);
// } catch (IOException e) {
// e.printStackTrace();
// fail();
// }
BaseTest.showResponse("UMA : TTokenRequest.requestRptStatus() : ", response, entity);
assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(), "Unexpected response code.");
try {
final RptIntrospectionResponse result = ServerUtil.createJsonMapper().readValue(entity, RptIntrospectionResponse.class);
Assert.assertNotNull(result);
h.setT(result);
} catch (IOException e) {
e.printStackTrace();
fail();
}
} catch (Exception e) {
e.printStackTrace();
fail();
}
return h.getT();
}
Aggregations