needInfo = Util.createJsonMapper().readValue(entity, UmaNeedInfoResponse.class); assert_(needInfo); return;
/** * RP requests RPT with ticket and gets needs_info error (not all claims are provided, so redirect to claims-gathering endpoint) */ @Test(dependsOnMethods = {"rsRegisterPermissions"}) @Parameters({"umaPatClientId", "umaPatClientSecret"}) public void requestRptAndGetNeedsInfo(String umaPatClientId, String umaPatClientSecret) throws Exception { showTitle("requestRptAndGetNeedsInfo"); try { tokenService.requestRpt( "Basic " + encodeCredentials(umaPatClientId, umaPatClientSecret), GrantType.OXAUTH_UMA_TICKET.getValue(), permissionFlowTest.ticket, null, null, null, null, null); } catch (ClientResponseFailure ex) { // expected need_info error : // sample: {"error":"need_info","ticket":"c024311b-f451-41db-95aa-cd405f16eed4","required_claims":[{"issuer":["https://localhost:8443"],"name":"country","claim_token_format":["http://openid.net/specs/openid-connect-core-1_0.html#IDToken"],"claim_type":"string","friendly_name":"country"},{"issuer":["https://localhost:8443"],"name":"city","claim_token_format":["http://openid.net/specs/openid-connect-core-1_0.html#IDToken"],"claim_type":"string","friendly_name":"city"}],"redirect_user":"https://localhost:8443/restv1/uma/gather_claimsgathering_id=sampleClaimsGathering&&?gathering_id=sampleClaimsGathering&&"} String entity = (String) ex.getResponse().getEntity(String.class); System.out.println(entity); assertEquals(ex.getResponse().getStatus(), Response.Status.FORBIDDEN.getStatusCode(), "Unexpected response status"); needInfo = Util.createJsonMapper().readValue(entity, UmaNeedInfoResponse.class); assert_(needInfo); return; } throw new AssertionError("need_info error was not returned"); }