Principal userPrincipal = (Principal) session.getAttribute(GeneralConstants.PRINCIPAL_ID);
List<String> roles = (List<String>) session.getAttribute(GeneralConstants.ROLES_ID);
if(roles == null)
{
RoleGenerator rg = (RoleGenerator) request.getOptions().get(GeneralConstants.ROLE_GENERATOR);
roles = rg.generateRoles(userPrincipal);
session.setAttribute(GeneralConstants.ROLES_ID, roles);
}
response.setRoles(roles);
}