ADFS 2012 R2是否支持Auth2资源所有者密码凭据流

use*_*058 2 oauth-2.0 adfs2.1

我想确认ADFS支持oAuth 2.0完全支持oAuth 2.0
ie的所有流程,

  1. 三脚oAuth

  2. 双腿oAuht

  3. 隐含流动

我问这个是因为我尝试使用资源所有者密码流(2-legged Oauth).这是我的代码

                using (HttpClient client = new HttpClient())
                {
                    string creds = String.Format("{0}:{1}", "hello@ADFS FQDN", "christ");
                    byte[] bytes = Encoding.ASCII.GetBytes(creds);
                    var header = new AuthenticationHeaderValue("Basic",
                                               Convert.ToBase64String(bytes));


                    client.DefaultRequestHeaders.Authorization = header;

                    var postData = new List<KeyValuePair<string, string>>();

                    postData.Add(new KeyValuePair<string, string>
                                       ("grant_type", "password"));


                    HttpContent content = new FormUrlEncodedContent(postData);

                    token = client.PostAsync("http://adfs FQDN/adfs/oauth2/token/", content)
                                     .Result.Content.ReadAsStringAsync().Result;
                }
Run Code Online (Sandbox Code Playgroud)

它给了我错误grant_Type=password is not supported.
当我查看ADFS 2012 R2机器事件查看器日志时,它也会出错

"授权服务器不支持请求的'grant_type':'password'.授权服务器当前仅支持'grant_type = authorization_code'."

请帮我怎么实现这个流程?

Ale*_*ovi 7

AD FS 3.0(2012 R2)不支持OAuth 2.0的grant_type =密码,但它仅支持grant_type = authorization_codegrant_type = refresh_token.AD FS提供WS-Trust端点,您可以使用它们而不是OAuth 2.0端点来发布和交换令牌.WS-Trust为不同类型的身份验证提供端点.