Skip to content
Snippets Groups Projects

Define userName variable distinct from eppn in federated mapper

2 files
+ 8
5
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -27,10 +27,10 @@ import java.util.Enumeration;
public class FederatedPreauthenticatedUserDetailsAttributeMapper implements PreauthenticatedUserDetailsAttributeMapper {
private String eppnHeader = "eppn";
private String pviHeader = "eduwisconsinspvi";
private String pviHeader = "eduWisconsinSPVI";
private String usernameHeader = "eppn";
private String fullNameHeader = "cn";
private String uddsHeader = "eduwisconsinudds";
private String uddsHeader = "eduWisconsinUDDS";
private String emailAddressHeader = "mail";
private String firstNameHeader = "givenName";
private String lastNameHeader = "sn";
@@ -49,6 +49,7 @@ public class FederatedPreauthenticatedUserDetailsAttributeMapper implements Prea
*/
@Override
public UWUserDetails mapUser(HttpServletRequest request) {
logger.debug("enter mapUser, available headers: {}", request.getHeaderNames());
String eppn = request.getHeader(eppnHeader);
logger.debug("enter mapUser, eppnHeader {} was {}", eppnHeader, eppn);
if(StringUtils.isBlank(eppn)) {
@@ -57,13 +58,15 @@ public class FederatedPreauthenticatedUserDetailsAttributeMapper implements Prea
}
String pvi = request.getHeader(pviHeader);
String cn = request.getHeader(fullNameHeader);
String userName = request.getHeader(usernameHeader);
Collection<String> uddsMembership = new ArrayList<>();
Enumeration<String> uddsHeaders = request.getHeaders(uddsHeader);
if(uddsHeaders != null) {
uddsMembership = Collections.list(uddsHeaders);
}
String email = request.getHeader(emailAddressHeader);
UWUserDetailsImpl result = new UWUserDetailsImpl(pvi, eppn, "", cn, email, uddsMembership);
UWUserDetailsImpl result = new UWUserDetailsImpl(pvi, userName, "", cn, email, uddsMembership);
result.setSource("edu.wisc.uwss.preauth.federation");
result.setEppn(eppn);
result.setFirstName(request.getHeader(firstNameHeader));
Loading