Skip to content

Commit

Permalink
Only replace personID if an eppn is present
Browse files Browse the repository at this point in the history
  • Loading branch information
phavekes committed May 14, 2024
1 parent bc1f89b commit 4ea4519
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/home/api/PersonEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ private ResponseEntity<Map<String, Object>> doPerson(BearerTokenAuthentication a

Map<String, Object> tokenAttributes = authentication.getTokenAttributes();
String eppn = (String) tokenAttributes.get("eduperson_principal_name");
String sub = (String) tokenAttributes.get("sub");
String givenName = (String) tokenAttributes.get("given_name");
String familyName = (String) tokenAttributes.get("family_name");
String mail = (String) tokenAttributes.get("email");

LOG.debug(String.format("Persons request for person %s", eppn));
LOG.debug(String.format("Persons request for eppn: %s, sub: %s", eppn, sub));

map.put("personId", eppn);
if (StringUtils.hasText(eppn)) {
map.put("personId", eppn);
}
if (StringUtils.hasText(mail)) {
map.put("mail", mail);
}
Expand Down

0 comments on commit 4ea4519

Please sign in to comment.