使用 Postman 测试 spring 安全性安全性、测试、Postman、spring

2023-09-07 10:45:20 作者:看淡了所有

我已经使用 Spring 安全配置了基于表单的身份验证.当我使用 Web 应用程序中的登录表单登录时,它工作正常.

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.

它也适用于 cURL:

It also works with cURL:

curl --data "j_username=myname&j_password=mypassword" http://localhost:8080/test/j_spring_security_check --verbose

但是,我无法使用 Postman 使其工作:

However, I cannot make it works using Postman:

缺少什么?我需要通过身份验证才能测试其他服务.

What is missing? I need to be authenticated in order to test other services.

推荐答案

最后我设法通过使用 Postman Interceptor chrome 扩展

启用扩展程序后(通过单击 Postman 应用程序中的卫星图标),您只需使用 Web 的登录表单登录,然后您就可以开始使用需要在 Postman 中进行身份验证的服务.

With the extension enabled (by clicking the satellite icon within the Postman App), you just need to log in using the login form of your web and then you can start using services that require authentication in Postman.