use of org.gluu.oxauth.model.uma.UmaScopeDescription in project oxTrust by GluuFederation.
the class UmaResourceWebServiceTest method getUmaResourceScopesTest.
@Test
public void getUmaResourceScopesTest() {
String id = "0f963ecc-93f0-49c1-beae-ad2006abbb99";
HttpUriRequest request = new HttpGet(BASE_URL + ApiConstants.BASE_API_URL + ApiConstants.UMA + ApiConstants.RESOURCES + "/" + id + ApiConstants.SCOPES);
HttpResponse response = handle(request);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
HttpEntity entity = response.getEntity();
try {
String content = EntityUtils.toString(entity);
UmaScopeDescription[] scopes = mapper.readValue(content, UmaScopeDescription[].class);
Assert.assertNotNull(scopes);
Assert.assertEquals(scopes.length, 1);
} catch (ParseException | IOException e) {
e.printStackTrace();
Assert.assertTrue(false);
}
}
use of org.gluu.oxauth.model.uma.UmaScopeDescription in project oxTrust by GluuFederation.
the class UmaScopeWebResourceTest method searchUmaScopeTest.
@Test
public void searchUmaScopeTest() {
String searchPattern = "SCIM";
String SEARCH_QUERY = "?" + ApiConstants.SEARCH_PATTERN + "=" + searchPattern + "&size=5";
HttpUriRequest request = new HttpGet(BASE_URL + ApiConstants.BASE_API_URL + ApiConstants.UMA + ApiConstants.SCOPES + ApiConstants.SEARCH + SEARCH_QUERY);
HttpResponse response = handle(request);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
HttpEntity entity = response.getEntity();
try {
String content = EntityUtils.toString(entity);
UmaScopeDescription[] scopes = mapper.readValue(content, UmaScopeDescription[].class);
Assert.assertTrue(scopes.length >= 1);
} catch (ParseException | IOException e) {
e.printStackTrace();
Assert.assertTrue(false);
}
}
use of org.gluu.oxauth.model.uma.UmaScopeDescription in project oxTrust by GluuFederation.
the class UmaScopeWebResourceTest method getUmaScopeByInumTest.
@Test
public void getUmaScopeByInumTest() {
String inum = "8CAD-B06D";
HttpUriRequest request = new HttpGet(BASE_URL + ApiConstants.BASE_API_URL + ApiConstants.UMA + ApiConstants.SCOPES + "/" + inum);
HttpResponse response = handle(request);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
HttpEntity entity = response.getEntity();
try {
String content = EntityUtils.toString(entity);
UmaScopeDescription scope = mapper.readValue(content, UmaScopeDescription.class);
Assert.assertNotNull(scope);
} catch (ParseException | IOException e) {
e.printStackTrace();
Assert.assertTrue(false);
}
}
use of org.gluu.oxauth.model.uma.UmaScopeDescription in project oxTrust by GluuFederation.
the class UmaScopeWebResourceTest method getUmaScopesTest.
@Test
public void getUmaScopesTest() {
HttpUriRequest request = new HttpGet(BASE_URL + ApiConstants.BASE_API_URL + ApiConstants.UMA + ApiConstants.SCOPES);
HttpResponse response = handle(request);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
HttpEntity entity = response.getEntity();
try {
String content = EntityUtils.toString(entity);
UmaScopeDescription[] scopes = mapper.readValue(content, UmaScopeDescription[].class);
Assert.assertTrue(scopes.length >= 1);
} catch (ParseException | IOException e) {
e.printStackTrace();
Assert.assertTrue(false);
}
}
use of org.gluu.oxauth.model.uma.UmaScopeDescription in project oxAuth by GluuFederation.
the class ScopeHttpTest method scopePresence.
@Test
@Parameters({ "umaMetaDataUrl" })
public void scopePresence(final String umaMetaDataUrl) {
final UmaMetadata metadata = UmaClientFactory.instance().createMetadataService(umaMetaDataUrl).getMetadata();
final UmaScopeService scopeService = UmaClientFactory.instance().createScopeService(metadata.getScopeEndpoint());
final UmaScopeDescription modifyScope = scopeService.getScope("modify");
UmaTestUtil.assert_(modifyScope);
}
Aggregations