Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ISSUE-603: Minor: Registry is failing to parse the doAs user #604

Merged
merged 2 commits into from
Oct 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -450,26 +450,22 @@ public boolean shouldAuthenticate(HttpServletRequest request) {
}

protected static String getDoasUser(HttpServletRequest request) {
String doAsUser = null;
String doAsUser = "";
String queryString = request.getQueryString();
if (queryString != null) {
String[] pairs = queryString.split(QUERY_STRING_DELIMITER);
try {
for (String pair : pairs) {
if (pair.startsWith(DOAS_QUERY_STRING)) {
doAsUser = URLDecoder.decode(pair.substring(DOAS_QUERY_STRING.length()), "UTF-8").trim();
if (doAsUser.isEmpty()) {
return null;
}
}
break;
}
} catch (UnsupportedEncodingException ex) {
//We are providing "UTF-8". This should not be happening ideally.
LOG.error("Invalid encoding provided.");
}
}
return doAsUser;
return doAsUser.isEmpty() ? null : doAsUser;
}

/**
Expand Down