通过非个性化进行身份验证(Team Foundation Server) [英] Authenticating (Team Foundation Server) with impersonalization

查看:61
本文介绍了通过非个性化进行身份验证(Team Foundation Server)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了如何使用给定的用户名/密码从我的应用程序向TFS进行身份验证.我想使用REST服务.

I have found how to authenticate to TFS from my app with a given username/password. I'd like to use the REST services.

    public static void BasicAuthRestSample()
    {
        // Create instance of VssConnection using basic auth credentials. 
        // For security, ensure you are connecting to an https server, since credentials get sent in plain text.
        VssConnection connection = new VssConnection(new Uri(collectionUri), new VssCredentials(new WindowsCredential(new NetworkCredential(username, password))));

        WorkItemTrackingHttpClient witClient = connection.GetClient<WorkItemTrackingHttpClient>();
        List<QueryHierarchyItem> items = witClient.GetQueriesAsync(teamProjectName).Result;
    }

此解决方案工作正常,但是如果我创建一个新的工作项,则由用户名"创建.但是我想由非个性化用户创建工作项,因此,如果我查看TFS中的工作项,我希望看到第二用户"作为创建者.

This solution is working fine, but if i create a new workitem, that is created by "username". But i want to create workitems by impersonalized users, so i want to see "seconduser" as the creator if i look at the workitem in TFS.

我在谷歌上搜索了很多东西,但是找不到一个例子....

I was googling a lot but can't find an example....

VSTS更新:

尝试实施后,我发现了这一点:

After trying to implement i have found this:

出于安全原因(以及合规性和其他许多原因),Visual Studio Online不支持模拟标头"

"For security reasons (and compliance and a number of other reasons), the impersonation header isn't supported on Visual Studio Online"

奇怪的是,该错误消息当前具有误导性,它告诉我,在VSTS中实际上禁用了整个模拟功能的同时,我需要特殊权限.

A strange thing is that the error message currently misleading, it tells me that I need the special permission while the whole impersonation feature is actually disabled in VSTS.

推荐答案

根据VS Team Services和TFS的REST API参考,目前没有类似于TFS模拟的REST API.由于.net API仍可与VSTS一起使用以实现大多数功能(不支持vNext构建等),因此您可以将.net api作为替代方案.

According to REST API Reference for VS Team Services and TFS, there is no REST API similar to TFS Impersonation right now. As the .net api still works with VSTS for most features (not support vNext build, etc), you can take the .net api as an alternative.

这篇关于通过非个性化进行身份验证(Team Foundation Server)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆