Skip to content

Commit

Permalink
Merge pull request #130 from TAMULib/2.x-affiliation
Browse files Browse the repository at this point in the history
Affiliations need to handle the NULL case otherwise assume user gets NULL rather than UNKNOWN.
  • Loading branch information
jcreel committed Feb 2, 2022
2 parents 69d1fe9 + d69ccba commit 8e07fd5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public ApiResponse assume(@RequestParam() Map<String, String> params) throws Exc
claims.put("tdl-givenname", info.get("first_name"));
claims.put("tdl-mail", info.get("tamu_preferred_alias"));

String affiliation = info.get("employee_type_name");
String affiliation = info.getOrDefault("employee_type_name", "");

if ("".equals(affiliation) || "Student".equals(affiliation)) {
String classification = info.get("classification_name").split(" ")[0].replace(",", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Credentials(Claims claims) {
this.exp = String.valueOf(claims.get("exp"));
this.email = String.valueOf(claims.get("email"));
this.role = String.valueOf(claims.get("role"));
this.affiliation = String.valueOf(claims.get("affiliation"));
this.affiliation = String.valueOf(claims.getOrDefault("affiliation", ""));
claims.entrySet().forEach(entry -> {
this.allCredentials.put(entry.getKey(), String.valueOf(entry.getValue()));
});
Expand All @@ -70,7 +70,7 @@ public Credentials(Map<String, Object> claims) {
this.exp = String.valueOf(claims.get("exp"));
this.email = String.valueOf(claims.get("email"));
this.role = String.valueOf(claims.get("role"));
this.affiliation = String.valueOf(claims.get("affiliation"));
this.affiliation = String.valueOf(claims.getOrDefault("affiliation", ""));
claims.entrySet().forEach(entry -> {
this.allCredentials.put(entry.getKey(), String.valueOf(entry.getValue()));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Credentials buildAnonymousCredentials() {
}

public abstract U updateUserByCredentials(Credentials credentials);

public abstract String getAnonymousRole();

}

0 comments on commit 8e07fd5

Please sign in to comment.