code: public static List<GrantedAuthority> buildAuthorities(final List<CommonProfile> profiles) {
          final List<GrantedAuthority> authorities = new ArrayList<>();
          for (final CommonProfile profile : profiles) {
              final Set<String> roles = profile.getRoles();
              for (final String role : roles) {
                  authorities.add(new SimpleGrantedAuthority(role));
              }
          }
          return authorities;
      }
docs: Build a list of authorities from a list of profiles.
  
  @param profiles a map of profiles
  @return a list of authorities