【问题标题】:No HttpSession currently exists, No SecurityContext was available from the HttpSession: null. A new one will be created当前不存在 HttpSession,HttpSession 中没有可用的 SecurityContext:null。将创建一个新的
【发布时间】:2021-09-13 11:49:10
【问题描述】:

应用程序在本地机器上工作正常,但在服务器中面临自动会话超时。

DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository - No HttpSession currently exists
02:45:03.270 [http-nio-8080-exec-5] DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository - No SecurityContext was available from the HttpSession: null. A new one will be created.
02:45:03.270 [http-nio-8080-exec-5] DEBUG org.springframework.security.web.FilterChainProxy - /web/filerequeststransactionses/?page=3&size=10 at position 2 of 10 in additional filter chain; firing Filter: 'LogoutFilter'
02:45:03.270 [http-nio-8080-exec-5] DEBUG org.springframework.security.web.FilterChainProxy - /web/filerequeststransactionses/?page=3&size=10 at position 3 of 10 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'
02:45:03.270 [http-nio-8080-exec-5] DEBUG org.springframework.security.web.FilterChainProxy - /web/filerequeststransactionses/?page=3&size=10 at position 4 of 10 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'
02:45:03.270 [http-nio-8080-exec-5] DEBUG org.springframework.security.web.FilterChainProxy - /web/filerequeststransactionses/?page=3&size=10 at position 5 of 10 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
02:45:03.271 [http-nio-8080-exec-5] DEBUG org.springframework.security.web.FilterChainProxy - /web/filerequeststransactionses/?page=3&size=10 at position 6 of 10 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
02:45:03.271 [http-nio-8080-exec-5] DEBUG org.springframework.security.web.FilterChainProxy - /web/filerequeststransactionses/?page=3&size=10 at position 7 of 10 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'
02:45:03.271 [http-nio-8080-exec-5] DEBUG org.springframework.security.web.authentication.AnonymousAuthenticationFilter - Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@6faa3d44: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@ffff4c9c: RemoteIpAddress: 10.92.0.136; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'
02:45:03.271 [http-nio-8080-exec-5] DEBUG org.springframework.security.web.FilterChainProxy - /web/filerequeststransactionses/?page=3&size=10 at position 8 of 10 in additional filter chain; firing Filter: 'SessionManagementFilter'

using these properties in pom.xml

【问题讨论】:

  • 你也应该显示你的安全配置

标签: java spring spring-boot spring-mvc spring-security


【解决方案1】:

您可能会将服务器匿名会话(访问站点)与与服务器的实际登录会话混淆。 无论哪种方式,您都可以创建一个 http 会话,并且正如错误所说,它在第一次访问时无论如何都会创建一个。 会话对象是如何保存的。 可能是您如何在测试本地主机中关联保持会话的域故障。 或者它可能是服务器对 cookie 和其中的域路径的一些依赖(也许当它应该在 cookie 中更改时表示 localhost - 例如配置 xml)。

【讨论】:

    猜你喜欢
    • 2016-05-30
    • 2017-12-31
    • 1970-01-01
    • 2010-10-20
    • 1970-01-01
    • 2013-01-03
    • 1970-01-01
    • 1970-01-01
    • 2016-03-26
    相关资源
    最近更新 更多