libgit2 / libgit2/libgit2sharp
'Too many redirects or authentication replays' on clone from TFS
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C#
- Star
- 3.5k
- Fork
- 925
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
After updating to Team Foundation Server TFS 2018 & 2017 Update 3, we are not be able to login to GIT repository using LibGit2Sharp library using Access Token. Please check the code below:
`
string accessToken = "eyJ0eXAiOiJKV1QiLCJ...";
NetworkCredential gitCredentials = new NetworkCredential(string.Empty, accessToken);
string localRepoPath = string.Empty;
string gitTfsRepo = "http://mjtfs2017:8080/tfs/DefaultCollection/_git/GITTest001";
try
{
localRepoPath = Repository.Clone(gitTfsRepo, @"D:\temp\GIT",
new CloneOptions()
{
CredentialsProvider = GetCredentialsHandler(gitCredentials),
IsBare = false
});
}
catch (Exception err)
{
Console.WriteLine(err);
}
Console.WriteLine(localRepoPath);
`
I communicated with Microsoft TFS/VSTS Team they gave following response:
The fact that you received those responses from the code snip I provided means that your extension is correctly configured (regarding scopes at least) and TFS is correctly accepting the extension’s access token to perform git operations through HTTP, when the git client sends it.
Additionally, if I use the next command, using git for Windows, I’m able to fully interact with a TFS repo with that access token:
git -c http.extraheader="Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ..." clone http://at1-tfs-test1-angallo.westus2.cloudapp.azure.com:8080/tfs/DefaultCollection/_git/test_project_1
But that same command doesn’t work for git for Linux, probably because my git client on my Linux machine doesn’t send or correctly consider these HTTP headers (just as LibGit2Sharp seems to not do too (from your latest Fiddler trace I still see the Authentication header missing)). So I still believe the problem here comes from the git client, not TFS or the access token.
Please suggest, thanks in advance.
LibGit2Sharp version: 0.26.0-preview-0027
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu từ lệnh gọi Repository.Clone và CredentialsProvider của nó trong bản tái hiện được cung cấp, sau đó so sánh request với lệnh git đang hoạt động, lệnh gửi một header Authorization Bearer. Tái hiện thao tác clone với TFS và kiểm tra xem header đó có được gửi hay không; hoàn tất khi clone được xác thực bằng access token hoàn thành mà không có lỗi redirect hoặc authentication replay.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- csharp, git
- Lĩnh vực
- authentication, backend, networking
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100