diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb index 648d96fc0ee61..2ad4df5b53ad8 100644 --- a/actionpack/lib/action_controller/metal/http_authentication.rb +++ b/actionpack/lib/action_controller/metal/http_authentication.rb @@ -104,7 +104,7 @@ def authenticate(request, &login_procedure) end def has_basic_credentials?(request) - request.authorization.present? && (auth_scheme(request).downcase == "basic") && user_name_and_password(request).length == 2 + request.authorization.present? && (auth_scheme(request).downcase == "basic") end def user_name_and_password(request) diff --git a/actionpack/test/controller/http_basic_authentication_test.rb b/actionpack/test/controller/http_basic_authentication_test.rb index 8c81f42a76ab6..73524d0443c87 100644 --- a/actionpack/test/controller/http_basic_authentication_test.rb +++ b/actionpack/test/controller/http_basic_authentication_test.rb @@ -112,11 +112,6 @@ def test_encode_credentials_has_no_newline assert_no_match(/\n/, result) end - test "has_basic_credentials? should fail with credentials without colon" do - @request.env["HTTP_AUTHORIZATION"] = "Basic #{::Base64.encode64("David Goliath")}" - assert_not ActionController::HttpAuthentication::Basic.has_basic_credentials?(@request) - end - test "successful authentication with uppercase authorization scheme" do @request.env["HTTP_AUTHORIZATION"] = "BASIC #{::Base64.encode64("lifo:world")}" get :index