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,
},
}