Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
tornadoweb
Tornado
提交
1a0714e7
Tornado
项目概览
镜像
/
tornadoweb
/
Tornado
11 个月 前同步成功
通知
26
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Tornado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1a0714e7
编写于
3月 18, 2018
作者:
B
Ben Darnell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
auth: Deprecated _oauth_get_user
上级
089b5e7e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
8 deletion
+19
-8
tornado/auth.py
tornado/auth.py
+7
-0
tornado/test/auth_test.py
tornado/test/auth_test.py
+12
-8
未找到文件。
tornado/auth.py
浏览文件 @
1a0714e7
...
...
@@ -527,7 +527,14 @@ class OAuthMixin(object):
For backwards compatibility, the callback-based ``_oauth_get_user``
method is also supported.
.. deprecated:: 5.1
The ``_oauth_get_user`` fallback is deprecated and support for it
will be removed in 6.0.
"""
warnings
.
warn
(
"_oauth_get_user is deprecated, override _oauth_get_user_future instead"
,
DeprecationWarning
)
# By default, call the old-style _oauth_get_user, but new code
# should override this method instead.
self
.
_oauth_get_user
(
access_token
,
callback
)
...
...
tornado/test/auth_test.py
浏览文件 @
1a0714e7
...
...
@@ -18,6 +18,7 @@ from tornado import gen
from
tornado.httputil
import
url_concat
from
tornado.log
import
gen_log
from
tornado.testing
import
AsyncHTTPTestCase
,
ExpectLog
from
tornado.test.util
import
ignore_deprecation
from
tornado.web
import
RequestHandler
,
Application
,
asynchronous
,
HTTPError
...
...
@@ -121,12 +122,13 @@ class OAuth1ClientLoginHandler(RequestHandler, OAuthMixin):
return
yield
self
.
authorize_redirect
(
http_client
=
self
.
settings
[
'http_client'
])
def
_oauth_get_user
(
self
,
access_token
,
callback
):
@
gen
.
coroutine
def
_oauth_get_user_future
(
self
,
access_token
):
if
self
.
get_argument
(
'fail_in_get_user'
,
None
):
raise
Exception
(
"failing in get_user"
)
if
access_token
!=
dict
(
key
=
'uiop'
,
secret
=
'5678'
):
raise
Exception
(
"incorrect access token %r"
%
access_token
)
callback
(
dict
(
email
=
'foo@example.com'
)
)
return
dict
(
email
=
'foo@example.com'
)
class
OAuth1ClientLoginCoroutineHandler
(
OAuth1ClientLoginHandler
):
...
...
@@ -465,9 +467,10 @@ class AuthTest(AsyncHTTPTestCase):
response
.
headers
[
'Set-Cookie'
])
def
test_oauth10_get_user_legacy
(
self
):
response
=
self
.
fetch
(
'/legacy/oauth10/client/login?oauth_token=zxcv'
,
headers
=
{
'Cookie'
:
'_oauth_request_token=enhjdg==|MTIzNA=='
})
with
ignore_deprecation
():
response
=
self
.
fetch
(
'/legacy/oauth10/client/login?oauth_token=zxcv'
,
headers
=
{
'Cookie'
:
'_oauth_request_token=enhjdg==|MTIzNA=='
})
response
.
rethrow
()
parsed
=
json_decode
(
response
.
body
)
self
.
assertEqual
(
parsed
[
'email'
],
'foo@example.com'
)
...
...
@@ -502,9 +505,10 @@ class AuthTest(AsyncHTTPTestCase):
response
.
headers
[
'Set-Cookie'
])
def
test_oauth10a_get_user_legacy
(
self
):
response
=
self
.
fetch
(
'/legacy/oauth10a/client/login?oauth_token=zxcv'
,
headers
=
{
'Cookie'
:
'_oauth_request_token=enhjdg==|MTIzNA=='
})
with
ignore_deprecation
():
response
=
self
.
fetch
(
'/legacy/oauth10a/client/login?oauth_token=zxcv'
,
headers
=
{
'Cookie'
:
'_oauth_request_token=enhjdg==|MTIzNA=='
})
response
.
rethrow
()
parsed
=
json_decode
(
response
.
body
)
self
.
assertEqual
(
parsed
[
'email'
],
'foo@example.com'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录