【问题标题】:String oauth 2 The Resource Owner Password Flow -- username and client-id swappedString oauth 2 资源所有者密码流程——交换了用户名和客户端 ID
【发布时间】:2013-09-11 03:43:24
【问题描述】:

我尝试按照 spring sparklr2 示例设置 OAuth 2 服务器。我将其修改为使用数据库 userDetailsS​​ervice。当我尝试使用 curl 交换带有密码的令牌时,如下所示:

curl -X POST -d "client_id=client1&client_secret=123456&grant_type=password&username=user1&password=abc" http://mymachine:8080/oauth/token

加载用户 findByUsername() 失败,当我查看代码时,它使用客户端 ID(在我的情况下为“client1”)作为用户名。 调用堆栈是: DaoAuthenticationProvider.retrieveUser(String, UsernamePasswordAuthenticationToken) 行:101
DaoAuthenticationProvider(AbstractUserDetailsAuthenticationProvider).authenticate(Authentication) 行:132 ProviderManager.authenticate(Authentication) 行:156
ClientCredentialsTokenEndpointFilter.attemptAuthentication(HttpServletRequest, HttpServletResponse) 行:109
ClientCredentialsTokenEndpointFilter(AbstractAuthenticationProcessingFilter).doFilter(ServletRequest, ServletResponse, FilterChain) 行:211

我在 sparklr2 上尝试过 curl,

curl -X POST -d "client_id=my-trusted-client&grant_type=password&username=marissa&password=koala" http://mymachine:8080/sparklr2/oauth/token

同样,“my-trusted-client”作为用户名传递。但我还没有弄清楚为什么它会为 sparklr2 正确取回令牌。

【问题讨论】:

    标签: spring oauth


    【解决方案1】:

    通过将 spring-security-oauth2 版本从 1.9.5.RELEASE 更改为 1.1.0.BUILD-SNAPSHOT 解决。

    【讨论】:

      猜你喜欢
      • 2023-03-19
      • 2015-04-01
      • 2013-11-21
      • 2016-02-22
      • 2016-04-28
      • 1970-01-01
      • 2014-03-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多