提交 1ad94e76 编写于 作者: S Sean Griffin

Merge pull request #14212 from tylerhunt/fix-token-regex

Handle tab in token authentication header.
......@@ -397,7 +397,7 @@ def opaque(secret_key)
# RewriteRule ^(.*)$ dispatch.fcgi [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
module Token
TOKEN_KEY = 'token='
TOKEN_REGEX = /^(Token|Bearer) /
TOKEN_REGEX = /^(Token|Bearer)\s+/
AUTHN_PAIR_DELIMITERS = /(?:,|;|\t+)/
extend self
......
......@@ -94,6 +94,14 @@ def authenticate_long_credentials
assert_response :success
end
test "authentication request with tab in header" do
@request.env['HTTP_AUTHORIZATION'] = "Token\ttoken=\"lifo\""
get :index
assert_response :success
assert_equal 'Hello Secret', @response.body
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.
先完成此消息的编辑!
想要评论请 注册