提交 4b4e8907 编写于 作者: P phoet

allow `Bearer` as well as `Token`

上级 90918b5f
......@@ -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 /
TOKEN_REGEX = /^(Token|Bearer) /
AUTHN_PAIR_DELIMITERS = /(?:,|;|\t+)/
extend self
......
......@@ -87,6 +87,13 @@ def authenticate_long_credentials
assert_equal "HTTP Token: Access denied.\n", @response.body, "Authentication header was not properly parsed"
end
test "successful authentication request with Bearer instead of Token" do
@request.env['HTTP_AUTHORIZATION'] = 'Bearer lifo'
get :index
assert_response :success
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.
先完成此消息的编辑!
想要评论请 注册