}
}
for (RoleMappingRepresentation mapping : rep.getRoleMappings())
{
RoleMapping roleMapping = createRoleMapping(userMap, mapping);
User user = userMap.get(mapping.getUsername());
identityManager.create(realm, user, roleMapping);
}
for (ScopeMappingRepresentation scope : rep.getScopeMappings())
{
ScopeMapping scopeMapping = createScopeMapping(userMap, scope);
User user = userMap.get(scope.getUsername());
identityManager.create(realm, user, scopeMapping);
}
if (rep.getResources() != null)
{
for (ResourceRepresentation resourceRep : rep.getResources())
{
Resource resource = new Resource();
resource.setName(resourceRep.getName());
resource.setSurrogateAuthRequired(resourceRep.isSurrogateAuthRequired());
resource = identityManager.create(realm, resource);
if (resourceRep.getRoles() != null)
{
for (String role : resourceRep.getRoles())
{
Role r = identityManager.create(realm, resource, role);
}
}
if (resourceRep.getRoleMappings() != null)
{
for (RoleMappingRepresentation mapping : resourceRep.getRoleMappings())
{
RoleMapping roleMapping = createRoleMapping(userMap, mapping);
User user = userMap.get(mapping.getUsername());
identityManager.create(realm, resource, user, roleMapping);
}
}
if (resourceRep.getScopeMappings() != null)