基于表单的 OAuth2 资源服务器

Form Based OAuth2 Resource Server

我正在尝试使用 Spring Security OAuth2 配置 Spring Boot 1.5.0 应用程序,我的 userInfo 服务器 是 form-based。我必须以 form-urlencoded 的方式发送 access_token(而不是像 "Authorization: Bearer ..." 那样的 Header)。

在我的 IDE 中调试,我在 UserInfoRestTemplate 上将 authorizationScheme 更改为 "form",就像这样下面的示例:

DefaultUserInfoRestTemplateFactory

如我所料,一切顺利。 RestTemplate 生成了一个 "www-form-urlencoded",服务器按照我的预期响应了用户信息。

但现在我无法确定如何对 application.yaml 进行更改以实现相同的行为。我尝试了一些变体但没有成功(如下例所示)

application.yaml

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

提前致谢

这是一个例子:

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