Skip to content
Snippets Groups Projects

Consume isMemberOf attribute as single value with semi-colon delimited list of manifest groups

Merged Benjamin Sousa requested to merge bjsousa/uw-spring-security:split_manifest_header into master
1 unresolved thread

In the List Library application, which is attempting to consume Manifest groups as UW Spring Security authorities, we discovered that multiple Manifest groups are not provided by the login server as multiple isMemberOf headers but as one string with the Manifest groups delimited by semi-colons.

This PR revises the default Preauth mapper to split the isMemberOf string apart into a Java collection, which is the correct format for the authorities argument to the UWUserDetailsImpl constructor.

Notify: @paul.erickson @ahoffmann @gutkowski @bkeen

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
85 85 String emplid = request.getHeader(isisEmplidHeader);
86 86 Collection<String> uddsMembership = safeGetHeaders(request, uddsHeader);
87 87 String email = request.getHeader(emailAddressHeader);
88 Collection<String> manifestGroups = safeGetHeaders(request, manifestHeader);
88
89 Collection<String> manifestGroups = new ArrayList<>();
90 String manifestValue = request.getHeader(manifestHeader);
91 if (manifestValue != null) {
92 String[] manifestGroupStrings = manifestValue.split(";");
93 for (String manifestGroupString : manifestGroupStrings) {
  • This multi-line for-loop could technically use a single-lined Java 8 stream! Since we're talking about a handful of elements here, it's not strictly necessary. However, I highly recommend taking it on as a personal coding challenge.

  • Target is currently set to java7, but I totally agree. #insert-crossing-the-streams-reference

    MyUW should be going to Java 8 very very soon.

    Edited by Tim Levett
  • Please register or sign in to reply
  • Please register or sign in to reply
    Loading