Skip to content

Commit

Permalink
WWW-Authenticate header added
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwechner committed Nov 17, 2012
1 parent b417097 commit 2dfed97
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -400,6 +400,7 @@ public void getXHTMLAuthenticationForm(HttpServletRequest request, HttpServletRe
String mimeType = YanelServlet.patchMimeType("application/xhtml+xml", request);
response.setContentType(mimeType + "; charset=" + YanelServlet.DEFAULT_ENCODING);
response.setStatus(javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED);
response.setHeader("WWW-Authenticate", "BASIC realm=\"" + realm.getName() + "\"");

File realmDir = realm.getRootDir();
if (realmDir == null) realmDir = new File(realm.getConfigFile().getParent());
Expand Down Expand Up @@ -711,8 +712,10 @@ protected org.w3c.dom.Document generateAuthenticationScreenXML(HttpServletReques
Identity identity = YanelServlet.getIdentity(request.getSession(true), realm);
if (identity != null) {
currentUserId = identity.getUsername();
//log.debug("Identity from session: " + identity);
} else {
//log.debug("Session contains no identity yet.");
}
//String currentUserId = getCurrentUserId(request.getSession(true), realm);
if (currentUserId != null) {
Element userElement = (Element) rootElement.appendChild(adoc.createElementNS(YanelServlet.NAMESPACE, "user"));
userElement.setAttributeNS(YanelServlet.NAMESPACE, "id", currentUserId);
Expand Down

0 comments on commit 2dfed97

Please sign in to comment.