提交 e69364bc 编写于 作者: S Sean Griffin

Merge pull request #21203 from denniss/issue-21199

Authorization scheme should be case insensitive. Fixes #21199
......@@ -94,7 +94,7 @@ def authenticate(request, &login_procedure)
end
def has_basic_credentials?(request)
request.authorization.present? && (auth_scheme(request) == 'Basic')
request.authorization.present? && (auth_scheme(request).downcase == 'basic')
end
def user_name_and_password(request)
......
......@@ -100,6 +100,14 @@ def test_encode_credentials_has_no_newline
assert_no_match(/\n/, result)
end
test "succesful authentication with uppercase authorization scheme" do
@request.env['HTTP_AUTHORIZATION'] = "BASIC #{::Base64.encode64("lifo:world")}"
get :index
assert_response :success
assert_equal 'Hello Secret', @response.body, 'Authentication failed when authorization scheme BASIC'
end
test "authentication request without credential" do
get :display
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册