Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Azure DevOps Rebranding
Browse files Browse the repository at this point in the history
- [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.
  • Loading branch information
whoisj committed Sep 12, 2018
1 parent 7d49e3b commit 69db585
Show file tree
Hide file tree
Showing 80 changed files with 623 additions and 265 deletions.
Expand Up @@ -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" />
Expand All @@ -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>
Expand Down
Expand Up @@ -29,7 +29,7 @@
using Microsoft.Alm.Authentication;
using Microsoft.Alm.Authentication.Test;

namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
public class CaptureAdal : IAdal, ICaptureService<CapturedAdalData>
{
Expand Down
Expand Up @@ -27,7 +27,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay, nq}")]
public struct CapturedAdalData
Expand Down
Expand Up @@ -5,12 +5,12 @@
// 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("")]

Expand Down
Expand Up @@ -30,7 +30,7 @@
using Microsoft.Alm.Authentication.Test;
using static System.StringComparer;

namespace VisualStudioTeamServices.Authentication.Test
namespace AzureDevOps.Authentication.Test
{
public class ReplayAdal : IAdal, IReplayService<CapturedAdalData>
{
Expand Down
Expand Up @@ -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
{
Expand Down
Expand Up @@ -27,7 +27,7 @@
using System.Threading.Tasks;
using Microsoft.Alm.Authentication;

namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
/// <summary>
/// Facilitates Azure Directory authentication.
Expand All @@ -54,12 +54,12 @@ public sealed class AadAuthentication : Authentication, IAadAuthentication
{
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);
}
}
Expand All @@ -70,22 +70,22 @@ public sealed class AadAuthentication : Authentication, IAadAuthentication
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);
Expand All @@ -110,13 +110,13 @@ public async Task<Credential> InteractiveLogon(TargetUri targetUri, PersonalAcce
}

/// <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/>
Expand Down Expand Up @@ -147,14 +147,14 @@ public async Task<Credential> InteractiveLogon(TargetUri targetUri, bool request
}

/// <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);
Expand All @@ -171,21 +171,21 @@ public async Task<Credential> NoninteractiveLogon(TargetUri targetUri, PersonalA
}
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");
return null;
}

/// <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/>
Expand All @@ -208,7 +208,7 @@ public async Task<Credential> NoninteractiveLogon(TargetUri targetUri, bool requ
}
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");
Expand Down
Expand Up @@ -29,7 +29,7 @@
using AdalExtentions = Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContextIntegratedAuthExtensions;
using Alm = Microsoft.Alm.Authentication;

namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
public interface IAdal : Alm.IRuntimeService
{
Expand Down
Expand Up @@ -30,7 +30,7 @@
using Microsoft.Alm.Authentication;
using ActiveDirectory = Microsoft.IdentityModel.Clients.ActiveDirectory;

namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
internal class AdalTokenCache : ActiveDirectory.TokenCache
{
Expand Down
Expand Up @@ -33,12 +33,12 @@
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
{
Expand All @@ -48,8 +48,8 @@ public abstract class Authentication : BaseAuthentication

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';
Expand Down Expand Up @@ -161,7 +161,7 @@ public override async Task<bool> DeleteCredentials(TargetUri targetUri)
/// <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>
Expand All @@ -170,14 +170,14 @@ public override async Task<bool> DeleteCredentials(TargetUri targetUri)
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.
Expand All @@ -202,7 +202,7 @@ public override async Task<bool> DeleteCredentials(TargetUri targetUri)
// 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;
}
Expand All @@ -215,15 +215,15 @@ public override async Task<bool> DeleteCredentials(TargetUri targetUri)

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.
Expand Down Expand Up @@ -293,7 +293,7 @@ public override async Task<bool> DeleteCredentials(TargetUri targetUri)

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;
}
}
Expand Down Expand Up @@ -521,7 +521,7 @@ internal static string GetSecretKey(TargetUri targetUri, string prefix)

// 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);

Expand Down
Expand Up @@ -26,7 +26,7 @@
using System;
using System.Runtime.Serialization;

namespace VisualStudioTeamServices.Authentication
namespace AzureDevOps.Authentication
{
[Serializable]
public class AuthenticationException : Exception
Expand Down
Expand Up @@ -34,7 +34,7 @@
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.
Expand All @@ -57,7 +57,7 @@ internal class Authority : Base, IAuthority
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";

Expand Down Expand Up @@ -259,7 +259,7 @@ public async Task<bool> PopulateTokenTargetId(TargetUri targetUri, Token authori

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)
{
Expand Down Expand Up @@ -325,14 +325,14 @@ public async Task<bool> ValidateToken(TargetUri targetUri, Token token)

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);
}
Expand Down Expand Up @@ -417,7 +417,7 @@ internal static string GetTargetUrl(TargetUri targetUri, bool keepUsername)
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))
Expand All @@ -435,7 +435,7 @@ internal async Task<bool> ValidateSecret(TargetUri targetUri, Secret secret)
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)
{
Expand Down

0 comments on commit 69db585

Please sign in to comment.