Spring Security, Stateless REST service and CSRF

前端 未结 2 1054
北恋
北恋 2021-01-02 19:13

I have a REST service, built using Java, Spring-boot and using Spring Security with Basic Access Authentication. There are no Views, no JSP etc, no \'login\', just stateles

2条回答
  •  生来不讨喜
    2021-01-02 19:56

    If you want to disable csrf in more proper way you can call it like this(if using java configuration)

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .anyRequest().fullyAuthenticated()
                .and().httpBasic();
           .and()
                .csrf()
                .disable()
    

提交回复
热议问题