Iva*_*van 8 spring-security postman
我已经使用Spring安全性配置了基于表单的身份验证.当我使用我的Web应用程序中的登录表单登录时,它工作正常.
它也适用于cURL:
curl --data "j_username=myname&j_password=mypassword" http://localhost:8080/test/j_spring_security_check --verbose
Run Code Online (Sandbox Code Playgroud)
但是,我无法使用Postman:

缺什么?我需要进行身份验证才能测试其他服务.
您可以通过授权选项卡下的邮递员下拉列表中给出的各种授权类型在邮递员中实现身份验证/授权。
以下是使用默认情况下 spring 安全提供的基本身份验证的步骤。
在 spring security 中,您可以在 application.properties 文件中自定义您的凭据,如下所示。
spring.security.user.name=你 spring.security.user.password=galem
最后,我设法使用Postman Interceptor chrome扩展程序使Postman了解身份验证
启用扩展程序后(通过单击Postman App中的卫星图标),您只需要使用Web的登录表单登录,然后即可开始使用需要在Postman中进行身份验证的服务。
小智 6
使用http.httpBasic对我有用。
http.httpBasic()
.and()
.authorizeRequests()
.antMatchers("/api/home")
.hasRole("ADMIN")
.antMatchers("/api/product/*")
.hasRole("ADMIN")
.and()
.formLogin();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15902 次 |
| 最近记录: |