我已经按照这个spring-security-oauth-example创建了Oauth2服务器。如何从 Postman 获取 Oauth2 令牌?
这是资源服务器的代码,这是 授权服务器配置。
我想了解如何从 Postman 获取 clientid = "ClientId" 的 Oauth2 令牌?下面这些代码的含义是什么:
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
@Autowired
private AuthenticationManager authenticationManager;
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
security.tokenKeyAccess("permitAll()")
.checkTokenAccess("isAuthenticated()");
}
public class ResourceServerConfig extends WebSecurityConfigurerAdapter {
http.requestMatchers()
.antMatchers("/login", "/oauth/authorize") //what does this do
application.properties 有
server.port=8081
server.context-path=/auth security.basic.enable=false
在 Postman 中设置 OAuth 2.0 令牌的步骤。
打开邮递员。
创建一个新请求。单击“授权”选项卡。截图如下:
Type
为OAuth 2.0。截图如下:因此,我添加了一些有用的资源来帮助您了解 OAuth 2.0 类型。
上述链接的屏幕截图:Oauth 2.0 授权框架的外观。
一些视频讲座可以直观地理解: