Merge branch 'master' of ssh://git.code.sf.net/p/hl7api/fhircode

This commit is contained in:
jamesagnew 2014-06-12 13:04:30 -04:00
commit 58bb97e6d0
1 changed files with 5 additions and 0 deletions

View File

@ -625,6 +625,11 @@ public class RestfulServer extends HttpServlet {
resourceMethod.invokeServer(this, r, theResponse);
} catch (AuthenticationException e) {
String userAgent = theRequest.getHeader("User-Agent");
if (userAgent != null && userAgent.contains("Mozilla")) {
//if request is coming from a browser, prompt the user to enter login credentials
theResponse.setHeader("WWW-Authenticate", "BASIC realm=\"FHIR\"");
}
theResponse.setStatus(e.getStatusCode());
addHeadersToResponse(theResponse);
theResponse.setContentType("text/plain");