【发布时间】:2020-01-22 18:03:30
【问题描述】:
我已经根据spring-security-oauth-example 创建了 Oauth2 服务器。如何从 Postman 获取 Oauth2 令牌?
这是资源服务器的代码,这是 AuthorizationServerConfig.
我想了解如何从 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
【问题讨论】:
-
你有clientID、秘钥和其他详细信息吗?
-
是的,在 AuthorizationServerConfig 链接中明确提到
-
你只想要postman中如何设置oauth2的过程吗?可以吗,如果我为您提供创建新访问令牌选项的步骤。数据应由您填写。
-
是的,还有一点解释...... Github 中的代码是如何工作的......非常感谢您的宝贵时间
标签: java spring oauth-2.0 spring-oauth2