1
0
Форкнуть 0
- [x] Change all text, strings, and other resources which refer to Visual Studio Team Services [VSTS] to refer to Azure DevOps instead.
- [x] Change the VisualStudioTeamServices namespace and type names from Visual Studio Team Services / VSTS to Azure DevOps.
- [x] Change the VisualStudioTeamServices named projects to AzureDevops. Update all solution and cross-project references to accomodate for the changes.
- [x] Change the VisualStudioTeamServices named projects to AzureDevops. Update all solution and cross-project references to accomodate for the changes.
- [x] Move all files from 'VisualStudioTeamServices' into 'AzureDevOps' folders.
- [x] Update all solution and project references.
- [x] Update test data to use the new "Devops" name.
- [x] Since users won't be ready to update their branded configuration values, we need to retain support for the VSTS branded options; which emitting a warning for the deprecated option usage.
This commit is contained in:
J Wyman 2018-09-12 14:44:09 -04:00
Родитель 7d49e3bbfa
Коммит 69db585b2d
80 изменённых файлов: 623 добавлений и 265 удалений

Просмотреть файл

@ -5,8 +5,8 @@
<PropertyGroup>
<ProjectGuid>{04151231-4FA4-49B2-AE6D-EBDBA36B1169}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VisualStudioTeamServices.Authentication.Test</RootNamespace>
<AssemblyName>VisualStudioTeamServices.Authentication.Proxy</AssemblyName>
<RootNamespace>AzureDevOps.Authentication.Test</RootNamespace>
<AssemblyName>AzureDevOps.Authentication.Proxy</AssemblyName>
<NuGetPackageImportStamp />
</PropertyGroup>
<Import Project="..\..\Proxy.props" />
@ -19,9 +19,9 @@
<Project>{19770407-b493-459d-bb4f-04fbefb1ba13}</Project>
<Name>Microsoft.Alm.Authentication</Name>
</ProjectReference>
<ProjectReference Include="..\Src\VisualStudioTeamServices.Authentication.csproj">
<ProjectReference Include="..\Src\AzureDevOps.Authentication.csproj">
<Project>{19770407-d7d8-4a37-914c-f552ff4b90d4}</Project>
<Name>VisualStudioTeamServices.Authentication</Name>
<Name>AzureDevOps.Authentication</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -29,7 +29,7 @@ using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
using Microsoft.Alm.Authentication.Test;
namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
public class CaptureAdal : IAdal, ICaptureService<CapturedAdalData>
{

Просмотреть файл

@ -27,7 +27,7 @@ using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay, nq}")]
public struct CapturedAdalData

Просмотреть файл

@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("VisualStudioTeamServices.Proxy")]
[assembly: AssemblyTitle("AzureDevOps.Authentication.Proxy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VisualStudioTeamServices.Proxy")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyProduct("AzureDevOps.Authentication.Proxy")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Просмотреть файл

@ -30,7 +30,7 @@ using Microsoft.Alm.Authentication;
using Microsoft.Alm.Authentication.Test;
using static System.StringComparer;
namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
public class ReplayAdal : IAdal, IReplayService<CapturedAdalData>
{

Просмотреть файл

@ -26,7 +26,7 @@
using System.Runtime.CompilerServices;
using Microsoft.Alm.Authentication.Test;
namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
public class UnitTestBase : Microsoft.Alm.Authentication.Test.UnitTestBase
{

Просмотреть файл

@ -27,7 +27,7 @@ using System;
using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
/// <summary>
/// Facilitates Azure Directory authentication.
@ -54,12 +54,12 @@ namespace VisualStudioTeamServices.Authentication
{
if (tenantId == Guid.Empty)
{
Authority = new Authority(context, VisualStudioTeamServices.Authentication.Authority.DefaultAuthorityHostUrl);
Authority = new Authority(context, AzureDevOps.Authentication.Authority.DefaultAuthorityHostUrl);
}
else
{
// Create an authority host URL in the format of https://login.microsoft.com/12345678-9ABC-DEF0-1234-56789ABCDEF0.
string authorityHost = VisualStudioTeamServices.Authentication.Authority.GetAuthorityUrl(tenantId);
string authorityHost = AzureDevOps.Authentication.Authority.GetAuthorityUrl(tenantId);
Authority = new Authority(context, authorityHost);
}
}
@ -70,22 +70,22 @@ namespace VisualStudioTeamServices.Authentication
internal AadAuthentication(
RuntimeContext context,
ICredentialStore personalAccessTokenStore,
ITokenStore vstsIdeTokenCache,
IAuthority vstsAuthority)
ITokenStore vsIdeTokenCache,
IAuthority devopsAuthority)
: base(context,
personalAccessTokenStore,
vstsIdeTokenCache,
vstsAuthority)
vsIdeTokenCache,
devopsAuthority)
{ }
/// <summary>
/// Creates an interactive logon session, using ADAL secure browser GUI, which enables users to authenticate with the Azure tenant and acquire the necessary access tokens to exchange for a VSTS personal access token.
/// Creates an interactive logon session, using ADAL secure browser GUI, which enables users to authenticate with the Azure tenant and acquire the necessary access tokens to exchange for an Azure DevOps Services personal access token.
/// <para/>
/// Tokens acquired are stored in the secure secret stores provided during initialization.
/// <para/>
/// Return a `<see cref="Credential"/>` for resource access if successful; otherwise `<see langword="null"/>`.
/// </summary>
/// <param name="targetUri">The URI of the VSTS resource.</param>
/// <param name="targetUri">The URI of the Azure DevOps resource.</param>
public async Task<Credential> InteractiveLogon(TargetUri targetUri, PersonalAccessTokenOptions options)
{
BaseSecureStore.ValidateTargetUri(targetUri);
@ -110,13 +110,13 @@ namespace VisualStudioTeamServices.Authentication
}
/// <summary>
/// Creates an interactive logon session, using ADAL secure browser GUI, which enables users to authenticate with the Azure tenant and acquire the necessary access tokens to exchange for a VSTS personal access token.
/// Creates an interactive logon session, using ADAL secure browser GUI, which enables users to authenticate with the Azure tenant and acquire the necessary access tokens to exchange for an Azure DevOps personal access token.
/// <para/>
/// Tokens acquired are stored in the secure secret stores provided during initialization.
/// <para/>
/// Return a `<see cref="Credential"/>` for resource access if successful; otherwise `<see langword="null"/>`.
/// </summary>
/// <param name="targetUri">The URI of the VSTS resource.</param>
/// <param name="targetUri">The URI of the Azure DevOps resource.</param>
/// <param name="requestCompactToken">
/// Requests a compact format personal access token if `<see langword="true"/>`; otherwise requests a standard format personal access token.
/// <para/>
@ -147,14 +147,14 @@ namespace VisualStudioTeamServices.Authentication
}
/// <summary>
/// Uses Active Directory Federation Services to authenticate with the Azure tenant non-interactively and acquire the necessary access tokens to exchange for a VSTS personal access token.
/// Uses Active Directory Federation Services to authenticate with the Azure tenant non-interactively and acquire the necessary access tokens to exchange for an Azure DevOps personal access token.
/// <para/>
/// Tokens acquired are stored in the secure secret stores provided during initialization.
/// <para/>
/// Return a `<see cref="Credential"/>` for resource access if successful; otherwise `<see langword="null"/>`.
/// </summary>
/// <param name="targetUri">The URL of the VSTS resource.</param>
/// <param name="options">Options related to VSTS personal access creation.</param>
/// <param name="targetUri">The URL of the Azure DevOps resource.</param>
/// <param name="options">Options related to Azure DevOps personal access creation.</param>
public async Task<Credential> NoninteractiveLogon(TargetUri targetUri, PersonalAccessTokenOptions options)
{
BaseSecureStore.ValidateTargetUri(targetUri);
@ -171,7 +171,7 @@ namespace VisualStudioTeamServices.Authentication
}
catch (AuthenticationException)
{
Trace.WriteLine($"failed to acquire for '{targetUri}' token from VstsAuthority.");
Trace.WriteLine($"failed to acquire for '{targetUri}' token from Azure DevOps Authority.");
}
Trace.WriteLine($"non-interactive logon for '{targetUri}' failed");
@ -179,13 +179,13 @@ namespace VisualStudioTeamServices.Authentication
}
/// <summary>
/// Uses Active Directory Federation Services to authenticate with the Azure tenant non-interactively and acquire the necessary access tokens to exchange for a VSTS personal access token.
/// Uses Active Directory Federation Services to authenticate with the Azure tenant non-interactively and acquire the necessary access tokens to exchange for an Azure DevOps Services personal access token.
/// <para/>
/// Tokens acquired are stored in the secure secret stores provided during initialization.
/// <para/>
/// Return a `<see cref="Credential"/>` for resource access if successful; otherwise `<see langword="null"/>`.
/// </summary>
/// <param name="targetUri">The URL of the VSTS resource.</param>
/// <param name="targetUri">The URL of the Azure DevOps resource.</param>
/// <param name="requestCompactToken">
/// Requests a compact format personal access token if `<see langword="true"/>`; otherwise requests a standard format personal access token.
/// <para/>
@ -208,7 +208,7 @@ namespace VisualStudioTeamServices.Authentication
}
catch (AuthenticationException)
{
Trace.WriteLine($"failed to acquire for '{targetUri}' token from VstsAuthority.");
Trace.WriteLine($"failed to acquire for '{targetUri}' token from Azure DevOps Authority.");
}
Trace.WriteLine($"non-interactive logon for '{targetUri}' failed");

Просмотреть файл

@ -29,7 +29,7 @@ using ActiveDirectory = Microsoft.IdentityModel.Clients.ActiveDirectory;
using AdalExtentions = Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContextIntegratedAuthExtensions;
using Alm = Microsoft.Alm.Authentication;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
public interface IAdal : Alm.IRuntimeService
{

Просмотреть файл

@ -30,7 +30,7 @@ using System.Security.Cryptography;
using Microsoft.Alm.Authentication;
using ActiveDirectory = Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
internal class AdalTokenCache : ActiveDirectory.TokenCache
{

Просмотреть файл

@ -33,12 +33,12 @@ using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
using static System.StringComparer;
using static VisualStudioTeamServices.Authentication.Authority;
using static AzureDevOps.Authentication.Authority;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
/// <summary>
/// Base functionality for performing authentication operations against Visual Studio Online.
/// Base functionality for performing authentication operations against Azure DevOps.
/// </summary>
public abstract class Authentication : BaseAuthentication
{
@ -48,8 +48,8 @@ namespace VisualStudioTeamServices.Authentication
protected const string AdalRefreshPrefix = "ada";
internal const string AzureBaseUrlHost = VisualStudioTeamServices.Authentication.Authority.AzureBaseUrlHost;
internal const string VstsBaseUrlHost = VisualStudioTeamServices.Authentication.Authority.VstsBaseUrlHost;
internal const string AzureBaseUrlHost = AzureDevOps.Authentication.Authority.AzureBaseUrlHost;
internal const string VstsBaseUrlHost = AzureDevOps.Authentication.Authority.VstsBaseUrlHost;
private const char CachePairSeperator = '=';
private const char CachePairTerminator = '\0';
@ -161,7 +161,7 @@ namespace VisualStudioTeamServices.Authentication
/// <summary>
/// Detects the backing authority of the end-point.
/// <para/>
/// Returns `<see langword="true"/>` if the authority is Visual Studio Online, along with the tenant identity; `<see langword="false"/>` otherwise.
/// Returns `<see langword="true"/>` if the authority is Azure DevOps, along with the tenant identity; `<see langword="false"/>` otherwise.
/// </summary>
/// <param name="targetUri">The resource which the authority protects.</param>
/// <param name="tenantId">The identity of the authority tenant; `<see cref="Guid.Empty"/>` otherwise.</param>
@ -170,14 +170,14 @@ namespace VisualStudioTeamServices.Authentication
public static async Task<Guid?> DetectAuthority(RuntimeContext context, TargetUri targetUri)
{
const int GuidStringLength = 36;
const string VstsResourceTenantHeader = "X-VSS-ResourceTenant";
const string XvssResourceTenantHeader = "X-VSS-ResourceTenant";
if (context is null)
throw new ArgumentNullException(nameof(context));
if (targetUri is null)
throw new ArgumentNullException(nameof(targetUri));
// Assume VSTS using Azure "common tenant" (empty GUID).
// Assume Azure DevOps using Azure "common tenant" (empty GUID).
var tenantId = Guid.Empty;
// Compose the request Uri, by default it is the target Uri.
@ -202,7 +202,7 @@ namespace VisualStudioTeamServices.Authentication
// Check the cache for an existing value.
if (cache.TryGetValue(requestUrl, out tenantId))
{
context.Trace.WriteLine($"'{requestUrl}' is VSTS, tenant resource is {{{tenantId.ToString("N")}}}.");
context.Trace.WriteLine($"'{requestUrl}' is Azure DevOps, tenant resource is {{{tenantId.ToString("N")}}}.");
return tenantId;
}
@ -215,15 +215,15 @@ namespace VisualStudioTeamServices.Authentication
try
{
// Query the host use the response headers to determine if the host is VSTS or not.
// Query the host use the response headers to determine if the host is Azure DevOps or not.
using (var response = await context.Network.HttpHeadAsync(requestUri, options))
{
if (response.Headers != null)
{
// If the "X-VSS-ResourceTenant" was returned, then it is VSTS and we'll need it's value.
if (response.Headers.TryGetValues(VstsResourceTenantHeader, out IEnumerable<string> values))
// If the "X-VSS-ResourceTenant" was returned, then it is Azure DevOps and we'll need it's value.
if (response.Headers.TryGetValues(XvssResourceTenantHeader, out IEnumerable<string> values))
{
context.Trace.WriteLine($"detected '{requestUrl}' as VSTS from GET response.");
context.Trace.WriteLine($"detected '{requestUrl}' as Azure DevOps from GET response.");
// The "Www-Authenticate" is a more reliable header, because it indicates the
// authentication scheme that should be used to access the requested entity.
@ -293,7 +293,7 @@ namespace VisualStudioTeamServices.Authentication
context.Trace.WriteLine($"tenant resource for '{requestUrl}' is {{{tenantId.ToString("N")}}}.");
// Return the tenant identity to the caller because this is VSTS.
// Return the tenant identity to the caller because this is Azure DevOps.
return tenantId;
}
}
@ -521,7 +521,7 @@ namespace VisualStudioTeamServices.Authentication
// When the full path is specified, there's no reason to assume the path; otherwise attempt to
// detect the actual target path information.
string targetUrl = (IsVstsUrl(targetUri) && !targetUri.HasPath)
string targetUrl = (IsAzureDevOpsUrl(targetUri) && !targetUri.HasPath)
? GetTargetUrl(targetUri, true)
: targetUri.ToString(true, true, true);

Просмотреть файл

@ -26,7 +26,7 @@
using System;
using System.Runtime.Serialization;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
[Serializable]
public class AuthenticationException : Exception

Просмотреть файл

@ -34,7 +34,7 @@ using Microsoft.Alm.Authentication;
using static System.StringComparer;
using Culture = System.Globalization.CultureInfo;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
/// <summary>
/// Interfaces with Azure to perform authentication and identity services.
@ -57,7 +57,7 @@ namespace VisualStudioTeamServices.Authentication
public const string DefaultAuthorityHostUrl = AuthorityHostUrlBase + "/common";
/// <summary>
/// The root domain of VSTS hosted repositories.
/// The root domain of Azure DevOps hosted repositories.
/// </summary>
public const string VstsBaseUrlHost = "visualstudio.com";
@ -259,7 +259,7 @@ namespace VisualStudioTeamServices.Authentication
try
{
// Create an request to the VSTS deployment data end-point.
// Create an request to the Azure DevOps deployment data end-point.
var requestUri = GetConnectionDataUri(targetUri);
var options = new NetworkRequestOptions(true)
{
@ -325,14 +325,14 @@ namespace VisualStudioTeamServices.Authentication
internal static TargetUri GetConnectionDataUri(TargetUri targetUri)
{
const string VstsValidationUrlPath = "_apis/connectiondata";
const string AzureDevOpsValidationUrlPath = "_apis/connectiondata";
if (targetUri is null)
throw new ArgumentNullException(nameof(targetUri));
// Create a URL to the connection data end-point, it's deployment level and "always on".
string requestUrl = GetTargetUrl(targetUri, false);
string validationUrl = requestUrl + VstsValidationUrlPath;
string validationUrl = requestUrl + AzureDevOpsValidationUrlPath;
return targetUri.CreateWith(validationUrl);
}
@ -417,7 +417,7 @@ namespace VisualStudioTeamServices.Authentication
return requestUrl;
}
internal static bool IsVstsUrl(TargetUri targetUri)
internal static bool IsAzureDevOpsUrl(TargetUri targetUri)
{
return (OrdinalIgnoreCase.Equals(targetUri.Scheme, Uri.UriSchemeHttp)
|| OrdinalIgnoreCase.Equals(targetUri.Scheme, Uri.UriSchemeHttps))
@ -435,7 +435,7 @@ namespace VisualStudioTeamServices.Authentication
if (secret is null)
return false;
// Create an request to the VSTS deployment data end-point.
// Create an request to the Azure DevOps deployment data end-point.
var requestUri = GetConnectionDataUri(targetUri);
var options = new NetworkRequestOptions(true)
{

Просмотреть файл

@ -4,12 +4,12 @@
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<AppDesignerFolder>Properties</AppDesignerFolder>
<AssemblyName>VisualStudioTeamServices.Authentication</AssemblyName>
<NuGetPackageImportStamp/>
<AssemblyName>AzureDevOps.Authentication</AssemblyName>
<NuGetPackageImportStamp />
<OutputType>Library</OutputType>
<ProjectGuid>{19770407-D7D8-4A37-914C-F552FF4B90D4}</ProjectGuid>
<ProjectName>VisualStudioTeamServices.Authentication</ProjectName>
<RootNamespace>VisualStudioTeamServices.Authentication</RootNamespace>
<ProjectName>AzureDevOps.Authentication</ProjectName>
<RootNamespace>AzureDevOps.Authentication</RootNamespace>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<Import Project="..\..\build.props" />

Просмотреть файл

@ -25,7 +25,7 @@
using Microsoft.Alm.Authentication;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
public abstract class Base : Microsoft.Alm.Authentication.Base
{

Просмотреть файл

@ -27,28 +27,28 @@ using System;
using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
public interface IAadAuthentication
{
/// <summary>
/// Creates an interactive logon session, using ADAL secure browser GUI, which enables users to authenticate with the Azure tenant and acquire the necessary access tokens to exchange for a VSTS personal access token.
/// Creates an interactive logon session, using ADAL secure browser GUI, which enables users to authenticate with the Azure tenant and acquire the necessary access tokens to exchange for an Azure DevOps personal access token.
/// <para/>
/// Tokens acquired are stored in the secure secret stores provided during initialization.
/// <para/>
/// Return a `<see cref="Credential"/>` for resource access if successful; otherwise `<see langword="null"/>`.
/// </summary>
/// <param name="targetUri">The URI of the VSTS resource.</param>
/// <param name="targetUri">The URI of the Azure DevOps resource.</param>
Task<Credential> InteractiveLogon(TargetUri targetUri, PersonalAccessTokenOptions options);
/// <summary>
/// Creates an interactive logon session, using ADAL secure browser GUI, which enables users to authenticate with the Azure tenant and acquire the necessary access tokens to exchange for a VSTS personal access token.
/// Creates an interactive logon session, using ADAL secure browser GUI, which enables users to authenticate with the Azure tenant and acquire the necessary access tokens to exchange for an Azure DevOps personal access token.
/// <para/>
/// Tokens acquired are stored in the secure secret stores provided during initialization.
/// <para/>
/// Return a `<see cref="Credential"/>` for resource access if successful; otherwise `<see langword="null"/>`.
/// </summary>
/// <param name="targetUri">The URI of the VSTS resource.</param>
/// <param name="targetUri">The URI of the Azure DevOps resource.</param>
/// <param name="requestCompactToken">
/// Requests a compact format personal access token if `<see langword="true"/>`; otherwise requests a standard format personal access token.
/// <para/>
@ -58,24 +58,24 @@ namespace VisualStudioTeamServices.Authentication
Task<Credential> InteractiveLogon(TargetUri targetUri, bool requestCompactToken);
/// <summary>
/// Uses Active Directory Federation Services to authenticate with the Azure tenant non-interactively and acquire the necessary access tokens to exchange for a VSTS personal access token.
/// Uses Active Directory Federation Services to authenticate with the Azure tenant non-interactively and acquire the necessary access tokens to exchange for an Azure DevOps personal access token.
/// <para/>
/// Tokens acquired are stored in the secure secret stores provided during initialization.
/// <para/>
/// Return a `<see cref="Credential"/>` for resource access if successful; otherwise `<see langword="null"/>`.
/// </summary>
/// <param name="targetUri">The URL of the VSTS resource.</param>
/// <param name="options">Options related to VSTS personal access creation.</param>
/// <param name="targetUri">The URL of the Azure DevOps resource.</param>
/// <param name="options">Options related to Azure DevOps personal access creation.</param>
Task<Credential> NoninteractiveLogon(TargetUri targetUri, PersonalAccessTokenOptions options);
/// <summary>
/// Uses Active Directory Federation Services to authenticate with the Azure tenant non-interactively and acquire the necessary access tokens to exchange for a VSTS personal access token.
/// Uses Active Directory Federation Services to authenticate with the Azure tenant non-interactively and acquire the necessary access tokens to exchange for an Azure DevOps personal access token.
/// <para/>
/// Tokens acquired are stored in the secure secret stores provided during initialization.
/// <para/>
/// Return a `<see cref="Credential"/>` for resource access if successful; otherwise `<see langword="null"/>`.
/// </summary>
/// <param name="targetUri">The URL of the VSTS resource.</param>
/// <param name="targetUri">The URL of the Azure DevOps resource.</param>
/// <param name="requestCompactToken">
/// Requests a compact format personal access token if `<see langword="true"/>`; otherwise requests a standard format personal access token.
/// <para/>

Просмотреть файл

@ -27,12 +27,12 @@ using System;
using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
public interface IAuthority
{
/// <summary>
/// Generates a personal access token for use with Visual Studio Team Services.
/// Generates a personal access token for use with Azure DevOps.
/// <para/>
/// Returns the acquired `<seealso cref="Token"/>` if successful; otherwise `<see langword="null"/>`;
/// </summary>
@ -48,7 +48,7 @@ namespace VisualStudioTeamServices.Authentication
Task<Token> GeneratePersonalAccessToken(TargetUri targetUri, Token accessToken, TokenScope tokenScope, bool requireCompactToken, TimeSpan? tokenDuration);
/// <summary>
/// Generates a personal access token for use with Visual Studio Team Services.
/// Generates a personal access token for use with Azure DevOps.
/// <para/>
/// Returns the acquired `<seealso cref="Token"/>` if successful; otherwise `<see langword="null"/>`;
/// </summary>
@ -82,21 +82,21 @@ namespace VisualStudioTeamServices.Authentication
Task<Token> NoninteractiveAcquireToken(TargetUri targetUri, string clientId, string resource, Uri redirectUri);
/// <summary>
/// Validates that a `<see cref="Credential"/>` is valid to grant access to the VSTS resource referenced by `<paramref name="targetUri"/>`.
/// Validates that a `<see cref="Credential"/>` is valid to grant access to the Azure DevOps resource referenced by `<paramref name="targetUri"/>`.
/// <para/>
/// Returns `<see langword="true"/>` if successful; otherwise `<see langword="false"/>`.
/// </summary>
/// <param name="targetUri">URI of the VSTS resource.</param>
/// <param name="credentials">`<see cref="Credential"/>` expected to grant access to the VSTS service.</param>
/// <param name="credentials">`<see cref="Credential"/>` expected to grant access to the Azure DevOps service.</param>
Task<bool> ValidateCredentials(TargetUri targetUri, Credential credentials);
/// <summary>
/// Validates that a `<see cref="Token"/>` is valid to grant access to the VSTS resource referenced by `<paramref name="targetUri"/>`.
/// Validates that a `<see cref="Token"/>` is valid to grant access to the Azure DevOps resource referenced by `<paramref name="targetUri"/>`.
/// <para/>
/// Returns `<see langword="true"/>` if successful; otherwise `<see langword="false"/>`.
/// </summary>
/// <param name="targetUri">URI of the VSTS resource.</param>
/// <param name="token">`<see cref="Token"/>` expected to grant access to the VSTS resource.</param>
/// <param name="targetUri">URI of the Azure DevOps resource.</param>
/// <param name="token">`<see cref="Token"/>` expected to grant access to the Azure DevOps resource.</param>
Task<bool> ValidateToken(TargetUri targetUri, Token token);
}
}

Просмотреть файл

@ -26,7 +26,7 @@
using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
public interface IMsaAuthentication
{

Просмотреть файл

@ -25,7 +25,7 @@
using System;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
[Serializable]
public sealed class LocationServiceException : Exception, System.Runtime.Serialization.ISerializable

Просмотреть файл

@ -28,12 +28,12 @@ using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
public sealed class MsaAuthentication : Authentication, IMsaAuthentication
{
public const string DefaultAuthorityHost = VisualStudioTeamServices.Authentication.Authority.AuthorityHostUrlBase + "/live.com";
public const string DefaultAuthorityHost = AzureDevOps.Authentication.Authority.AuthorityHostUrlBase + "/live.com";
internal const string QueryParameters = "domain_hint=live.com&display=popup&site_id=501454&nux=1";
public MsaAuthentication(

Просмотреть файл

@ -26,7 +26,7 @@
using System;
using System.Diagnostics;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
[DebuggerDisplay("{DebuggerDisplay, nq}")]
public struct PersonalAccessTokenOptions
@ -92,7 +92,7 @@ namespace VisualStudioTeamServices.Authentication
internal string DebuggerDisplay
{
get { return $"{nameof(VisualStudioTeamServices.Authentication.TokenScope)}: {(_compact ? "Compact" : "Normal")} {((_scope == null) ? "Default" : _scope.Value)} [{(_duration.HasValue ? _duration.Value.ToString("u") : "Default")}]"; }
get { return $"{nameof(AzureDevOps.Authentication.TokenScope)}: {(_compact ? "Compact" : "Normal")} {((_scope == null) ? "Default" : _scope.Value)} [{(_duration.HasValue ? _duration.Value.ToString("u") : "Default")}]"; }
}
public override bool Equals(object obj)

Просмотреть файл

@ -3,8 +3,8 @@ using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Visual Studio Team Services Authentication")]
[assembly: AssemblyDescription("Microsoft Visual Studio Team Services Authentication Library for Windows")]
[assembly: AssemblyTitle("Azure DevOps Authentication")]
[assembly: AssemblyDescription("Microsoft Azure DevOps Authentication Library for Windows")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("https://github.com/Microsoft/Git-Credential-Manager-for-Windows")]
@ -19,6 +19,6 @@ using System.Runtime.InteropServices;
// Only expose internals when the binary isn't signed.
#if !SIGNED
[assembly: InternalsVisibleTo("VisualStudioTeamServices.Authentication.Proxy")]
[assembly: InternalsVisibleTo("VisualStudioTeamServices.Authentication.Test")]
[assembly: InternalsVisibleTo("AzureDevOps.Authentication.Proxy")]
[assembly: InternalsVisibleTo("AzureDevOps.Authentication.Test")]
#endif

Просмотреть файл

@ -31,7 +31,7 @@ using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
using Microsoft.Win32;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
/// <summary>
/// A token storage object which interacts with the current user's Visual Studio 2015 hive in the Windows Registry.

Просмотреть файл

@ -29,7 +29,7 @@ using System.Linq;
using System.Runtime.CompilerServices;
using ScopeSet = System.Collections.Generic.HashSet<string>;
namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
public class TokenScope : Microsoft.Alm.Authentication.TokenScope
{
@ -217,11 +217,11 @@ namespace VisualStudioTeamServices.Authentication
public bool Equals(TokenScope other)
=> Microsoft.Alm.Authentication.TokenScope.Equals(this as Microsoft.Alm.Authentication.TokenScope, other as Microsoft.Alm.Authentication.TokenScope);
public static bool Find(string value, out TokenScope vstsScope)
public static bool Find(string value, out TokenScope devopsScope)
{
vstsScope = EnumerateValues().FirstOrDefault(v => StringComparer.OrdinalIgnoreCase.Equals(v.Value, value));
devopsScope = EnumerateValues().FirstOrDefault(v => StringComparer.OrdinalIgnoreCase.Equals(v.Value, value));
return vstsScope != null;
return devopsScope != null;
}
public override int GetHashCode()

Просмотреть файл

@ -27,7 +27,7 @@ using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
using Xunit;
namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
public class AadTests : AuthenticationTests
{
@ -39,7 +39,7 @@ namespace VisualStudioTeamServices.Authentication.Test
public async Task VstsAadDeleteCredentialsTest()
{
TargetUri targetUri = DefaultTargetUri;
AadAuthentication aadAuthentication = GetVstsAadAuthentication(RuntimeContext.Default, "aad-delete");
AadAuthentication aadAuthentication = GetDevOpsAadAuthentication(RuntimeContext.Default, "aad-delete");
if (aadAuthentication.Authority is AuthorityFake fake)
{
@ -59,7 +59,7 @@ namespace VisualStudioTeamServices.Authentication.Test
public async Task VstsAadGetCredentialsTest()
{
TargetUri targetUri = DefaultTargetUri;
AadAuthentication aadAuthentication = GetVstsAadAuthentication(RuntimeContext.Default, "aad-get");
AadAuthentication aadAuthentication = GetDevOpsAadAuthentication(RuntimeContext.Default, "aad-get");
Assert.Null(await aadAuthentication.GetCredentials(targetUri));
@ -72,7 +72,7 @@ namespace VisualStudioTeamServices.Authentication.Test
public async Task VstsAadInteractiveLogonTest()
{
TargetUri targetUri = DefaultTargetUri;
AadAuthentication aadAuthentication = GetVstsAadAuthentication(RuntimeContext.Default, "aad-logon");
AadAuthentication aadAuthentication = GetDevOpsAadAuthentication(RuntimeContext.Default, "aad-logon");
Assert.Null(await aadAuthentication.PersonalAccessTokenStore.ReadCredentials(targetUri));
@ -85,7 +85,7 @@ namespace VisualStudioTeamServices.Authentication.Test
public async Task VstsAadNoninteractiveLogonTest()
{
TargetUri targetUri = DefaultTargetUri;
AadAuthentication aadAuthentication = GetVstsAadAuthentication(RuntimeContext.Default, "aad-noninteractive");
AadAuthentication aadAuthentication = GetDevOpsAadAuthentication(RuntimeContext.Default, "aad-noninteractive");
Assert.NotNull(await aadAuthentication.NoninteractiveLogon(targetUri, new PersonalAccessTokenOptions { RequireCompactToken = false }));
@ -96,7 +96,7 @@ namespace VisualStudioTeamServices.Authentication.Test
public async Task VstsAadSetCredentialsTest()
{
TargetUri targetUri = DefaultTargetUri;
AadAuthentication aadAuthentication = GetVstsAadAuthentication(RuntimeContext.Default, "aad-set");
AadAuthentication aadAuthentication = GetDevOpsAadAuthentication(RuntimeContext.Default, "aad-set");
Credential credentials = DefaultCredentials;
await aadAuthentication.SetCredentials(targetUri, credentials);
@ -108,7 +108,7 @@ namespace VisualStudioTeamServices.Authentication.Test
[Fact]
public async Task VstsAadValidateCredentialsTest()
{
AadAuthentication aadAuthentication = GetVstsAadAuthentication(RuntimeContext.Default, "aad-validate");
AadAuthentication aadAuthentication = GetDevOpsAadAuthentication(RuntimeContext.Default, "aad-validate");
Credential credentials = null;
Assert.False(await aadAuthentication.ValidateCredentials(DefaultTargetUri, credentials), "Credential validation unexpectedly failed.");
@ -118,14 +118,14 @@ namespace VisualStudioTeamServices.Authentication.Test
Assert.True(await aadAuthentication.ValidateCredentials(DefaultTargetUri, credentials), "Credential validation unexpectedly failed.");
}
private static AadAuthentication GetVstsAadAuthentication(RuntimeContext context, string @namespace)
private static AadAuthentication GetDevOpsAadAuthentication(RuntimeContext context, string @namespace)
{
string expectedQueryParameters = null;
ICredentialStore tokenStore1 = new SecretCache(context, @namespace + 1, Secret.UriToIdentityUrl);
ITokenStore tokenStore2 = new SecretCache(context, @namespace + 2, Secret.UriToIdentityUrl);
IAuthority vstsAuthority = new AuthorityFake(expectedQueryParameters);
return new AadAuthentication(context, tokenStore1, tokenStore2, vstsAuthority);
IAuthority devopsAuthority = new AuthorityFake(expectedQueryParameters);
return new AadAuthentication(context, tokenStore1, tokenStore2, devopsAuthority);
}
}
}

Просмотреть файл

@ -26,7 +26,7 @@
using System.Diagnostics;
using Microsoft.Alm.Authentication;
namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
public abstract class AuthenticationTests
{

Просмотреть файл

@ -28,7 +28,7 @@ using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
using Xunit;
namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
internal class AuthorityFake : IAuthority
{
@ -44,7 +44,7 @@ namespace VisualStudioTeamServices.Authentication.Test
public bool CredentialsAreValid { get; set; }
/// <summary>
/// Generates a personal access token for use with Visual Studio Team Services.
/// Generates a personal access token for use with Azure DevOps.
/// <para/>
/// Returns the acquired token if successful; otherwise <see langword="null"/>;
/// </summary>
@ -63,7 +63,7 @@ namespace VisualStudioTeamServices.Authentication.Test
}
/// <summary>
/// Generates a personal access token for use with Visual Studio Team Services.
/// Generates a personal access token for use with Azure DevOps.
/// <para/>
/// Returns the acquired token if successful; otherwise <see langword="null"/>;
/// </summary>
@ -106,12 +106,12 @@ namespace VisualStudioTeamServices.Authentication.Test
}
/// <summary>
/// Validates that a `<see cref="Credential"/>` is valid to grant access to the VSTS resource referenced by `<paramref name="targetUri"/>`.
/// Validates that a `<see cref="Credential"/>` is valid to grant access to the Azure DevOps resource referenced by `<paramref name="targetUri"/>`.
/// <para/>
/// Returns `<see langword="true"/>` if successful; otherwise `<see langword="false"/>`.
/// </summary>
/// <param name="targetUri">URI of the VSTS resource.</param>
/// <param name="credentials">`<see cref="Credential"/>` expected to grant access to the VSTS service.</param>
/// <param name="targetUri">URI of the Azure DevOps resource.</param>
/// <param name="credentials">`<see cref="Credential"/>` expected to grant access to the Azure DevOps service.</param>
public async Task<bool> ValidateCredentials(TargetUri targetUri, Credential credentials)
{
return await Task.Run(() =>
@ -129,12 +129,12 @@ namespace VisualStudioTeamServices.Authentication.Test
}
/// <summary>
/// Validates that a `<see cref="Token"/>` is valid to grant access to the VSTS resource referenced by `<paramref name="targetUri"/>`.
/// Validates that a `<see cref="Token"/>` is valid to grant access to the Azure DevOps resource referenced by `<paramref name="targetUri"/>`.
/// <para/>
/// Returns `<see langword="true"/>` if successful; otherwise `<see langword="false"/>`.
/// </summary>
/// <param name="targetUri">URI of the VSTS resource.</param>
/// <param name="token">`<see cref="Token"/>` expected to grant access to the VSTS resource.</param>
/// <param name="targetUri">URI of the Azure DevOps resource.</param>
/// <param name="token">`<see cref="Token"/>` expected to grant access to the Azure DevOps resource.</param>
public async Task<bool> ValidateToken(TargetUri targetUri, Token token)
{
return await Task.Run(() =>

Просмотреть файл

@ -30,7 +30,7 @@ using Microsoft.Alm.Authentication;
using Microsoft.Alm.Authentication.Test;
using Xunit;
namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
public class AuthorityTests : UnitTestBase
{

Просмотреть файл

@ -4,13 +4,13 @@
<Import Project="..\..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\..\packages\xunit.core.2.3.1\build\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.3.1\build\xunit.core.props')" />
<PropertyGroup>
<AssemblyName>VisualStudioTeamServices.Authentication.Test</AssemblyName>
<AssemblyName>AzureDevOps.Authentication.Test</AssemblyName>
<AppDesignerFolder>Properties</AppDesignerFolder>
<IsCodedUITest>False</IsCodedUITest>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<ProjectGuid>{19781214-5254-464A-BC69-FAC502046564}</ProjectGuid>
<RootNamespace>VisualStudioTeamServices.Authentication.Test</RootNamespace>
<RootNamespace>AzureDevOps.Authentication.Test</RootNamespace>
</PropertyGroup>
<Import Project="..\..\test.props" />
<ItemGroup>
@ -54,13 +54,13 @@
<Project>{19781214-371f-415c-93c5-44ceaa0e9a34}</Project>
<Name>Microsoft.Alm.Authentication.Test</Name>
</ProjectReference>
<ProjectReference Include="..\Proxy\VisualStudioTeamServices.Authentication.Proxy.csproj">
<ProjectReference Include="..\Proxy\AzureDevOps.Authentication.Proxy.csproj">
<Project>{04151231-4fa4-49b2-ae6d-ebdba36b1169}</Project>
<Name>VisualStudioTeamServices.Authentication.Proxy</Name>
<Name>AzureDevOps.Authentication.Proxy</Name>
</ProjectReference>
<ProjectReference Include="..\Src\VisualStudioTeamServices.Authentication.csproj">
<ProjectReference Include="..\Src\AzureDevOps.Authentication.csproj">
<Project>{19770407-d7d8-4a37-914c-f552ff4b90d4}</Project>
<Name>VisualStudioTeamServices.Authentication</Name>
<Name>AzureDevOps.Authentication</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -27,7 +27,7 @@ using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
using Xunit;
namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
public class MsaTests : AuthenticationTests
{
@ -36,10 +36,10 @@ namespace VisualStudioTeamServices.Authentication.Test
{ }
[Fact]
public async Task VstsMsaDeleteCredentialsTest()
public async Task DevOpsMsaDeleteCredentialsTest()
{
TargetUri targetUri = DefaultTargetUri;
MsaAuthentication msaAuthority = GetVstsMsaAuthentication(RuntimeContext.Default, "msa-delete");
MsaAuthentication msaAuthority = GetDevOpsMsaAuthentication(RuntimeContext.Default, "msa-delete");
if (msaAuthority.Authority is AuthorityFake fake)
{
@ -56,10 +56,10 @@ namespace VisualStudioTeamServices.Authentication.Test
}
[Fact]
public async Task VstsMsaGetCredentialsTest()
public async Task DevOpsMsaGetCredentialsTest()
{
TargetUri targetUri = DefaultTargetUri;
MsaAuthentication msaAuthority = GetVstsMsaAuthentication(RuntimeContext.Default, "msa-get");
MsaAuthentication msaAuthority = GetDevOpsMsaAuthentication(RuntimeContext.Default, "msa-get");
Assert.Null(await msaAuthority.GetCredentials(targetUri));
@ -69,10 +69,10 @@ namespace VisualStudioTeamServices.Authentication.Test
}
[Fact]
public async Task VstsMsaInteractiveLogonTest()
public async Task DevOpsMsaInteractiveLogonTest()
{
TargetUri targetUri = DefaultTargetUri;
MsaAuthentication msaAuthority = GetVstsMsaAuthentication(RuntimeContext.Default, "msa-logon");
MsaAuthentication msaAuthority = GetDevOpsMsaAuthentication(RuntimeContext.Default, "msa-logon");
Assert.Null(await msaAuthority.PersonalAccessTokenStore.ReadCredentials(targetUri));
@ -82,10 +82,10 @@ namespace VisualStudioTeamServices.Authentication.Test
}
[Fact]
public async Task VstsMsaSetCredentialsTest()
public async Task DevOpsMsaSetCredentialsTest()
{
TargetUri targetUri = DefaultTargetUri;
MsaAuthentication msaAuthority = GetVstsMsaAuthentication(RuntimeContext.Default, "msa-set");
MsaAuthentication msaAuthority = GetDevOpsMsaAuthentication(RuntimeContext.Default, "msa-set");
await msaAuthority.SetCredentials(targetUri, DefaultCredentials);
@ -93,9 +93,9 @@ namespace VisualStudioTeamServices.Authentication.Test
}
[Fact]
public async Task VstsMsaValidateCredentialsTest()
public async Task DevOpsMsaValidateCredentialsTest()
{
MsaAuthentication msaAuthority = GetVstsMsaAuthentication(RuntimeContext.Default, "msa-validate");
MsaAuthentication msaAuthority = GetDevOpsMsaAuthentication(RuntimeContext.Default, "msa-validate");
Credential credentials = null;
Assert.False( await msaAuthority.ValidateCredentials(DefaultTargetUri, credentials), "Credential validation unexpectedly failed.");
@ -105,7 +105,7 @@ namespace VisualStudioTeamServices.Authentication.Test
Assert.True(await msaAuthority.ValidateCredentials(DefaultTargetUri, credentials), "Credential validation unexpectedly failed.");
}
private static MsaAuthentication GetVstsMsaAuthentication(RuntimeContext context, string @namespace)
private static MsaAuthentication GetDevOpsMsaAuthentication(RuntimeContext context, string @namespace)
{
ICredentialStore tokenStore1 = new SecretCache(context, @namespace + 1, Secret.UriToIdentityUrl);
ITokenStore tokenStore2 = new SecretCache(context, @namespace + 2, Secret.UriToIdentityUrl);

Просмотреть файл

@ -3,11 +3,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following set of attributes.
// Change these attribute values to modify the information associated with an assembly.
[assembly: AssemblyTitle("VisualStudioTeamServices.Authentication.Test")]
[assembly: AssemblyTitle("AzureDevOps.Authentication.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("VisualStudioTeamServices.Authentication.Test")]
[assembly: AssemblyProduct("AzureDevOps.Authentication.Test")]
[assembly: AssemblyCopyright("Copyright © Microsoft Corporation 2018. All rights reserved.")]
[assembly: AssemblyTrademark("Microsoft Corporation")]
[assembly: AssemblyCulture("")]

Просмотреть файл

@ -26,7 +26,7 @@
using System.Collections.Generic;
using Xunit;
namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
public class TokenScopeTests
{

Просмотреть файл

@ -6,7 +6,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<AssemblyName>git-askpass</AssemblyName>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp/>
<NuGetPackageImportStamp />
<OutputType>Exe</OutputType>
<ProjectGuid>{19770407-B33A-4EBE-92B8-04C93F43CAE0}</ProjectGuid>
<ProjectName>Cli-Askpass</ProjectName>
@ -49,9 +49,9 @@
<Project>{19770407-b493-459d-bb4f-04fbefb1ba13}</Project>
<Name>Microsoft.Alm.Authentication</Name>
</ProjectReference>
<ProjectReference Include="..\..\VisualStudioTeamServices.Authentication\Src\VisualStudioTeamServices.Authentication.csproj">
<ProjectReference Include="..\..\AzureDevops.Authentication\Src\AzureDevops.Authentication.csproj">
<Project>{19770407-d7d8-4a37-914c-f552ff4b90d4}</Project>
<Name>VisualStudioTeamServices.Authentication</Name>
<Name>AzureDevops.Authentication</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@ -65,8 +65,8 @@
<Compile Include="UserPromptKind.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config"/>
<None Include="packages.config"/>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Page Include="UserPromptDialog.xaml">

Просмотреть файл

@ -6,7 +6,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<AssemblyName>git-credential-manager</AssemblyName>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp/>
<NuGetPackageImportStamp />
<OutputType>Exe</OutputType>
<ProjectGuid>{19770407-63D4-40A8-A9DF-F1C4B473308A}</ProjectGuid>
<ProjectName>Cli-Manager</ProjectName>
@ -42,9 +42,9 @@
<Project>{19770407-b493-459d-bb4f-04fbefb1ba13}</Project>
<Name>Microsoft.Alm.Authentication</Name>
</ProjectReference>
<ProjectReference Include="..\..\VisualStudioTeamServices.Authentication\Src\VisualStudioTeamServices.Authentication.csproj">
<ProjectReference Include="..\..\AzureDevops.Authentication\Src\AzureDevops.Authentication.csproj">
<Project>{19770407-d7d8-4a37-914c-f552ff4b90d4}</Project>
<Name>VisualStudioTeamServices.Authentication</Name>
<Name>AzureDevops.Authentication</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -45,16 +45,17 @@ namespace Microsoft.Alm.Cli
private static readonly IReadOnlyList<string> CopyList = new string[]
{
"AzureDevOps.Authentication.dll",
"Bitbucket.Authentication.dll",
"git-askpass.exe",
"git-credential-manager.exe",
"GitHub.Authentication.exe",
"Microsoft.Alm.Authentication.dll",
"Microsoft.IdentityModel.Clients.ActiveDirectory.dll",
"VisualStudioTeamServices.Authentication.dll",
};
private static readonly IReadOnlyList<string> CleanList = new string[]
{
"AzureDevOps.Authentication.dll",
"Bitbucket.Authentication.dll",
"git-askpass.exe",
"git-credential-manager.exe",

Просмотреть файл

@ -239,7 +239,7 @@ namespace Microsoft.Alm.Cli
WriteLine($" UseHttpPath = {operationArguments.UseHttpPath}");
WriteLine($" UseModalUi = {operationArguments.UseModalUi}");
WriteLine($" ValidateCredentials = {operationArguments.ValidateCredentials}");
WriteLine($" VstsTokenScope = {operationArguments.VstsTokenScope}");
WriteLine($" DevOpsTokenScope = {operationArguments.DevOpsTokenScope}");
WriteLine($" WriteLog = {operationArguments.WriteLog}");
}).Wait();
}
@ -295,7 +295,7 @@ namespace Microsoft.Alm.Cli
case AuthorityType.AzureDirectory:
case AuthorityType.MicrosoftAccount:
_context.Trace.WriteLine($"deleting VSTS credentials for '{operationArguments.TargetUri}'.");
_context.Trace.WriteLine($"deleting Azure DevOps credentials for '{operationArguments.TargetUri}'.");
break;
case AuthorityType.GitHub:
@ -519,7 +519,7 @@ namespace Microsoft.Alm.Cli
case AuthorityType.AzureDirectory:
case AuthorityType.MicrosoftAccount:
Trace.WriteLine($"storing VSTS credentials for '{operationArguments.TargetUri}'.");
Trace.WriteLine($"storing Azure DevOps credentials for '{operationArguments.TargetUri}'.");
break;
case AuthorityType.GitHub:

Просмотреть файл

@ -31,11 +31,11 @@ using static System.StringComparer;
namespace Microsoft.Alm.Cli.Test
{
public class VstsLogonTests : VisualStudioTeamServices.Authentication.Test.UnitTestBase
public class AzureDevOpsLogonTests : AzureDevOps.Authentication.Test.UnitTestBase
{
private static readonly Encoding Utf8 = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);
public VstsLogonTests(Xunit.Abstractions.ITestOutputHelper output)
public AzureDevOpsLogonTests(Xunit.Abstractions.ITestOutputHelper output)
: base(XunitHelper.Convert(output))
{ }

Просмотреть файл

@ -57,9 +57,9 @@
<Project>{19781214-fe04-4a05-943a-54eb952cea62}</Project>
<Name>Microsoft.Alm.Authentication.Proxy</Name>
</ProjectReference>
<ProjectReference Include="..\..\VisualStudioTeamServices.Authentication\Proxy\VisualStudioTeamServices.Authentication.Proxy.csproj">
<Project>{19781214-4fa4-49b2-ae6d-ebdba36b1169}</Project>
<Name>VisualStudioTeamServices.Authentication.Proxy</Name>
<ProjectReference Include="..\..\AzureDevops.Authentication\Proxy\AzureDevops.Authentication.Proxy.csproj">
<Project>{04151231-4FA4-49B2-AE6D-EBDBA36B1169}</Project>
<Name>AzureDevops.Authentication.Proxy</Name>
</ProjectReference>
<ProjectReference Include="..\Manager\Cli-Manager.csproj">
<Project>{19770407-63d4-40a8-a9df-f1c4b473308a}</Project>
@ -69,9 +69,9 @@
<Project>{19770407-b493-459d-bb4f-04fbefb1ba13}</Project>
<Name>Microsoft.Alm.Authentication</Name>
</ProjectReference>
<ProjectReference Include="..\..\VisualStudioTeamServices.Authentication\Src\VisualStudioTeamServices.Authentication.csproj">
<ProjectReference Include="..\..\AzureDevops.Authentication\Src\AzureDevops.Authentication.csproj">
<Project>{19770407-d7d8-4a37-914c-f552ff4b90d4}</Project>
<Name>VisualStudioTeamServices.Authentication</Name>
<Name>AzureDevops.Authentication</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@ -83,7 +83,7 @@
<Compile Include="ProgramTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="GithubLogonTests.cs" />
<Compile Include="VstsLogonTests.cs" />
<Compile Include="AzureDevOpsLogonTests.cs" />
<Compile Include="XunitHelper.cs" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -29,9 +29,8 @@ using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
using Moq;
using Xunit;
using Azure = AzureDevOps.Authentication;
using Git = Microsoft.Alm.Authentication.Git;
using Vsts = VisualStudioTeamServices.Authentication;
namespace Microsoft.Alm.Cli.Test
{
@ -97,7 +96,7 @@ namespace Microsoft.Alm.Cli.Test
.Returns(targetUri);
opargsMock.SetupProperty(o => o.UseHttpPath);
opargsMock.SetupProperty(o => o.ValidateCredentials);
opargsMock.SetupProperty(o => o.VstsTokenScope);
opargsMock.SetupProperty(o => o.DevOpsTokenScope);
var opargs = opargsMock.Object;
@ -107,10 +106,10 @@ namespace Microsoft.Alm.Cli.Test
Assert.True(opargs.ValidateCredentials, "credential.validate");
Assert.True(opargs.UseHttpPath, "credential.useHttpPath");
Assert.NotNull(opargs.VstsTokenScope);
Assert.NotNull(opargs.DevOpsTokenScope);
var expectedScope = Vsts.TokenScope.BuildAccess | Vsts.TokenScope.CodeWrite;
Assert.Equal(expectedScope, opargs.VstsTokenScope);
var expectedScope = Azure.TokenScope.BuildAccess | Azure.TokenScope.CodeWrite;
Assert.Equal(expectedScope, opargs.DevOpsTokenScope);
}
public static object[][] TryReadBooleanData

Просмотреть файл

@ -1,7 +1,7 @@
# Git Askpass for Windows
[Git Askpass for Windows](https://github.com/Microsoft/Git-Credential-Manager-for-Windows) (Askpass) provides secure Git credential storage for Windows.
Askpass provides multi-factor authentication support for [Visual Studio Team Services](https://www.visualstudio.com/), [Team Foundation Server](https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx), and [GitHub](https://github.com/).
Askpass provides multi-factor authentication support for [Azure DevOps](https://dev.azure.com/), [Team Foundation Server](https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx), and [GitHub](https://github.com/).
## Usage

Просмотреть файл

@ -5,12 +5,12 @@ While there is detailed documentation on [GCM configuration options](Configurati
_Note:_ SSH is often a better choice for automated system because requiring interactivity is a non-default option, and SSH is known to be secure and reliable.
## Recommendations for VSTS Build Services
## Recommendations for Azure DevOps Build Services
The majority of build definitions will work with a single repository, or at least a set of repositories which all have the same authentication requirements.
In this case, it is generally better to rely on [VSTS Build Variables](https://docs.microsoft.com/en-us/vsts/build-release/concepts/definitions/build/variables?tabs=batch); specifically the `$(System.AccessToken)` build process OAuth token.
In this case, it is generally better to rely on [Azure DevOps Build Variables](https://docs.microsoft.com/en-us/vsts/build-release/concepts/definitions/build/variables?tabs=batch); specifically the `$(System.AccessToken)` build process OAuth token.
To enable scripts to use the build process OAuth token, go to the Options tab of the build definition and select 'Allow Scripts to Access OAuth Token'.
For more information, read [VSTS: Use the OAuth token to access the REST API](https://docs.microsoft.com/en-us/vsts/build-release/actions/scripts/powershell#oauth).
For more information, read [Azure DevOps: Use the OAuth token to access the REST API](https://docs.microsoft.com/en-us/vsts/build-release/actions/scripts/powershell#oauth).
## Recommendations for Other Build Services
@ -22,7 +22,7 @@ git config --global credential.interactive never
Build agents often need to minimize the amount of network traffic they generate.
To avoid Microsoft Account vs. Azure Active Directory look-up against a Visual Studio Team Services \[VSTS\] account use...
To avoid Microsoft Account vs. Azure Active Directory look-up against an Azure DevOps account use...
... for Azure Directory backed authentication:

Просмотреть файл

@ -113,7 +113,7 @@ See [GCM_PRESERVE](Environment.md#gcm_preserve)
### tokenDuration
Sets a duration, in hours, limit for the validity of Personal Access Tokens requested from Visual Studio Team Services [VSTS].
Sets a duration, in hours, limit for the validity of Personal Access Tokens requested from Azure DevOps.
If the value is greater than the maximum duration set for the account, the account value supersedes.
The value cannot be less than a one hour (1).
@ -169,10 +169,10 @@ See [GCM_VALIDATE](Environment.md#gcm_validate)
### vstsScope
Overrides GCM default scope request when generating a Personal Access Token from Visual Studio Team Services [VSTS].
Overrides GCM default scope request when generating a Personal Access Token from Azure DevOps.
The supported format is one or more [scope values](https://docs.microsoft.com/en-us/vsts/integrate/get-started/authentication/oauth#scopes) separated by whitespace, commas, semi-colons, or pipe `'|'` characters.
Defaults to `vso.code_write|vso.packaging`; Honored when host is 'visualstudio.com'.
Defaults to `vso.code_write|vso.packaging`; Honored when host is 'dev.azure.com'.
```shell
git config --global credential.microsoft.visualstudio.com.vstsScope vso.code_write|vso.packaging_write|vso.test_write

Просмотреть файл

@ -1,7 +1,7 @@
# Git Credential Manager for Windows
The [Git Credential Manager for Windows](https://github.com/Microsoft/Git-Credential-Manager-for-Windows) (GCM) provides secure Git credential storage for Windows.
GCM provides multi-factor authentication support for [Visual Studio Team Services](https://www.visualstudio.com/), [Team Foundation Server](https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx), [GitHub](https://github.com/), and [BitBucket](https://bitbucket.org).
GCM provides multi-factor authentication support for [Azure DevOps](https://dev.azure.com/), [Team Foundation Server](https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx), [GitHub](https://github.com/), and [BitBucket](https://bitbucket.org).
## Usage

Просмотреть файл

@ -97,7 +97,7 @@ See [credential.preserve](Configuration.md#preserve).
### GCM_TOKEN_DURATION
Sets a duration, in hours, limit for the validity of Personal Access Tokens requested from Visual Studio Team Services [VSTS].
Sets a duration, in hours, limit for the validity of Personal Access Tokens requested from Azure DevOps.
If the value is greater than the maximum duration set for the account, the account value supersedes. The value cannot be less than a one hour (1).
@ -137,7 +137,7 @@ See [credential.validate](Configuration.md#validate).
### GCM_VSTS_SCOPE
Overrides GCM default scope request when generating a Personal Access Token from Visual Studio Team Services [VSTS].
Overrides GCM default scope request when generating a Personal Access Token from Azure DevOps.
The supported format is one or more [scope values](https://docs.microsoft.com/en-us/vsts/integrate/get-started/authentication/oauth#scopes) separated by whitespace, commas, semi-colons, or pipe characters (`' '`, `','`, `';'`, `'|'`).
Defaults to `vso.code_write|vso.packaging`; Honored when host is 'visualstudio.com'.

Просмотреть файл

@ -39,7 +39,7 @@ If you're looking to extend the GCM, or need a way to authenticate with VSTS but
The Git Credential Manager does not work on Windows XP, Max OS, or Linux because we had to scope our work and we decided to support the same operating systems that Visual Studio support.
Why Visual Studio?
Well, because it is our favorite IDE and in order to support [Visual Studio Team Services](https://www.visualstudio.com/en-us/products/visual-studio-team-services-vs.aspx) we had to use the [Azure Directory Authentication Libraries](https://github.com/AzureAD) which only have multi-factor interactive logon support in their .NET libraries.
Well, because it is our favorite IDE and in order to support [Azure DevOps](https://www.visualstudio.com/en-us/products/visual-studio-team-services-vs.aspx) we had to use the [Azure Directory Authentication Libraries](https://github.com/AzureAD) which only have multi-factor interactive logon support in their .NET libraries.
Using .NET means using Visual Studio (which we love anyways) and using Visual Studio means Windows 7 or newer.
## Q: Will there ever be support for Windows XP, Mac OS, or Linux?
@ -94,11 +94,11 @@ This works in v1.8.3.0 of SourceTree.
Check that you are using the HTTP(S) URL instead of the SSH URL for your repository.
You can do this by running `git remote show origin`.
The Fetch URL and Push URL should start with `https://` or `http://`.
If this is not the case, look for the HTTP(S) URL in the web interface of VSTS, TFS, GitHub or Bitbucket, and then run `git remote set-url origin <url>`, where `<url>` is the HTTP(S) URL.
If this is not the case, look for the HTTP(S) URL in the web interface of Azure DevOps, TFS, GitHub or Bitbucket, and then run `git remote set-url origin <url>`, where `<url>` is the HTTP(S) URL.
## Q: Why is git.exe failing to authenticate after linking/unlinking your Visual Studio Team Services account from Azure Active Directory?
## Q: Why is git.exe failing to authenticate after linking/unlinking your Azure DevOps account from Azure Active Directory?
When the tenant backing the Visual Studio Team Services (VSTS) account changes like when you [Connect VSTS account to Azure Active Directory (Azure AD)](https://docs.microsoft.com/en-us/vsts/accounts/connect-account-to-aad), the tenant cache needs to be cleared if you're using a GCM version prior to v1.15.0.
When the tenant backing the Azure DevOps account changes like when you [Connect VSTS account to Azure Active Directory (Azure AD)](https://docs.microsoft.com/en-us/vsts/accounts/connect-account-to-aad), the tenant cache needs to be cleared if you're using a GCM version prior to v1.15.0.
Clearing the tenant cache is as easy as deleting the *%LocalAppData%\GitCredentialManager\tenant.cache* file on each machine returning a login error like below.
The GCM will automatically recreate and populate the cache file as needed on subsequent login attempts.

Просмотреть файл

@ -1,15 +1,15 @@
# Git Credential Manager for Windows
The [Git Credential Manager for Windows](https://github.com/Microsoft/Git-Credential-Manager-for-Windows) (GCM) provides secure Git credential storage for Windows.
GCM provides multi-factor authentication support for [Visual Studio Team Services](https://www.visualstudio.com/), [Team Foundation Server](Faq.md#q-i-thought-microsoft-was-maintaining-this-why-does-the-gcm-not-work-as-expected-with-tfs), and [GitHub](https://github.com/).
GCM provides multi-factor authentication support for [Azure DevOps](https://dev.azure.com/), [Team Foundation Server](Faq.md#q-i-thought-microsoft-was-maintaining-this-why-does-the-gcm-not-work-as-expected-with-tfs), and [GitHub](https://github.com/).
This project includes:
* Secure password storage in the Windows Credential Store
* Multi-factor authentication support for Visual Studio Team Services
* Multi-factor authentication support for Azure DevOps
* Two-factor authentication support for GitHub
* Personal Access Token generation and usage support for Visual Studio Team Services and GitHub
* Non-interactive mode support for Visual Studio Team Services backed by Azure Directory
* Personal Access Token generation and usage support for Azure DevOps, GitHub, and Bitbucket
* Non-interactive mode support for Azure DevOps backed by Azure Directory
* Kerberos authentication for Team Foundation Server ([see notes](#q-i-thought-microsoft-was-maintaining-this-why-does-the-gcm-not-work-as-expected-with-tfs))
* Optional settings for build agent optimization
@ -28,7 +28,7 @@ GCM cannot prompt you for credentials, at the console, in a MinTTY setup.
You don't.
It [magically](https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/31) works when credentials are needed.
For example, when pushing to [Visual Studio Team Services](https://www.visualstudio.com), it automatically opens a window and initializes an oauth2 flow to get your token.
For example, when pushing to [Azure DevOps](https://dev.azure.com), it automatically opens a window and initializes an oauth2 flow to get your token.
### Manual Installation

Просмотреть файл

@ -37,7 +37,7 @@
</StackPanel.Resources>
<Button Content="GitHub" Tag="https://github.com" Click="Button_Click"/>
<Button Content="BitBucket" Tag="https://bitbucket.org" Click="Button_Click"/>
<Button Content="VSTS" Tag="https://devdiv.visualstudio.com" Click="Button_Click"/>
<Button Content="Azure DevOps" Tag="https://devdiv.visualstudio.com" Click="Button_Click"/>
<Button Content="Basic" Tag="https://mywebsite.com" Click="Button_Click"/>
<Button Content="Bogus hwnd" Click="BogusHwnd_Click"/>
</StackPanel>

Просмотреть файл

@ -24,7 +24,7 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.Alm.Win32", "Shar
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Alm.Authentication", "Microsoft.Alm.Authentication\Src\Microsoft.Alm.Authentication.csproj", "{19770407-B493-459D-BB4F-04FBEFB1BA13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualStudioTeamServices.Authentication", "VisualStudioTeamServices.Authentication\Src\VisualStudioTeamServices.Authentication.csproj", "{19770407-D7D8-4A37-914C-F552FF4B90D4}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureDevOps.Authentication", "AzureDevOps.Authentication\Src\AzureDevOps.Authentication.csproj", "{19770407-D7D8-4A37-914C-F552FF4B90D4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.Authentication", "GitHub.Authentication\Src\GitHub.Authentication.csproj", "{CF306116-BBF0-4CC7-AFCE-A506AC4752CB}"
EndProject
@ -36,7 +36,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cli-Askpass", "Cli\Askpass\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Alm.Authentication.Test", "Microsoft.Alm.Authentication\Test\Microsoft.Alm.Authentication.Test.csproj", "{19781214-371F-415C-93C5-44CEAA0E9A34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualStudioTeamServices.Authentication.Test", "VisualStudioTeamServices.Authentication\Test\VisualStudioTeamServices.Authentication.Test.csproj", "{19781214-5254-464A-BC69-FAC502046564}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureDevOps.Authentication.Test", "AzureDevOps.Authentication\Test\AzureDevOps.Authentication.Test.csproj", "{19781214-5254-464A-BC69-FAC502046564}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bitbucket.Authentication.Test", "Bitbucket.Authentication\Test\Bitbucket.Authentication.Test.csproj", "{AECD6D57-F900-4D43-A01A-4AA3C68F39C2}"
EndProject
@ -48,7 +48,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GcmParentWindowTest", "GcmP
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Alm.Authentication.Proxy", "Microsoft.Alm.Authentication\Proxy\Microsoft.Alm.Authentication.Proxy.csproj", "{04151231-FE04-4A05-943A-54EB952CEA62}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualStudioTeamServices.Authentication.Proxy", "VisualStudioTeamServices.Authentication\Proxy\VisualStudioTeamServices.Authentication.Proxy.csproj", "{04151231-4FA4-49B2-AE6D-EBDBA36B1169}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureDevOps.Authentication.Proxy", "AzureDevOps.Authentication\Proxy\AzureDevOps.Authentication.Proxy.csproj", "{04151231-4FA4-49B2-AE6D-EBDBA36B1169}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.Authentication.Proxy", "GitHub.Authentication\Proxy\GitHub.Authentication.Proxy.csproj", "{04151231-4DF4-4312-8F35-72BAD788F741}"
EndProject
@ -60,6 +60,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{FFD83274
build-docs.cmd = build-docs.cmd
build.props = build.props
build.targets = build.targets
devops-ci.yml = devops-ci.yml
devops-pr.yml = devops-pr.yml
devops-rs.yml = devops-rs.yml
devops-tt.yml = devops-tt.yml
proxy.props = proxy.props
test.props = test.props
test.targets = test.targets

Просмотреть файл

@ -16,14 +16,14 @@
<dependencies>
<dependency id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="3.19.4" />
</dependencies>
<tags>Git VSTS Visual Studio Team Services TFS GitHub Active Directory NTLM Basic Authentication Library ADAL Directory Azure AD AAD Identity Authentication .NET Windows</tags>
<tags>Git VSTS Visual Studio Team Services Azure DevOps AzDevOps TFS GitHub Active Directory NTLM Basic Authentication Library ADAL Directory Azure AD AAD Identity Authentication .NET Windows</tags>
</metadata>
<files>
<file src="Microsoft.Alm.Authentication.dll" target="lib\net451\Microsoft.Alm.Authentication.dll" />
<file src="VisualStudioTeamServices.Authentication.dll" target="lib\net451\VisualStudioTeamServices.Authentication.dll" />
<file src="AzureDevOps.Authentication.dll" target="lib\net451\AzureDevOps.Authentication.dll" />
<file src="Microsoft.Alm.Authentication.pdb" target="lib\net451\Microsoft.Alm.Authentication.pdb" />
<file src="VisualStudioTeamServices.Authentication.pdb" target="lib\net451\VisualStudioTeamServices.Authentication.pdb" />
<file src="AzureDevOps.Authentication.pdb" target="lib\net451\AzureDevOps.Authentication.pdb" />
<file src="..\..\Microsoft.Alm.Authentication\**\*.cs" target="src\Microsoft.Alm.Authentication" exclude="**\bin\**\.cs;**\obj\**\*.cs" />
<file src="..\..\VisualStudioTeamServices.Authentication\**\*.cs" target="src\VisualStudioTeamServices.Authentication" exclude="**\bin\**\.cs;**\obj\**\*.cs" />
<file src="..\..\AzureDevOps.Authentication\**\*.cs" target="src\AzureDevOps.Authentication" exclude="**\bin\**\.cs;**\obj\**\*.cs" />
</files>
</package>

Просмотреть файл

@ -52,9 +52,9 @@
<Project>{19770407-B493-459D-BB4F-04FBEFB1BA13}</Project>
<Name>Microsoft.Alm.Authentication</Name>
</ProjectReference>
<ProjectReference Include="..\VisualStudioTeamServices.Authentication\Src\VisualStudioTeamServices.Authentication.csproj">
<ProjectReference Include="..\AzureDevOps.Authentication\Src\AzureDevOps.Authentication.csproj">
<Project>{19770407-D7D8-4A37-914C-F552FF4B90D4}</Project>
<Name>VisualStudioTeamServices.Authentication</Name>
<Name>AzureDevOps.Authentication</Name>
</ProjectReference>
</ItemGroup>
@ -97,17 +97,17 @@
<ItemGroup>
<FilesToCopy Include="$(SolutionDir)\Microsoft.Alm.Authentication\Src\$(InputPath)\Microsoft.Alm.Authentication.dll" />
<FilesToCopy Include="$(SolutionDir)\Microsoft.Alm.Authentication\Src\$(InputPath)\Microsoft.Alm.Authentication.pdb" />
<FilesToCopy Include="$(SolutionDir)\VisualStudioTeamServices.Authentication\Src\$(InputPath)\VisualStudioTeamServices.Authentication.dll" />
<FilesToCopy Include="$(SolutionDir)\VisualStudioTeamServices.Authentication\Src\$(InputPath)\VisualStudioTeamServices.Authentication.pdb" />
<FilesToCopy Include="$(SolutionDir)\AzureDevops.Authentication\Src\$(InputPath)\AzureDevops.Authentication.dll" />
<FilesToCopy Include="$(SolutionDir)\AzureDevops.Authentication\Src\$(InputPath)\AzureDevops.Authentication.pdb" />
<FilesToCopy Include="$(SolutionDir)\Bitbucket.Authentication\Src\$(InputPath)\Bitbucket.Authentication.dll" />
<FilesToCopy Include="$(SolutionDir)\GitHub.Authentication\Src\$(InputPath)\GitHub.Authentication.exe" />
<FilesToCopy Include="$(SolutionDir)\Cli\Manager\$(InputPath)\git-credential-manager.exe" />
<FilesToCopy Include="$(SolutionDir)\Cli\Askpass\$(InputPath)\git-askpass.exe" />
<FilesToCopy Include="$(SolutionDir)\VisualStudioTeamServices.Authentication\Src\$(InputPath)\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" />
<FilesToCopy Include="$(SolutionDir)\AzureDevops.Authentication\Src\$(InputPath)\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" />
<FilesToCopy Include="$(SolutionDir)\LICENSE.TXT" />
<FilesToCopy Include="$(SolutionDir)\README.md" />
<FilesToCopy Include="$(ProjectDir)\Setup.iss" />
<FilesToCopy Include="$(ProjectDir)\VisualStudioTeamServices.Authentication.nuspec" />
<FilesToCopy Include="$(ProjectDir)\AzureDevops.Authentication.nuspec" />
</ItemGroup>
<!-- Ensure the intermediate output path exists -->

Просмотреть файл

@ -32,11 +32,11 @@
<PropertyGroup>
<GcmProps>$([System.IO.File]::ReadAllText($(SolutionDir)\Cli\Manager\Properties\AssemblyInfo.cs))</GcmProps>
<PkgProps>$([System.IO.File]::ReadAllText($(SolutionDir)\VisualStudioTeamServices.Authentication\Src\Properties\AssemblyInfo.cs))</PkgProps>
<PkgProps>$([System.IO.File]::ReadAllText($(SolutionDir)\AzureDevOps.Authentication\Src\Properties\AssemblyInfo.cs))</PkgProps>
<Pattern>^\s*\[assembly\s*:\s*AssemblyVersion\s*\(\s*\s*"(\d+\.\d+\.\d+)\.?\d*\s*"\s*\)</Pattern>
<GcmVersion>$([System.Text.RegularExpressions.Regex]::Match($(GcmProps), $(Pattern), System.Text.RegularExpressions.RegexOptions.Multiline).Groups[1].Value)</GcmVersion>
<PkgVersion>$([System.Text.RegularExpressions.Regex]::Match($(PkgProps), $(Pattern), System.Text.RegularExpressions.RegexOptions.Multiline).Groups[1].Value)</PkgVersion>
<PkgName>VisualStudioTeamServices.Authentication</PkgName>
<PkgName>AzureDevOps.Authentication</PkgName>
<!-- Read the nupkg meta data from the AssemblyInfo.cs file copied from VisualStudioTeamServicesAuthentication -->
<Pattern>^\s*\[assembly: AssemblyDescription\s*\(\s*"\s*([^"]+)\s*"\s*\)</Pattern>
<PkgDescription>$([System.Text.RegularExpressions.Regex]::Match($(PkgProps), $(Pattern), System.Text.RegularExpressions.RegexOptions.Multiline).Groups[1].Value)</PkgDescription>
@ -48,7 +48,7 @@
<PropertyGroup>
<GcmExePath>$(OutputPath)\GCMW-$(GcmVersion).exe</GcmExePath>
<GcmPkgPath>$(OutputPath)\VisualStudioTeamServices.Authentication.$(PkgVersion).nupkg</GcmPkgPath>
<GcmPkgPath>$(OutputPath)\AzureDevOps.Authentication.$(PkgVersion).nupkg</GcmPkgPath>
<GcmZipPath>$(OutputPath)\gcmw-v$(GcmVersion).zip</GcmZipPath>
</PropertyGroup>
@ -115,7 +115,7 @@
<!-- Need to declare the items after dependencies have built, so that glob enumeration happens after the files are produced -->
<ItemGroup>
<ZipContents Include="$(IntermediateOutputPath)\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" />
<ZipContents Include="$(IntermediateOutputPath)\VisualStudioTeamServices.Authentication.dll" />
<ZipContents Include="$(IntermediateOutputPath)\AzureDevOps.Authentication.dll" />
<ZipContents Include="$(IntermediateOutputPath)\Microsoft.Alm.Authentication.dll" />
<ZipContents Include="$(IntermediateOutputPath)\Bitbucket.Authentication.dll" />
<ZipContents Include="$(IntermediateOutputPath)\git-credential-manager.html" />
@ -145,7 +145,7 @@
Directories="$(OutputPath)" />
<!-- Generate isualStudioTeamServices.Authentication-{version}.nupkg -->
<Exec Command="&quot;$(NugetPath)&quot; pack &quot;$(IntermediateOutputPath)\VisualStudioTeamServices.Authentication.nuspec&quot; -BasePath &quot;$(IntermediateOutputPath)&quot; -IncludeReferencedProjects -Properties Configuration=&quot;$(Configuration)&quot;;Version=&quot;$(PkgVersion)$(IsSigned)&quot;;Id=&quot;$(PkgName)&quot;;Title=&quot;$(PkgTitle)&quot;;Description=&quot;$(PkgDescription)&quot; -OutputDirectory &quot;$(NugetWorkDir)&quot;" />
<Exec Command="&quot;$(NugetPath)&quot; pack &quot;$(IntermediateOutputPath)\AzureDevOps.Authentication.nuspec&quot; -BasePath &quot;$(IntermediateOutputPath)&quot; -IncludeReferencedProjects -Properties Configuration=&quot;$(Configuration)&quot;;Version=&quot;$(PkgVersion)$(IsSigned)&quot;;Id=&quot;$(PkgName)&quot;;Title=&quot;$(PkgTitle)&quot;;Description=&quot;$(PkgDescription)&quot; -OutputDirectory &quot;$(NugetWorkDir)&quot;" />
</Target>
<Target Name="Clean">
@ -175,8 +175,8 @@
<Target Name="EnsureResourcesExist" BeforeTargets="PrepareForBuild">
<Error Condition="!Exists('$(SolutionDir)\Cli\Manager\Properties\AssemblyInfo.cs')"
Text="File not found: '$(SolutionDir)\Cli\Manager\Properties\AssemblyInfo.cs'." />
<Error Condition="!Exists('$(SolutionDir)\VisualStudioTeamServices.Authentication\Src\Properties\AssemblyInfo.cs)')"
Text="File not found: '$(SolutionDir)\VisualStudioTeamServices.Authentication\Src\Properties\AssemblyInfo.cs)'." />
<Error Condition="!Exists('$(SolutionDir)\AzureDevOps.Authentication\Src\Properties\AssemblyInfo.cs)')"
Text="File not found: '$(SolutionDir)\AzureDevOps.Authentication\Src\Properties\AssemblyInfo.cs)'." />
</Target>
<Import Project="..\packages\MSBuildTasks.1.5.0.235\build\MSBuildTasks.targets"

Просмотреть файл

@ -91,7 +91,7 @@ Source: "{#binDir}\git-credential-manager.exe"; DestDir: "{app}"; Flags: ignorev
Source: "{#binDir}\git-askpass.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#binDir}\Microsoft.Alm.Authentication.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#binDir}\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#binDir}\VisualStudioTeamServices.Authentication.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#binDir}\AzureDevOps.Authentication.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#binDir}\GitHub.Authentication.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#binDir}\Bitbucket.Authentication.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#binDir}\README.md"; DestDir: "{app}"; Flags: ignoreversion

Просмотреть файл

@ -539,9 +539,9 @@ namespace Microsoft.Alm.Authentication
}
}
// Manually add the correct headers for the type of authentication that is happening because if
// we rely on the framework to correctly write the headers neither GitHub nor VSTS authentication
// works reliably.
// Manually add the correct headers for the type of authentication that is happening because
// if we rely on the framework to correctly write the headers neither GitHub nor Azure DevOps
// authentication works reliably.
if (options.Authorization != null)
{
switch (options.Authorization)

Просмотреть файл

@ -27,16 +27,16 @@ If you are experiencing issue when using **Visual Studio**, please read **[Unabl
* * *
The [Git Credential Manager for Windows](https://github.com/Microsoft/Git-Credential-Manager-for-Windows) (GCM) provides secure Git credential storage for Windows. It's the successor to the [Windows Credential Store for Git](https://gitcredentialstore.codeplex.com/) (git-credential-winstore), which is no longer maintained. Compared to Git's built-in credential storage for Windows ([wincred](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage)), which provides single-factor authentication support working on any HTTP enabled Git repository, GCM provides multi-factor authentication support for [Visual Studio Team Services](https://www.visualstudio.com/), [Team Foundation Server](Docs/Faq.md#q-i-thought-microsoft-was-maintaining-this-why-does-the-gcm-not-work-as-expected-with-tfs), GitHub, and Bitbucket.
The [Git Credential Manager for Windows](https://github.com/Microsoft/Git-Credential-Manager-for-Windows) (GCM) provides secure Git credential storage for Windows. It's the successor to the [Windows Credential Store for Git](https://gitcredentialstore.codeplex.com/) (git-credential-winstore), which is no longer maintained. Compared to Git's built-in credential storage for Windows ([wincred](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage)), which provides single-factor authentication support working on any HTTP enabled Git repository, GCM provides multi-factor authentication support for [Azure DevOps](https://dev.azure.com/), [Team Foundation Server](Docs/Faq.md#q-i-thought-microsoft-was-maintaining-this-why-does-the-gcm-not-work-as-expected-with-tfs), GitHub, and Bitbucket.
This project includes:
* Secure password storage in the Windows Credential Store.
* Multi-factor authentication support for Visual Studio Team Services.
* Multi-factor authentication support for Azure DevOps.
* Two-factor authentication support for GitHub.
* Two-factor authentication support for Bitbucket.
* Personal Access Token generation and usage support for Visual Studio Team Services and GitHub.
* Non-interactive mode support for Visual Studio Team Services backed by Azure Directory.
* Personal Access Token generation and usage support for Azure DevOps, GitHub, and Bitbucket.
* Non-interactive mode support for Azure DevOps backed by Azure Directory.
* NTLM/Kerberos authentication for Team Foundation Server ([see notes](Docs/Faq.md#q-i-thought-microsoft-was-maintaining-this-why-does-the-gcm-not-work-as-expected-with-tfs)).
* Optional settings for [build agent optimization](Docs/Automation.md).
@ -64,7 +64,7 @@ git config --global credential.helper manager
## How to use
You don't. It [magically](https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/31) works when credentials are needed. For example, when pushing to [Visual Studio Team Services](https://www.visualstudio.com), it automatically opens a window and initializes an oauth2 flow to get your token.
You don't. It [magically](https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/31) works when credentials are needed. For example, when pushing to [Azure DevOps](https://dev.azure.com), it automatically opens a window and initializes an oauth2 flow to get your token.
### Build and Install from Sources

Просмотреть файл

@ -29,10 +29,10 @@ using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
using Azure = AzureDevOps.Authentication;
using Bitbucket = Atlassian.Bitbucket.Authentication;
using Git = Microsoft.Alm.Authentication.Git;
using Github = GitHub.Authentication;
using Vsts = VisualStudioTeamServices.Authentication;
namespace Microsoft.Alm.Cli
{
@ -85,32 +85,38 @@ namespace Microsoft.Alm.Cli
program.Trace.WriteLine($"detecting authority type for '{operationArguments.TargetUri}'.");
// Detect the authority.
authority = await Vsts.Authentication.GetAuthentication(program.Context,
operationArguments.TargetUri,
Program.VstsCredentialScope,
new SecretStore(program.Context, secretsNamespace, Vsts.Authentication.UriNameConversion))
authority = await Azure.Authentication.GetAuthentication(program.Context,
operationArguments.TargetUri,
Program.DevOpsCredentialScope,
new SecretStore(program.Context,
secretsNamespace,
Azure.Authentication.UriNameConversion))
?? Github.Authentication.GetAuthentication(program.Context,
operationArguments.TargetUri,
Program.GitHubCredentialScope,
new SecretStore(program.Context, secretsNamespace, Secret.UriToName),
new SecretStore(program.Context,
secretsNamespace,
Secret.UriToName),
githubCredentialCallback,
githubAuthcodeCallback,
null)
?? Bitbucket.Authentication.GetAuthentication(program.Context,
operationArguments.TargetUri,
new SecretStore(program.Context, secretsNamespace, Secret.UriToIdentityUrl),
new SecretStore(program.Context,
secretsNamespace,
Secret.UriToIdentityUrl),
bitbucketCredentialCallback,
bitbucketOauthCallback);
if (authority != null)
{
// Set the authority type based on the returned value.
if (authority is Vsts.MsaAuthentication)
if (authority is Azure.MsaAuthentication)
{
operationArguments.Authority = AuthorityType.MicrosoftAccount;
goto case AuthorityType.MicrosoftAccount;
}
else if (authority is Vsts.AadAuthentication)
else if (authority is Azure.AadAuthentication)
{
operationArguments.Authority = AuthorityType.AzureDirectory;
goto case AuthorityType.AzureDirectory;
@ -138,7 +144,7 @@ namespace Microsoft.Alm.Cli
Guid tenantId = Guid.Empty;
// Get the identity of the tenant.
var result = await Vsts.Authentication.DetectAuthority(program.Context, operationArguments.TargetUri);
var result = await Azure.Authentication.DetectAuthority(program.Context, operationArguments.TargetUri);
if (result.HasValue)
{
@ -146,13 +152,15 @@ namespace Microsoft.Alm.Cli
}
// Create the authority object.
authority = new Vsts.AadAuthentication(program.Context,
tenantId,
operationArguments.VstsTokenScope,
new SecretStore(program.Context, secretsNamespace, Vsts.AadAuthentication.UriNameConversion));
authority = new Azure.AadAuthentication(program.Context,
tenantId,
operationArguments.DevOpsTokenScope,
new SecretStore(program.Context,
secretsNamespace,
Azure.AadAuthentication.UriNameConversion));
}
// Return the allocated authority or a generic AAD backed VSTS authentication object.
// Return the allocated authority or a generic AAD backed Azure DevOps authentication object.
return authority;
}
@ -171,7 +179,9 @@ namespace Microsoft.Alm.Cli
return authority ?? new Github.Authentication(program.Context,
operationArguments.TargetUri,
Program.GitHubCredentialScope,
new SecretStore(program.Context, secretsNamespace, Secret.UriToName),
new SecretStore(program.Context,
secretsNamespace,
Secret.UriToName),
githubCredentialCallback,
githubAuthcodeCallback,
null);
@ -183,7 +193,9 @@ namespace Microsoft.Alm.Cli
// Return a Bitbucket authentication object.
return authority ?? new Bitbucket.Authentication(program.Context,
new SecretStore(program.Context, secretsNamespace, Secret.UriToIdentityUrl),
new SecretStore(program.Context,
secretsNamespace,
Secret.UriToIdentityUrl),
bitbucketCredentialCallback,
bitbucketOauthCallback);
}
@ -192,10 +204,12 @@ namespace Microsoft.Alm.Cli
{
program.Trace.WriteLine($"authority for '{operationArguments.TargetUri}' is Microsoft Live.");
// Return the allocated authority or a generic MSA backed VSTS authentication object.
return authority ?? new Vsts.MsaAuthentication(program.Context,
operationArguments.VstsTokenScope,
new SecretStore(program.Context, secretsNamespace, Vsts.MsaAuthentication.UriNameConversion));
// Return the allocated authority or a generic MSA backed Azure DevOps authentication object.
return authority ?? new Azure.MsaAuthentication(program.Context,
operationArguments.DevOpsTokenScope,
new SecretStore(program.Context,
secretsNamespace,
Azure.MsaAuthentication.UriNameConversion));
}
case AuthorityType.Ntlm:
@ -211,7 +225,9 @@ namespace Microsoft.Alm.Cli
// Return a generic username + password authentication object.
return authority ?? new BasicAuthentication(program.Context,
new SecretStore(program.Context, secretsNamespace, Secret.UriToIdentityUrl),
new SecretStore(program.Context,
secretsNamespace,
Secret.UriToIdentityUrl),
basicNtlmSupport,
basicCredentialCallback,
null);
@ -240,9 +256,9 @@ namespace Microsoft.Alm.Cli
case AuthorityType.AzureDirectory:
case AuthorityType.MicrosoftAccount:
{
program.Trace.WriteLine($"deleting VSTS credentials for '{operationArguments.TargetUri}'.");
var vstsAuth = authentication as Vsts.Authentication;
return await vstsAuth.DeleteCredentials(operationArguments.TargetUri);
program.Trace.WriteLine($"deleting Azure DevOps credentials for '{operationArguments.TargetUri}'.");
var adoAuth = authentication as Azure.Authentication;
return await adoAuth.DeleteCredentials(operationArguments.TargetUri);
}
case AuthorityType.GitHub:
@ -586,33 +602,57 @@ namespace Microsoft.Alm.Cli
}
}
// Look for custom VSTS scope settings.
if (program.TryReadString(operationArguments, KeyType.VstsScope, out value))
// Look for custom Azure DevOps scope settings.
if (program.TryReadString(operationArguments, KeyType.DevOpsScope, out value))
{
program.Trace.WriteLine($"{program.KeyTypeName(KeyType.VstsScope)} = '{value}'.");
program.Trace.WriteLine($"{program.KeyTypeName(KeyType.DevOpsScope)} = '{value}'.");
Vsts.TokenScope vstsTokenScope = Vsts.TokenScope.None;
Azure.TokenScope devopsTokenScope = Azure.TokenScope.None;
var scopes = value.Split(TokenScopeSeparatorCharacters.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < scopes.Length; i += 1)
{
scopes[i] = scopes[i].Trim();
if (Vsts.TokenScope.Find(scopes[i], out Vsts.TokenScope scope))
if (Azure.TokenScope.Find(scopes[i], out Azure.TokenScope scope))
{
vstsTokenScope = vstsTokenScope | scope;
devopsTokenScope = devopsTokenScope | scope;
}
else
{
program.Trace.WriteLine($"Unknown VSTS Token scope: '{scopes[i]}'.");
program.Trace.WriteLine($"Unknown Azure DevOps Token scope: '{scopes[i]}'.");
}
}
operationArguments.VstsTokenScope = vstsTokenScope;
operationArguments.DevOpsTokenScope = devopsTokenScope;
}
else if (program.TryReadString(operationArguments, KeyType.VstsScope, out value))
{
program.Trace.WriteLine($"GCM_VSTS_SCOPE = '{value}'.");
program.WriteLine($"WARNING: the 'GCM_VSTS_SCOPE' variable has been deprecated, use 'GCM_DEVOPS_SCOPE' instead.");
Azure.TokenScope devopsTokenScope = Azure.TokenScope.None;
var scopes = value.Split(TokenScopeSeparatorCharacters.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < scopes.Length; i += 1)
{
scopes[i] = scopes[i].Trim();
if (Azure.TokenScope.Find(scopes[i], out Azure.TokenScope scope))
{
devopsTokenScope = devopsTokenScope | scope;
}
else
{
program.Trace.WriteLine($"Unknown Azure DevOps Token scope: '{scopes[i]}'.");
}
}
operationArguments.DevOpsTokenScope = devopsTokenScope;
}
// Check for configuration supplied user-info.
if (program.TryReadString(operationArguments, KeyType.Username, out value))
if (program.TryReadString(operationArguments, KeyType.Username, out value))
{
program.Trace.WriteLine($"{program.KeyTypeName(KeyType.Username)} = '{value}'.");
@ -740,8 +780,8 @@ namespace Microsoft.Alm.Cli
case AuthorityType.AzureDirectory:
{
var aadAuth = authentication as Vsts.AadAuthentication;
var patOptions = new Vsts.PersonalAccessTokenOptions()
var aadAuth = authentication as Azure.AadAuthentication;
var patOptions = new Azure.PersonalAccessTokenOptions()
{
RequireCompactToken = true,
TokenDuration = operationArguments.TokenDuration,
@ -776,8 +816,8 @@ namespace Microsoft.Alm.Cli
case AuthorityType.MicrosoftAccount:
{
var msaAuth = authentication as Vsts.MsaAuthentication;
var patOptions = new Vsts.PersonalAccessTokenOptions()
var msaAuth = authentication as Azure.MsaAuthentication;
var patOptions = new Azure.PersonalAccessTokenOptions()
{
RequireCompactToken = true,
TokenDuration = operationArguments.TokenDuration,

Просмотреть файл

@ -30,8 +30,8 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
using static System.Globalization.CultureInfo;
using Azure = AzureDevOps.Authentication;
using Git = Microsoft.Alm.Authentication.Git;
using Vsts = VisualStudioTeamServices.Authentication;
namespace Microsoft.Alm.Cli
{
@ -53,7 +53,7 @@ namespace Microsoft.Alm.Cli
_useModalUi = true;
_useSystemConfig = true;
_validateCredentials = true;
_vstsTokenScope = Program.VstsCredentialScope;
_devopsTokenScope = Program.DevOpsCredentialScope;
}
/// <summary>
@ -69,6 +69,7 @@ namespace Microsoft.Alm.Cli
private Git.Configuration _configuration;
private Credential _credentials;
private string _customNamespace;
private Azure.TokenScope _devopsTokenScope;
private Dictionary<string, string> _environmentVariables;
private string _gitRemoteHttpCommandLine;
private Interactivity _interactivity;
@ -87,7 +88,6 @@ namespace Microsoft.Alm.Cli
private string _username;
private bool _useSystemConfig;
private bool _validateCredentials;
private Vsts.TokenScope _vstsTokenScope;
private bool _writeLog;
/// <summary>
@ -123,6 +123,17 @@ namespace Microsoft.Alm.Cli
set { _customNamespace = value; }
}
/// <summary>
/// Gets or sets the scope, or permissions, when requesting new access tokens from Azure DevOps.
/// <para/>
/// Default value is `<seealso cref="Program.DevOpsCredentialScope"/>`.
/// </summary>
public virtual Azure.TokenScope DevOpsTokenScope
{
get { return _devopsTokenScope; }
set { _devopsTokenScope = value; }
}
/// <summary>
/// Gets a map of the process's environmental variables keyed on case-insensitive names.
/// </summary>
@ -423,17 +434,6 @@ namespace Microsoft.Alm.Cli
set { _validateCredentials = value; }
}
/// <summary>
/// Gets or sets the scope, or permissions, when requesting new access tokens from VSTS.
/// <para/>
/// Default value is `<seealso cref="Program.VstsCredentialScope"/>`.
/// </summary>
public virtual Vsts.TokenScope VstsTokenScope
{
get { return _vstsTokenScope; }
set { _vstsTokenScope = value; }
}
/// <summary>
/// Gets or sets `<see langword="true"/>` if the GCM should write trace events; otherwise `<see langword="false"/>`.
/// <para/>

Просмотреть файл

@ -32,10 +32,10 @@ using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Alm.Authentication;
using Azure = AzureDevOps.Authentication;
using Bitbucket = Atlassian.Bitbucket.Authentication;
using Git = Microsoft.Alm.Authentication.Git;
using Github = GitHub.Authentication;
using Vsts = VisualStudioTeamServices.Authentication;
namespace Microsoft.Alm.Cli
{
@ -44,6 +44,7 @@ namespace Microsoft.Alm.Cli
Authority,
ConfigNoLocal,
ConfigNoSystem,
DevOpsScope,
HttpPath,
HttpProxy,
HttpsProxy,
@ -56,8 +57,8 @@ namespace Microsoft.Alm.Cli
UrlOverride,
Username,
Validate,
VstsScope,
ParentHwnd,
VstsScope,
Writelog,
}
@ -77,7 +78,7 @@ namespace Microsoft.Alm.Cli
internal const string ConfigPrefix = "credential";
internal const string SecretsNamespace = "git";
internal static readonly Vsts.TokenScope VstsCredentialScope = Vsts.TokenScope.CodeWrite | Vsts.TokenScope.PackagingRead;
internal static readonly Azure.TokenScope DevOpsCredentialScope = Azure.TokenScope.CodeWrite | Azure.TokenScope.PackagingRead;
internal static readonly Github.TokenScope GitHubCredentialScope = Github.TokenScope.Gist | Github.TokenScope.Repo;
internal BasicCredentialPromptDelegate _basicCredentialPrompt = ConsoleFunctions.CredentialPrompt;
@ -119,6 +120,7 @@ namespace Microsoft.Alm.Cli
internal readonly Dictionary<KeyType, string> _configurationKeys = new Dictionary<KeyType, string>()
{
{ KeyType.Authority, "authority" },
{ KeyType.DevOpsScope, "devopsScope" },
{ KeyType.HttpProxy, "httpProxy" },
{ KeyType.HttpsProxy, "httpsProxy" },
{ KeyType.Interactive, "interactive" },
@ -137,6 +139,7 @@ namespace Microsoft.Alm.Cli
{ KeyType.Authority, "GCM_AUTHORITY" },
{ KeyType.ConfigNoLocal, "GCM_CONFIG_NOLOCAL" },
{ KeyType.ConfigNoSystem, "GCM_CONFIG_NOSYSTEM" },
{ KeyType.DevOpsScope, "GCM_DEVOPS_SCOPE" },
{ KeyType.HttpProxy, "HTTP_PROXY" },
{ KeyType.HttpsProxy, "HTTPS_PROXY" },
{ KeyType.HttpUserAgent, "GCM_HTTP_USER_AGENT" },

79
devops-ci.yml Normal file
Просмотреть файл

@ -0,0 +1,79 @@
# ** Git Credential Manager for Windows **
#
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the """"Software""""), to deal
# in the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
#
# == Continuous Integration Pipeline ==
#
# Learn more at https://docs.microsoft.com/en-us/vsts/pipelines/get-started-yaml?view=vsts&tabs=gitvsts
# https://microsoft-git-tools.visualstudio.com/Git-Credential-Manager-for-Windows
phases:
- template: devops-tt.yml
parameters:
QueueName: 'Hosted VS2017'
CoreBuild:
- task: MSBuild@1
displayName: 'Core Build'
inputs:
solution: 'Installer/Installer.proj'
msbuildArguments: '/nologo /verbosity:$(Build.Verbosity) /binaryLogger:$(Build.SourcesDirectory)/$(build.buildNumber).binlog'
platform: '$(Build.Platform)'
configuration: '$(Build.Configuration)'
maximumCpuCount: false
msbuildArchitecture: '$(Build.Architecture)'
MicrobuildSetup: []
MicrobuildClean: []
NugetCommand:
- task: NuGetCommand@2
displayName: NuGet restore
inputs:
restoreSolution: 'GitCredentialManager.sln'
verbosityRestore: 'quiet'
- task: NuGetCommand@2
displayName: NuGet restore
inputs:
command: custom
arguments: restore "$(Build.SourcesDirectory)\Installer\packages.config" -PackagesDirectory "$(Build.SourcesDirectory)\packages" -SolutionDirectory "$(Build.SourcesDirectory)" -Verbosity Quiet
PublishArtifacts:
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Binary Log'
continueOnError: true
condition: eq(variables['system.pullrequest.isfork'], false)
inputs:
pathtoPublish: '$(Build.SourcesDirectory)\$(build.buildNumber).binlog'
artifactName: '$(build.buildNumber).binlog'
publishLocation: Container
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Binaries'
continueOnError: true
condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false))
inputs:
pathtoPublish: '$(Build.SourcesDirectory)\Deploy\'
artifactName: '$(Build.BuildNumber).output'
publishLocation: Container

56
devops-pr.yml Normal file
Просмотреть файл

@ -0,0 +1,56 @@
# ** Git Credential Manager for Windows **
#
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the """"Software""""), to deal
# in the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
#
# == Pull Request Validtion Pipeline ==
#
# Learn more at https://docs.microsoft.com/en-us/vsts/pipelines/get-started-yaml?view=vsts&tabs=gitvsts
# https://dev.azure.com/microsoft-git-tools/Git-Credential-Manager-for-Windows
phases:
- template: devops-tt.yml
parameters:
QueueName: 'Hosted VS2017'
CoreBuild:
- task: MSBuild@1
displayName: 'Core Build'
inputs:
solution: "GitCredentialManager.sln"
msbuildArguments: /nologo /verbosity:$(Build.Verbosity) "/binaryLogger:$(Build.SourcesDirectory)/$(build.buildNumber).binlog"
platform: '$(Build.Platform)'
configuration: '$(Build.Configuration)'
maximumCpuCount: false
msbuildArchitecture: '$(Build.Architecture)'
MicrobuildSetup: []
MicrobuildClean: []
NugetCommand:
- task: NuGetCommand@2
displayName: NuGet restore
inputs:
restoreSolution: 'GitCredentialManager.sln'
verbosityRestore: 'quiet'
PublishArtifacts: []

91
devops-rs.yml Normal file
Просмотреть файл

@ -0,0 +1,91 @@
# ** Git Credential Manager for Windows **
#
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the """"Software""""), to deal
# in the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
#
# == RealSign and Release Pipeline ==
#
# Learn more at https://docs.microsoft.com/en-us/vsts/pipelines/get-started-yaml?view=vsts&tabs=gitvsts
phases:
- template: devops-tt.yml
parameters:
QueueName: 'VSEng-MicroBuildVS2017'
CoreBuild:
- task: MSBuild@1
displayName: 'Core Build'
inputs:
solution: 'Installer/Installer.proj'
msbuildArguments: '/nologo /verbosity:$(Build.Verbosity) "/binaryLogger:$(Build.SourcesDirectory)/$(build.buildNumber).binlog"'
platform: '$(Build.Platform)'
configuration: '$(Build.Configuration)'
maximumCpuCount: false
msbuildArchitecture: '$(Build.Architecture)'
MicrobuildSetup:
- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1
displayName: Setup MicroBuild Signing
condition: and(succeeded(), or(eq(variables['signType'],'real'), eq(variables['signType'],'test')))
continueOnError: true
inputs:
feedSource: https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json
signType: '$(SignType)'
zipSources: true
MicrobuildClean:
- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
displayName: MicroBuild Cleanup
condition: or(eq(variables['signType'],'real'), eq(variables['signType'],'test'))
continueOnError: true
NugetCommand:
- task: NuGetCommand@2
displayName: NuGet restore
inputs:
restoreSolution: 'GitCredentialManager.sln'
verbosityRestore: 'quiet'
- task: NuGetCommand@2
displayName: NuGet restore
inputs:
command: custom
arguments: restore "$(Build.SourcesDirectory)\Installer\packages.config" -PackagesDirectory "$(Build.SourcesDirectory)\packages" -SolutionDirectory "$(Build.SourcesDirectory)" -Verbosity Quiet
PublishArtifacts:
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Binary Log'
continueOnError: true
condition: eq(variables['system.pullrequest.isfork'], false)
inputs:
pathtoPublish: $(Build.SourcesDirectory)\$(build.buildNumber).binlog
artifactName: $(build.buildNumber).binlog
publishLocation: Container
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Binaries'
continueOnError: true
condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false))
inputs:
pathtoPublish: $(Build.SourcesDirectory)\Deploy\
artifactName: $(Build.BuildNumber).output
publishLocation: Container

85
devops-tt.yml Normal file
Просмотреть файл

@ -0,0 +1,85 @@
# ** Git Credential Manager for Windows **
#
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the """"Software""""), to deal
# in the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
#
# == Pipeline Template ==
#
# Learn more at https://docs.microsoft.com/en-us/vsts/pipelines/get-started-yaml?view=vsts&tabs=gitvsts
parameters:
QueueName: ''
CoreBuild: []
MicrobuildSetup: []
MicrobuildClean: []
NugetCommand: []
PublishArtifacts: []
phases:
- phase: Build
queue:
name: ${{ parameters.QueueName }}
demands:
- msbuild
- visualstudio
- vstest
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.0'
inputs:
versionSpec: 4.4.0
- ${{ parameters.NugetCommand }}
- ${{ parameters.MicrobuildSetup }}
- ${{ parameters.CoreBuild }}
- task: VSTest@2
displayName: 'Execute Tests (Xunit)'
inputs:
testAssemblyVer2: |
**\*Test.dll
!**\xunit.*.dll
!**\obj\**
searchFolder: '$(Build.SourcesDirectory)'
runInParallel: true
runTestsInIsolation: true
codeCoverageEnabled: true
platform: '$(Build.Platform)'
configuration: '$(Build.Configuration)'
- ${{ parameters.PublishArtifacts }}
- task: DeleteFiles@1
displayName: 'Delete Artifacts from Agent'
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: |
*.binlog
Deploy\*.*
**\bin\**\*.*
**\obj\**\*.*
- ${{ parameters.MicrobuildClean }}