我想确认ADFS
支持oAuth 2.0
完全支持oAuth 2.0
ie的所有流程,
三脚oAuth
双腿oAuht
隐含流动
我问这个是因为我尝试使用资源所有者密码流(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>(); postData.Add(new KeyValuePair ("grant_type", "password")); HttpContent content = new FormUrlEncodedContent(postData); token = client.PostAsync("http://adfs FQDN/adfs/oauth2/token/", content) .Result.Content.ReadAsStringAsync().Result; }
它给了我错误grant_Type=password is not supported
.
当我查看ADFS 2012 R2机器事件查看器日志时,它也会出错
"授权服务器不支持请求的'grant_type':'password'.授权服务器当前仅支持'grant_type = authorization_code'."
请帮我怎么实现这个流程?
AD FS 3.0(2012 R2)不支持OAuth 2.0的grant_type =密码,但它仅支持grant_type = authorization_code和grant_type = refresh_token.AD FS提供WS-Trust端点,您可以使用它们而不是OAuth 2.0端点来发布和交换令牌.WS-Trust为不同类型的身份验证提供端点.