mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #14212 from tylerhunt/fix-token-regex
Handle tab in token authentication header.
This commit is contained in:
commit
1ad94e760d
2 changed files with 9 additions and 1 deletions
|
@ -397,7 +397,7 @@ module ActionController
|
|||
# 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 @@ class HttpTokenAuthenticationTest < ActionController::TestCase
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue