Testing spring security with Postman

后端 未结 4 2268
渐次进展
渐次进展 2021-02-13 02:06

I have configured a form-base authentication using Spring security. It works fine when I log in using the login form in my web application.

It also works with cURL:

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 02:19

    Using http.httpBasic worked for me.

    http.httpBasic()
        .and()
        .authorizeRequests()
        .antMatchers("/api/home")
        .hasRole("ADMIN")
        .antMatchers("/api/product/*")
        .hasRole("ADMIN")
        .and()
        .formLogin();
    

提交回复
热议问题