【问题标题】:Wicket token ignores domainWicket 令牌忽略域
【发布时间】:2015-03-17 14:05:37
【问题描述】:

我需要向我的页面添加令牌以验证 iframe 中的应用程序。 问题是,当我将域设置为 cookie 时,它​​不会添加到页面中。我在检票口示例中创建 cookie:

  WebResponse webResponse = (WebResponse) RequestCycle.get().getResponse();

  Cookie cookie = new Cookie("MY_AUTH_TOKEN", "token");
  cookie.setPath("/");
  cookie.setDomain("domain_in_iframe.com");

  webResponse.addCookie(cookie);

HTML:

<iframe src="http://domain_in_iframe.com/" style="width:100%; height:500px;">

</iframe>

当使用 setDomain 时,浏览器中不存在 cookie。不使用 serDomain 方法 cookie 存在,但显示为带有 localhost 域的 cookie。

即使在 webbrowser 中手动添加 cookie 也可以,但这段代码不行。任何想法为什么?

【问题讨论】:

    标签: authentication cookies wicket


    【解决方案1】:

    出于安全原因,您不能设置与当前域不同的域。 详情请见https://stackoverflow.com/a/20090012/497381

    【讨论】:

      猜你喜欢
      • 2016-07-09
      • 2018-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-21
      • 2020-10-08
      • 1970-01-01
      • 2011-05-05
      相关资源
      最近更新 更多