gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 23:06:46 26 4
gpt4 key购买 nike

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

  1. 三足 oAuth

  2. 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;
}

它给我错误grant_Type=password is not support
当我查看 ADFS 2012 R2 计算机事件查看器日志时,它也给出错误

"The authorization server does not support the requested 'grant_type': 'password'. The authorization server currently only supports 'grant_type=authorization_code'."

请帮助我如何实现这个流程?

最佳答案

AD FS 3.0 (2012 R2) 不支持 OAuth 2.0 grant_type=password,但支持 grant_type=authorization_codegrant_type=refresh_token仅有的。 AD FS 提供 WS-Trust 端点,您可以使用它们代替 OAuth 2.0 端点来颁发和交换 token 。 WS-Trust 提供了不同类型身份验证的端点。

关于oauth-2.0 - ADFS 2012 R2 是否支持 Auth2 资源所有者密码凭据流程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20869778/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com