How to make spring boot never issue session cookie?

前端 未结 3 1675
粉色の甜心
粉色の甜心 2020-12-05 22:59

I\'m developing Restful API server by using spring boot. I configured my project to use basic authentication as below.

@ComponentScan
@EnableAutoConfiguratio         


        
3条回答
  •  盖世英雄少女心
    2020-12-05 23:34

    Have you tried using SessionCreationPolicy.STATELESS. There is a subtle difference between STATELESS and NEVER in the spring docs:

    STATELESS: Spring Security will never create an HttpSession and it will never use it to obtain the SecurityContext.

    NEVER: Spring Security will never create an HttpSession, but will use the HttpSession if it already exists.

    So I would suggest that you clear all your cookies, switch it to STATELESS and try again. It could be that you had already an HttpSession when you switched to NEVER.

提交回复
热议问题