From 87bbb2069fbdcfb668dce728d6e7346db3874c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Emre=20Alada=C4=9F?= Date: Mon, 4 Jan 2016 20:14:05 +0200 Subject: [PATCH] Realm added for Basic Authentication --- src/kemal/middleware/http_basic_auth.cr | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kemal/middleware/http_basic_auth.cr b/src/kemal/middleware/http_basic_auth.cr index 8ec53b8..bdbf72e 100644 --- a/src/kemal/middleware/http_basic_auth.cr +++ b/src/kemal/middleware/http_basic_auth.cr @@ -22,7 +22,9 @@ module Kemal::Middleware end end end - HTTP::Response.new(401, "Unauthorized") + headers = HTTP::Headers.new + headers["WWW-Authenticate"] = "Basic realm=\"Login Required\"" + HTTP::Response.new(401, "Could not verify your access level for that URL.\nYou have to login with proper credentials", headers, nil, "HTTP/1.1", nil) end def authorized?(value)