code: private void populateFedoraAttributes(Subject subject,
                                            Set<String> userRoles,
                                            HttpServletRequest request) {
          Map<String, Set<String>> attributes =
                  SubjectUtils.getAttributes(subject);
  
          // get the fedoraRole attribute or create it.
          Set<String> roles = attributes.get(FEDORA_ROLE_KEY);
          if (roles == null) {
              roles = new HashSet<String>(userRoles);
              attributes.put(FEDORA_ROLE_KEY, roles);
          } else {
              roles.addAll(userRoles);
          }
  
  
          request.setAttribute(FEDORA_ATTRIBUTES_KEY, attributes);
      }
docs: Add roles and other subject attributes where Fedora expects them - a Map
  called FEDORA_AUX_SUBJECT_ATTRIBUTES. Roles will be put in "fedoraRole"
  and others will be named as-is.
  
  @param subject
  the subject from authentication.
  @param userRoles
  the set of user roles.
  @param request
  the request in which to place the attributes.