有关访问HttpOnly Cookie&安全的cookie [英] Query about accessing HttpOnly Cookie & Secure cookie

查看:144
本文介绍了有关访问HttpOnly Cookie&安全的cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用angularJS处理RESTful SPA应用。目前,初始REST调用是在用户成功登录后在 xyz.com (安全响应cookie)上设置令牌cookie。我无法以Javascript / angular读取此cookie,因为我正在使用localhost。

I am working on RESTful SPA app using angularJS. Currently initial REST call is setting a "token" cookie on xyz.com ( secured response cookie) after successful user login. I am not able to read this cookie in Javascript/angular as I am working on localhost.

我在这里理解,除非我从xyz.com运行此应用程序,我无法访问此cookie或我是否需要安全连接?

What I understood here , unless I run this app from xyz.com , i wont be able to access this cookie OR do I need a secured connection ?

我的理解是否正确?

其次,我对httponlycookie的理解是,即使你在同一个主机上,它也无法通过javascript访问。

Secondly, my understanding about "httponly" cookie is that , it wont be accessible from javascript even though you are on same host.

请更正我的理解。

推荐答案

作为网站的作者:


  • 您无法读取其他网站的cookie(永远)

  • 您无法使用JavaScript读取仅HTTP的cookie

  • 您无法读取安全cookie,除非它通过HTTPS提供

这是三个独立的条件,具有独立的效果,没有,它们中的一些或全部可以适用于任何给定的cookie。

That's three separate conditions, with independent effects, and none, some or all of them can apply to any given cookie.

因此,如果cookie是 secur e 用于其他网站然后无论您是否使用HTTPS都无法读取它(因为不同网站阻止您即使安全没有)。

Therefore if a cookie is secure and for a different site then you can't read it no matter if you use HTTPS or not (since different site blocks you even if secure does not).

这篇关于有关访问HttpOnly Cookie&安全的cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆