相关疑难解决方法(0)

JAVA应用程序中的SameSite cookie

你知道任何允许为cookie设置自定义标志的JAVA Cookie实现(比如SameSite = strict)吗?它似乎SameSite=strict有严格限制的标志,可以添加.

java cookies flags csrf

23
推荐指数
7
解决办法
8214
查看次数

如何为 jsessionid cookie 启用相同站点

如何为在 Wildfly 上运行的 Web 应用程序启用相同站点。已检查standalone.xml但无法在其中找到合适的标签

<servlet-container name="default">
    <session-cookie http-only="true" secure="true"/>
    <jsp-config/>
</servlet-container>
Run Code Online (Sandbox Code Playgroud)

security cookies web wildfly-10

20
推荐指数
3
解决办法
4万
查看次数

如何在 Spring Boot 中设置同站 cookie 标志?

是否可以在 Spring Boot 中设置Same-Site Cookie标志?

我在 Chrome 中的问题:

http://google.com/上的跨站点资源关联的 cookie 设置为没有该SameSite属性。未来版本的 Chrome 将仅在跨站点请求中使用SameSite=None和设置 cookie 时才传送 cookie Secure。您可以在应用程序>存储>Cookies 下的开发人员工具中查看 cookie,并在https://www.chromestatus.com/feature/5088147346030592https://www.chromestatus.com/feature/5633521622188032 上查看更多详细信息 。


如何解决这个问题呢?

cookies spring-boot samesite

16
推荐指数
4
解决办法
4万
查看次数

Spring:无法将 SameSite cookie 设置为无

我无法将 SameSite cookie 值设置为无。

以下是我如何生成 ResponseCookie 对象。

ResponseCookie cookie = ResponseCookie.from("Hb", cookieUserId)
            .maxAge(!isEmpty(cookieUserId) ? MAX_COOKIE_DURATION : 0)
            .domain("test.com")
            .sameSite("None")
            .secure(true)
            .path("/")
            .build();
 response.addCookie(cookie)
Run Code Online (Sandbox Code Playgroud)

对端点的卷曲请求

curl -X POST "localhost:8080/v1/user/v" --data "{}" -v -H 'Content-Type: application/json'
Run Code Online (Sandbox Code Playgroud)

回复:

< set-cookie: Hb=00b7be31-fc6d-4891-a07c-46b5ef2b423c; Max-Age=7776000; Expires=Fri, 8 Nov 2019 17:23:52 GMT; Path=/; Domain=test.com; Secure
Run Code Online (Sandbox Code Playgroud)

如您所见,cookie 中缺少 SameSite 属性。

Spring Boot(版本:2.1.3.RELEASE)依赖

        <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

java cookies spring spring-boot samesite

8
推荐指数
1
解决办法
2万
查看次数

如何设置 SameSite 属性?

我在 Cookie 中设置 SameSite 属性时遇到问题。我想设置这个属性,但既没有javax.servlet.http.Cookie也没有java.net.HttpCookie提供处理它的方法。因此,我有一个想法来创建一个响应javax.servlet.Filter以捕获“Set-Cookie”标头并添加“SameSite=Strict”属性。

response.setHeader("Set-Cookie", response.getHeader("Set-Cookie") + "; SameSite=strict");
Run Code Online (Sandbox Code Playgroud)

它工作正常,但是当我在一个响应中有多个“Set-Cookie”标头时出现问题。javax.servlet.http.HttpServletResponse不提供删除或覆盖多个具有相同名称的 heder 的方法(迭代它们并使用setHeader()不起作用,因为它总是设置最后一个)。您知道如何将 SameSite 属性设置为 cookie 或如何覆盖响应过滤器中的标头吗?

提前致谢。

java cookies http servlet-filters

6
推荐指数
1
解决办法
2万
查看次数

在 Spring Boot 中将 jsessonid cookie 设置为 SameSite=Strict 属性?

将 jsessionId cookie 设置为 SameSite=Strict 的 spring-boot 配置是什么。

JsessionId需要添加SameSite=Strict或者现有的cookie而不是新的cookie生成。是否支持?

java security cookies spring-boot

6
推荐指数
2
解决办法
7757
查看次数

Spring Security中的相同站点Cookie

在Spring Security中可以设置Same-site Cookie标志吗?请参阅:https : //tools.ietf.org/html/draft-west-first-party-cookies-07 ,如果没有,请问是否有增加支持的路线图?某些浏览器(例如Chrome)已经支持。TH

security cookies spring-security jsessionid csrf-protection

5
推荐指数
5
解决办法
4253
查看次数