Tôi đang cố gắng để tạo ra một lỗi trong TFS2010 bởi mạo danh một người sử dụng nhưng luôn luôn có đượcTFS 2010 - Tại sao tôi nhận được thông báo "TF30063 Bạn không được phép truy cập .." khi mạo danh?
"TF30063 You are not authorized to access.."
đầu tiên tôi xác thực sử dụng một tài khoản dịch vụ và sau đó cố gắng để mạo danh một tài khoản người dùng riêng biệt. Tôi có thể tạo thành công các mục công việc bằng cách sử dụng cả hai tài khoản theo lập trình và trong giao diện người dùng web. Tuy nhiên, khi tôi cố gắng tạo Mục công việc đã sử dụng tài khoản bị mạo danh (cả hai cách xung quanh), tôi luôn nhận được lỗi này. Mã của tôi là:
public int Save(List<KeyValuePair<string, string>> values, ticketType type,string user)
{
// get the Uri to the project collection to use
Uri tfsuri = new Uri("http://94.23.12.119:8085/tfs");
// get a reference to the team project collection (authenticate as generic service account)
using (var tfs = new TfsTeamProjectCollection(tfsuri, new System.Net.NetworkCredential("username", "password", "servername")))
{
tfs.EnsureAuthenticated();
//Now get the details of the user we want to impersonate
TeamFoundationIdentity identity = GetImpersonatedIdentity(tfsuri,tfs,user);
//Now connect as the impersonated user
using (TfsTeamProjectCollection ImpersonatedTFS = new TfsTeamProjectCollection(tfsuri, identity.Descriptor))
{
ImpersonatedTFS.EnsureAuthenticated();
var workItemStore = GetWorkItemStore(ImpersonatedTFS);
// create a new work item
WorkItem wi = new WorkItem(GetWorkItemType(type, workItemStore));
{
//Values are supplied as a KVP - Field Name/Value
foreach (KeyValuePair<string,string> kvp in values)
{
if (wi.Fields.Contains(kvp.Key))
{
wi.Fields[kvp.Key].Value = kvp.Value;
}
}
ValidationResult = wi.Validate();
}
if (ValidationResult.Count == 0)
{
wi.Save();
return wi.Id;
}
else
{
return 0;
}
}
}
}
Nó được thành công bản sắc mạo nhận nhưng giảm hơn trên
ImpersonatedTFS.EnsureAuthenticated();
Cả hai tài khoản có 'Hãy yêu cầu nhân danh người khác' tập quyền.
Bạn đang thực hiện bao nhiêu bước nhảy để truy cập tfs? Trong trường hợp của nhiều nút X-> Y-> Z, dịch vụ trên hộp Y có thể mạo danh id của người gọi trên hộp X. Tuy nhiên, nó mau không có quyền chuyển giao mạo danh đó vào một dịch vụ trên một dịch vụ khác hộp Z. – user957902
Chỉ cần một bước nhảy xa như tôi biết. – Simon