public void onSuccess(DMRResponse dmrResponse) {
ModelNode response = dmrResponse.get();
ModelNode overalResult = response.get(RESULT);
SecurityContext context = new SecurityContext(nameToken, requiredResources);
context.setFacet(Facet.valueOf(accessControlReg.getFacet(nameToken).toUpperCase()));
try {
// retrieve access constraints for each required resource and update the security context
for(int i=1; i<=steps.size();i++)
{
String step = "step-"+i;
if(overalResult.hasDefined(step))
{
String resourceAddress = step2address.get(step);
ModelNode modelNode = overalResult.get(step).get(RESULT);
ModelNode payload = null;
if(modelNode.getType() == ModelType.LIST)
payload = modelNode.asList().get(0);
else
payload = modelNode;
// break down into root resource and children
parseAccessControlChildren(resourceAddress, requiredResources, context, payload);
}
}
context.seal(); // makes it immutable
contextMapping.put(nameToken, context);
Log.info("Context creation time (" + nameToken + "): " + (System.currentTimeMillis() - start) + "ms");