Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/129.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 如何将HTTPONLY设置为webapp2身份验证模块生成的身份验证cookie?_Python 2.7_Google App Engine_Webapp2 - Fatal编程技术网

Python 2.7 如何将HTTPONLY设置为webapp2身份验证模块生成的身份验证cookie?

Python 2.7 如何将HTTPONLY设置为webapp2身份验证模块生成的身份验证cookie?,python-2.7,google-app-engine,webapp2,Python 2.7,Google App Engine,Webapp2,这就是我如何设置使用webapp2 'webapp2_extras.auth': { 'cookie_name': 'auth', 'token_max_age': 24 * 60 * 60, 'user_attributes': [] }, 我检查了文档,但没有发现关于设置此cookie的其他属性的内容。我想确保此cookie为“HTTPOnly” 如何通过webapp2配置或任何其他方式设置HTTPOnly?如果查看“”的源代码,您会发现它没有实现与“”相同的会话参

这就是我如何设置使用
webapp2

'webapp2_extras.auth': {
    'cookie_name': 'auth',
    'token_max_age': 24 * 60 * 60,
    'user_attributes': []
},
我检查了文档,但没有发现关于设置此cookie的其他属性的内容。我想确保此cookie为“HTTPOnly”


如何通过webapp2配置或任何其他方式设置
HTTPOnly

如果查看“”的源代码,您会发现它没有实现与“”相同的会话参数选项。但是,它确实依赖于“webapp2_extras.sessions”,并明确设置了“max_age”会话参数(行号不存在):


假设您可以修改webapp2源代码,在此处添加此额外会话参数,但我无法评论这样做的任何不利影响。

可以在webapp2_extras.sessions中配置:

'webapp2_extras.auth': {
  ...
},
'webapp2_extras.sessions': {
   'cookie_args': {
     'httponly': True,
   },
}
'webapp2_extras.auth': {
  ...
},
'webapp2_extras.sessions': {
   'cookie_args': {
     'httponly': True,
   },
}