【问题标题】:Form Based OAuth2 Resource Server基于表单的 OAuth2 资源服务器
【发布时间】:2018-06-14 10:05:21
【问题描述】:

我正在尝试使用 Spring Security OAuth2 配置 Spring Boot 1.5.0 应用程序,而我的 userInfo 服务器 是基于表单的.我必须以 form-urlencoded 方式发送 access_token(而不是像“Authorization: Bearer ...”这样的标题)。

在我的 IDE 中进行调试,我在 UserInfoRestTemplate 上将 authorizationScheme 更改为“表单”,如下面的示例:

DefaultUserInfoRestTemplateFactory

它按我的预期工作。 RestTemplate 生成了“www-form-urlencoded”,服务器按照我的预期回复了用户信息。

但现在我无法确定如何对 application.yaml 进行更改以做出相同的行为。我尝试了一些变化,但没有成功(如下面的这个例子)

application.yaml

有人知道正确的设置方法吗?

提前致谢

【问题讨论】:

标签: spring spring-boot spring-security-oauth2


【解决方案1】:

这是一个例子:

security:
  oauth2:
    client:
      client-id: acme
      client-secret: acmesecret
      scope: read,write
      auto-approve-scopes: '.*'

facebook:
  client:
    clientId: 233668646673605
    clientSecret: 33b17e044ee6a4fa383f46ec6e28ea1d
    accessTokenUri: https://graph.facebook.com/oauth/access_token
    userAuthorizationUri: https://www.facebook.com/dialog/oauth
    tokenName: oauth_token
    authenticationScheme: form
    clientAuthenticationScheme: form
  resource:
    userInfoUri: https://graph.facebook.com

【讨论】:

    猜你喜欢
    • 2021-02-08
    • 2016-04-22
    • 2013-12-21
    • 2018-04-14
    • 2018-05-01
    • 2013-08-24
    • 2019-10-27
    • 2016-05-21
    • 2019-11-27
    相关资源
    最近更新 更多