use of io.jans.as.model.uma.UmaResourceWithId in project jans by JanssenProject.
the class RegisterResourceFlowHttpTest method getOneResource.
/**
* Get resource
*/
@Test(dependsOnMethods = { "modifyResource" })
public void getOneResource() throws Exception {
showTitle("getOneResource");
try {
UmaResourceWithId resource = getResourceService().getResource("Bearer " + pat.getAccessToken(), this.resourceId);
assertEquals(resource.getType(), "myType");
UmaResourceWithId resourceWithExpression = getResourceService().getResource("Bearer " + pat.getAccessToken(), this.resourceIdWithScopeExpression);
assertEquals(resourceWithExpression.getScopeExpression(), MODIFY_SCOPE_EXPRESSION);
} catch (ClientErrorException ex) {
System.err.println(ex.getResponse().readEntity(String.class));
throw ex;
}
}
use of io.jans.as.model.uma.UmaResourceWithId in project jans by JanssenProject.
the class RsModifyOperation method getResource.
private UmaResource getResource(UmaResourceService resourceService, RsModifyParams params, String resourceId) {
String pat = getUmaTokenService().getPat(params.getRpId()).getToken();
UmaResourceWithId umaResourceWithId = resourceService.getResource("Bearer " + pat, resourceId);
UmaResource umaResource = new UmaResource();
umaResource.setDescription(umaResourceWithId.getDescription());
umaResource.setIat(umaResourceWithId.getIat());
umaResource.setIconUri(umaResourceWithId.getIconUri());
umaResource.setName(umaResourceWithId.getName());
umaResource.setScopes(params.getScopes());
umaResource.setScopeExpression(null);
umaResource.setType(umaResourceWithId.getType());
if (!Strings.isNullOrEmpty(params.getScopeExpression()) && !params.getScopeExpression().equals("null")) {
umaResource.setScopeExpression(params.getScopeExpression());
umaResource.setScopes(JsonLogicNodeParser.parseNode(params.getScopeExpression().toString()).getData());
}
return umaResource;
}
Aggregations