提问人:Foadi 提问时间:11/22/2022 更新时间:11/22/2022 访问量:410
DUO 管理员身份验证问题
DUO Admin Auth Issues
问:
我正在尝试构建一个自动将用户添加到 DUO 的 C# 应用程序。
文档不清楚如何在线执行此操作。
这是我使用的代码
var client = new HttpClient();
var Request = new HttpRequestMessage(HttpMethod.Post, "https://api-2cf9xxxx.duosecurity.com/admin/v1/users");
Request.Content = new StringContent(string.Empty, Encoding.Unicode, "application/x-www-form-urlencoded");
Request.Headers.Add("X-Duo-Date", DuoDate);
Request.Headers.Add("Authorization","Basic " + val);
Request.Content = new FormUrlEncodedContent(new Dictionary<string, string>
{{"username:",ADAccountNameStr}});
Request.Headers.Add("Host", DuoHostname);
var response = await client.SendAsync(Request,HttpCompletionOption.ResponseHeadersRead);
var responseContent = await response.Content.ReadAsStringAsync();
这是这个 Request 和标头响应
Tue, 22 Nov 2022 15:19:41 +0000
POST
api-2cxxxxx.duosecurity.com
/admin/v1/users
username:jdoe
Method: POST, RequestUri: 'https://api-2cfxxxxx.duosecurity.com/admin/v1/users', Version: 1.1, Content: System.Net.Http.FormUrlEncodedContent, Headers:
{
X-Duo-Date: Tue, 22 Nov 2022 15:19:41 +0000
Authorization: Basic RElHVEsxWTBFOERENjdJU0NVNTY6MmM0NWU4MDBhNzkyOGE3YmY5NjBlNDI0MDI3NDZjYzY1Y2MzYzhkYQ==
Host: api-2cfxxxxxx.duosecurity.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 16
}
StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Connection: keep-alive
Date: Tue, 22 Nov 2022 15:19:41 GMT
Server: Duo/1.0
Content-Length: 86
Content-Type: application/json
}
我得到的错误是
"code": 40103, "message": "Invalid signature in request credentials", "stat": "FAIL"
谁能看出我哪里出了问题,唯一似乎正确的是内容长度。
答: 暂无答案
评论
val