diff --git a/sdk/identity/Azure.Identity/src/IVisualStudioCodeAdapter.cs b/sdk/identity/Azure.Identity/src/IVisualStudioCodeAdapter.cs new file mode 100644 index 000000000000..60b3eb0c912a --- /dev/null +++ b/sdk/identity/Azure.Identity/src/IVisualStudioCodeAdapter.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.Identity +{ + internal interface IVisualStudioCodeAdapter + { + string GetUserSettingsPath(); + string GetCredentials(string serviceName, string accountName); + } +} diff --git a/sdk/identity/Azure.Identity/src/LinuxNativeMethods.cs b/sdk/identity/Azure.Identity/src/LinuxNativeMethods.cs new file mode 100644 index 000000000000..c408828931d5 --- /dev/null +++ b/sdk/identity/Azure.Identity/src/LinuxNativeMethods.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; + +namespace Azure.Identity +{ + internal static class LinuxNativeMethods + { + public const string SECRET_COLLECTION_SESSION = "session"; + + public enum SecretSchemaAttributeType + { + SECRET_SCHEMA_ATTRIBUTE_STRING = 0, + SECRET_SCHEMA_ATTRIBUTE_INTEGER = 1, + SECRET_SCHEMA_ATTRIBUTE_BOOLEAN = 2, + } + + public enum SecretSchemaFlags + { + SECRET_SCHEMA_NONE = 0, + SECRET_SCHEMA_DONT_MATCH_NAME = 2, + } + + internal struct GError + { + public uint Domain; + public int Code; + public string Message; + } + + public static IntPtr secret_schema_new(string name, SecretSchemaFlags flags, string attribute1, SecretSchemaAttributeType attribute1Type, string attribute2, SecretSchemaAttributeType attribute2Type) + { + return Imports.secret_schema_new(name, (int)flags, attribute1, (int)attribute1Type, attribute2, (int)attribute2Type, IntPtr.Zero); + } + + public static string secret_password_lookup_sync(IntPtr schemaPtr, IntPtr cancellable, string attribute1Type, string attribute1Value, string attribute2Type, string attribute2Value) + { + IntPtr passwordPtr = Imports.secret_password_lookup_sync(schemaPtr, cancellable, out IntPtr errorPtr, attribute1Type, attribute1Value, attribute2Type, attribute2Value, IntPtr.Zero); + HandleError(errorPtr, "An error was encountered while reading secret from keyring"); + return passwordPtr != IntPtr.Zero ? Marshal.PtrToStringAnsi(passwordPtr) : null; + } + + public static void secret_password_store_sync(IntPtr schemaPtr, string collection, string label, string password, IntPtr cancellable, string attribute1Type, string attribute1Value, string attribute2Type, string attribute2Value) + { + _ = Imports.secret_password_store_sync(schemaPtr, collection, label, password, cancellable, out IntPtr errorPtr, attribute1Type, attribute1Value, attribute2Type, attribute2Value, IntPtr.Zero); + HandleError(errorPtr, "An error was encountered while writing secret to keyring"); + } + + public static void secret_password_clear_sync(IntPtr schemaPtr, IntPtr cancellable, string attribute1Type, string attribute1Value, string attribute2Type, string attribute2Value) + { + _ = Imports.secret_password_clear_sync(schemaPtr, cancellable, out IntPtr errorPtr, attribute1Type, attribute1Value, attribute2Type, attribute2Value, IntPtr.Zero); + HandleError(errorPtr, "An error was encountered while clearing secret from keyring "); + } + + public static void secret_password_free(IntPtr passwordPtr) + { + if (passwordPtr != IntPtr.Zero) + { + Imports.secret_password_free(passwordPtr); + } + } + + public static void secret_schema_unref(IntPtr schemaPtr) + { + if (schemaPtr != IntPtr.Zero) + { + Imports.secret_schema_unref(schemaPtr); + } + } + + private static void HandleError(IntPtr errorPtr, string errorMessage) + { + if (errorPtr == IntPtr.Zero) + { + return; + } + + GError error; + try + { + error = Marshal.PtrToStructure(errorPtr); + } + catch (Exception ex) + { + throw new InvalidOperationException($"An exception was encountered while processing libsecret error: {ex}", ex); + } + + throw new InvalidOperationException($"{errorMessage}, domain:'{error.Domain}', code:'{error.Code}', message:'{error.Message}'"); + } + + private static class Imports + { + [DllImport("libsecret-1.so.0", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)] + public static extern IntPtr secret_schema_new(string name, int flags, string attribute1, int attribute1Type, string attribute2, int attribute2Type, IntPtr end); + + [DllImport("libsecret-1.so.0", CallingConvention = CallingConvention.StdCall)] + public static extern void secret_schema_unref (IntPtr schema); + + [DllImport("libsecret-1.so.0", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern IntPtr secret_password_lookup_sync(IntPtr schema, IntPtr cancellable, out IntPtr error, string attribute1Type, string attribute1Value, string attribute2Type, string attribute2Value, IntPtr end); + + [DllImport("libsecret-1.so.0", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern int secret_password_store_sync(IntPtr schema, string collection, string label, string password, IntPtr cancellable, out IntPtr error, string attribute1Type, string attribute1Value, string attribute2Type, string attribute2Value, IntPtr end); + + [DllImport("libsecret-1.so.0", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)] + public static extern int secret_password_clear_sync(IntPtr schema, IntPtr cancellable, out IntPtr error, string attribute1Type, string attribute1Value, string attribute2Type, string attribute2Value, IntPtr end); + + [DllImport("libsecret-1.so.0", CallingConvention = CallingConvention.StdCall)] + public static extern void secret_password_free(IntPtr password); + } + } +} diff --git a/sdk/identity/Azure.Identity/src/LinuxVisualStudioCodeAdapter.cs b/sdk/identity/Azure.Identity/src/LinuxVisualStudioCodeAdapter.cs new file mode 100644 index 000000000000..bcecaa30a7bd --- /dev/null +++ b/sdk/identity/Azure.Identity/src/LinuxVisualStudioCodeAdapter.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.IO; +using System.Runtime.InteropServices; +using Azure.Core; + +namespace Azure.Identity +{ + internal sealed class LinuxVisualStudioCodeAdapter : IVisualStudioCodeAdapter + { + private static readonly string s_userSettingsJsonPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Code", "User", "settings.json"); + + public string GetUserSettingsPath() => s_userSettingsJsonPath; + + public string GetCredentials(string serviceName, string accountName) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + IntPtr schemaPtr = GetLibsecretSchema(); + + try + { + return LookupPassword(schemaPtr, serviceName, accountName); + } + finally + { + LinuxNativeMethods.secret_schema_unref(schemaPtr); + } + } + + private static string LookupPassword(in IntPtr schemaPtr, string serviceName, string accountName) + => LinuxNativeMethods.secret_password_lookup_sync(schemaPtr, IntPtr.Zero, "service", serviceName, "account", accountName); + + private static IntPtr GetLibsecretSchema() + => LinuxNativeMethods.secret_schema_new("org.freedesktop.Secret.Generic", + LinuxNativeMethods.SecretSchemaFlags.SECRET_SCHEMA_DONT_MATCH_NAME, + "service", + LinuxNativeMethods.SecretSchemaAttributeType.SECRET_SCHEMA_ATTRIBUTE_STRING, + "account", + LinuxNativeMethods.SecretSchemaAttributeType.SECRET_SCHEMA_ATTRIBUTE_STRING); + } +} diff --git a/sdk/identity/Azure.Identity/src/MacosNativeMethods.cs b/sdk/identity/Azure.Identity/src/MacosNativeMethods.cs new file mode 100644 index 000000000000..107be105eb47 --- /dev/null +++ b/sdk/identity/Azure.Identity/src/MacosNativeMethods.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace Azure.Identity +{ + internal static class MacosNativeMethods + { + public const int SecStatusCodeSuccess = 0; + public const int SecStatusCodeNoSuchKeychain = -25294; + public const int SecStatusCodeInvalidKeychain = -25295; + public const int SecStatusCodeAuthFailed = -25293; + public const int SecStatusCodeDuplicateItem = -25299; + public const int SecStatusCodeItemNotFound = -25300; + public const int SecStatusCodeInteractionNotAllowed = -25308; + public const int SecStatusCodeInteractionRequired = -25315; + public const int SecStatusCodeNoSuchAttr = -25303; + + public readonly struct CFRange + { + public readonly int Location, Length; + public CFRange (int location, int length) + { + Location = location; + Length = length; + } + } + + public static void SecKeychainFindGenericPassword(IntPtr keychainOrArray, string serviceName, string accountName, out int passwordLength, out IntPtr credentialsPtr, out IntPtr itemRef) + { + byte[] serviceNameBytes = Encoding.UTF8.GetBytes(serviceName); + byte[] accountNameBytes = Encoding.UTF8.GetBytes(accountName); + + ThrowIfError(Imports.SecKeychainFindGenericPassword(keychainOrArray, serviceNameBytes.Length, serviceNameBytes, accountNameBytes.Length, accountNameBytes, out passwordLength, out credentialsPtr, out itemRef)); + } + + public static void SecKeychainAddGenericPassword(IntPtr keychainOrArray, string serviceName, string accountName, string password, out IntPtr itemRef) + { + byte[] serviceNameBytes = Encoding.UTF8.GetBytes(serviceName); + byte[] accountNameBytes = Encoding.UTF8.GetBytes(accountName); + byte[] passwordBytes = Encoding.UTF8.GetBytes(password); + + ThrowIfError(Imports.SecKeychainAddGenericPassword(keychainOrArray, serviceNameBytes.Length, serviceNameBytes, accountNameBytes.Length, accountNameBytes, password.Length, passwordBytes, out itemRef)); + } + + public static void SecKeychainItemDelete(IntPtr itemRef) => ThrowIfError(Imports.SecKeychainItemDelete(itemRef)); + + public static void SecKeychainItemFreeContent(IntPtr attrList, IntPtr data) => ThrowIfError(Imports.SecKeychainItemFreeContent(attrList, data)); + + public static void CFRelease(IntPtr cfRef) + { + if (cfRef != IntPtr.Zero) + { + Imports.CFRelease(cfRef); + } + } + + private static void ThrowIfError(int status) + { + if (status != SecStatusCodeSuccess) + { + throw new InvalidOperationException(GetErrorMessageString(status)); + } + } + + private static string GetErrorMessageString(int status) + { + IntPtr messagePtr = IntPtr.Zero; + try + { + messagePtr = Imports.SecCopyErrorMessageString(status, IntPtr.Zero); + return GetStringFromCFStringPtr(messagePtr); + } + catch + { + return status switch + { + SecStatusCodeNoSuchKeychain => $"The keychain does not exist. [0x{status:x}]", + SecStatusCodeInvalidKeychain => $"The keychain is not valid. [0x{status:x}]", + SecStatusCodeAuthFailed => $"Authorization/Authentication failed. [0x{status:x}]", + SecStatusCodeDuplicateItem => $"The item already exists. [0x{status:x}]", + SecStatusCodeItemNotFound => $"The item cannot be found. [0x{status:x}]", + SecStatusCodeInteractionNotAllowed => $"Interaction with the Security Server is not allowed. [0x{status:x}]", + SecStatusCodeInteractionRequired => $"User interaction is required. [0x{status:x}]", + SecStatusCodeNoSuchAttr => $"The attribute does not exist. [0x{status:x}]", + _ => $"Unknown error. [0x{status:x}]", + }; + } + finally + { + CFRelease(messagePtr); + } + } + + private static string GetStringFromCFStringPtr(IntPtr handle) + { + IntPtr stringPtr = IntPtr.Zero; + try + { + int length = Imports.CFStringGetLength (handle); + stringPtr = Imports.CFStringGetCharactersPtr(handle); + + if (stringPtr == IntPtr.Zero) + { + var range = new CFRange(0, length); + stringPtr = Marshal.AllocCoTaskMem(length * 2); + Imports.CFStringGetCharacters(handle, range, stringPtr); + } + + return Marshal.PtrToStringAuto(stringPtr, length); + } + finally + { + if (stringPtr != IntPtr.Zero) + { + Marshal.FreeCoTaskMem (stringPtr); + } + } + } + + public static class Imports + { + private const string CoreFoundationLibrary = "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"; + private const string SecurityLibrary = "/System/Library/Frameworks/Security.framework/Security"; + + [DllImport (CoreFoundationLibrary, CharSet=CharSet.Unicode)] + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.SafeDirectories)] + public static extern int CFStringGetLength (IntPtr handle); + + [DllImport (CoreFoundationLibrary, CharSet=CharSet.Unicode)] + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.SafeDirectories)] + public static extern IntPtr CFStringGetCharactersPtr (IntPtr handle); + + [DllImport (CoreFoundationLibrary, CharSet=CharSet.Unicode)] + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.SafeDirectories)] + public static extern IntPtr CFStringGetCharacters (IntPtr handle, CFRange range, IntPtr buffer); + + [DllImport (CoreFoundationLibrary, CharSet=CharSet.Unicode)] + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.SafeDirectories)] + public static extern void CFRelease(IntPtr cfRef); + + [DllImport (SecurityLibrary)] + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.SafeDirectories)] + public static extern int SecKeychainFindGenericPassword ( + IntPtr keychainOrArray, + int serviceNameLength, + byte[] serviceName, + int accountNameLength, + byte[] accountName, + out int passwordLength, + out IntPtr passwordData, + out IntPtr itemRef); + + [DllImport (SecurityLibrary)] + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.SafeDirectories)] + public static extern int SecKeychainAddGenericPassword ( + IntPtr keychain, + int serviceNameLength, + byte[] serviceName, + int accountNameLength, + byte[] accountName, + int passwordLength, + byte[] passwordData, + out IntPtr itemRef); + + [DllImport (SecurityLibrary)] + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.SafeDirectories)] + public static extern int SecKeychainItemDelete(IntPtr itemRef); + + [DllImport (SecurityLibrary)] + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.SafeDirectories)] + public static extern int SecKeychainItemFreeContent (IntPtr attrList, IntPtr data); + + [DllImport (SecurityLibrary)] + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.SafeDirectories)] + public static extern IntPtr SecCopyErrorMessageString (int status, IntPtr reserved); + } + } +} diff --git a/sdk/identity/Azure.Identity/src/MacosVisualStudioCodeAdapter.cs b/sdk/identity/Azure.Identity/src/MacosVisualStudioCodeAdapter.cs new file mode 100644 index 000000000000..22665f00fd7a --- /dev/null +++ b/sdk/identity/Azure.Identity/src/MacosVisualStudioCodeAdapter.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Globalization; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using Azure.Core; + +namespace Azure.Identity +{ + internal sealed class MacosVisualStudioCodeAdapter : IVisualStudioCodeAdapter + { + private static readonly string s_userSettingsJsonPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Application Support", "Code", "User", "settings.json"); + + public string GetUserSettingsPath() => s_userSettingsJsonPath; + + public string GetCredentials(string serviceName, string accountName) + { + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + IntPtr credentialsPtr = IntPtr.Zero; + IntPtr itemRef = IntPtr.Zero; + + try + { + MacosNativeMethods.SecKeychainFindGenericPassword(IntPtr.Zero, serviceName, accountName, out int passwordLength, out credentialsPtr, out itemRef); + return passwordLength > 0 ? Marshal.PtrToStringAnsi(credentialsPtr, passwordLength) : throw new InvalidOperationException("No password found"); + } + finally + { + try + { + MacosNativeMethods.SecKeychainItemFreeContent(IntPtr.Zero, credentialsPtr); + } + finally + { + MacosNativeMethods.CFRelease(itemRef); + } + } + } + } +} diff --git a/sdk/identity/Azure.Identity/src/MsalPublicClient.cs b/sdk/identity/Azure.Identity/src/MsalPublicClient.cs index e57533a8d36a..df32552f2f3a 100644 --- a/sdk/identity/Azure.Identity/src/MsalPublicClient.cs +++ b/sdk/identity/Azure.Identity/src/MsalPublicClient.cs @@ -65,5 +65,10 @@ public virtual async Task AcquireTokenWithDeviceCodeAsync( { return await _client.AcquireTokenWithDeviceCode(scopes, deviceCodeCallback).ExecuteAsync(async, cancellationToken).ConfigureAwait(false); } + + public virtual async Task AcquireTokenWithDeviceCodeAsync(string[] scopes, string storedCredentials, AzureCloudInstance azureCloudInstance, string tenant, bool async, CancellationToken cancellationToken) + { + return await ((IByRefreshToken)_client).AcquireTokenByRefreshToken(scopes, storedCredentials).WithAuthority(azureCloudInstance, tenant).ExecuteAsync(async, cancellationToken).ConfigureAwait(false); + } } } diff --git a/sdk/identity/Azure.Identity/src/UsernamePasswordCredential.cs b/sdk/identity/Azure.Identity/src/UsernamePasswordCredential.cs index 984caa3cea49..75783d66036f 100644 --- a/sdk/identity/Azure.Identity/src/UsernamePasswordCredential.cs +++ b/sdk/identity/Azure.Identity/src/UsernamePasswordCredential.cs @@ -12,7 +12,7 @@ namespace Azure.Identity { /// - /// Enables authentication to Azure Active Directory using a user's username and password. If the user has MFA enabled this + /// Enables authentication to Azure Active Directory using a user's username and password. If the user has MFA enabled this /// credential will fail to get a token throwing an . Also, this credential requires a high degree of /// trust and is not recommended outside of prototyping when more secure credentials can be used. /// diff --git a/sdk/identity/Azure.Identity/src/VisualStudioCodeCredential.cs b/sdk/identity/Azure.Identity/src/VisualStudioCodeCredential.cs new file mode 100644 index 000000000000..4b1d23aac732 --- /dev/null +++ b/sdk/identity/Azure.Identity/src/VisualStudioCodeCredential.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Microsoft.Identity.Client; + +namespace Azure.Identity +{ + /// + /// Enables authentication to Azure Active Directory using data from Visual Studio Code + /// + internal class VisualStudioCodeCredential : TokenCredential + { + private const string CredentialsSection = "VS Code Azure"; + private const string ClientId = "aebc6443-996d-45c2-90f0-388ff96faa56"; + private readonly IVisualStudioCodeAdapter _vscAdapter; + private readonly IFileSystemService _fileSystem; + private readonly CredentialPipeline _pipeline; + private readonly string _tenantId; + private readonly MsalPublicClient _client; + + /// + /// Protected constructor for mocking + /// + protected VisualStudioCodeCredential() : this(default, default) {} + + /// + public VisualStudioCodeCredential(string tenantId, TokenCredentialOptions options) : this(tenantId, options, default, default) {} + + internal VisualStudioCodeCredential(string tenantId, TokenCredentialOptions options, IFileSystemService fileSystem, IVisualStudioCodeAdapter vscAdapter) + : this(tenantId, CredentialPipeline.GetInstance(options), fileSystem, vscAdapter) + { + } + + internal VisualStudioCodeCredential(string tenantId, CredentialPipeline pipeline, IFileSystemService fileSystem, IVisualStudioCodeAdapter vscAdapter) + : this(tenantId, pipeline, pipeline.CreateMsalPublicClient(ClientId), fileSystem, vscAdapter) + { + } + + internal VisualStudioCodeCredential(string tenantId, CredentialPipeline pipeline, MsalPublicClient client, IFileSystemService fileSystem, IVisualStudioCodeAdapter vscAdapter) + { + _tenantId = tenantId ?? "common"; + _pipeline = pipeline; + _client = client; + _fileSystem = fileSystem ?? FileSystemService.Default; + _vscAdapter = vscAdapter ?? GetVscAdapter(); + } + + /// + public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) + => await GetTokenImplAsync(requestContext, true, cancellationToken).ConfigureAwait(false); + + /// + public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) + => GetTokenImplAsync(requestContext, false, cancellationToken).EnsureCompleted(); + + private async ValueTask GetTokenImplAsync(TokenRequestContext requestContext, bool async, CancellationToken cancellationToken) + { + using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("VisualStudioCodeCredential.GetToken", requestContext); + + try + { + GetUserSettings(out var tenant, out var environmentName); + + var cloudInstance = GetAzureCloudInstance(environmentName); + var storedCredentials = _vscAdapter.GetCredentials(CredentialsSection, environmentName); + + if (!IsBase64UrlString(storedCredentials)) + { + throw new CredentialUnavailableException("Need to re-authenticate user in VSCode Azure Account."); + } + + var result = await _client.AcquireTokenWithDeviceCodeAsync(requestContext.Scopes, storedCredentials, cloudInstance, tenant, async, cancellationToken).ConfigureAwait(false); + return scope.Succeeded(new AccessToken(result.AccessToken, result.ExpiresOn)); + } + catch (OperationCanceledException e) + { + scope.Failed(e); + throw; + } + catch (Exception e) + { + throw scope.FailAndWrap(e); + } + } + + private static bool IsBase64UrlString(string str) + { + for (var index = 0; index < str.Length; index++) + { + var ch = (uint)str[index]; + if ((ch < '0' || ch > '9') && (ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && ch != '_' && ch != '-') + { + return false; + } + } + + return true; + } + + private void GetUserSettings(out string tenant, out string environmentName) + { + var path = _vscAdapter.GetUserSettingsPath(); + tenant = _tenantId; + environmentName = "Azure"; + + try + { + var content = _fileSystem.ReadAllText(path); + var root = JsonDocument.Parse(content).RootElement; + + if (root.TryGetProperty("azure.tenant", out JsonElement tenantProperty)) + { + tenant = tenantProperty.GetString(); + } + + if (root.TryGetProperty("azure.cloud", out JsonElement environmentProperty)) + { + environmentName = environmentProperty.GetString(); + } + } + catch (IOException) { } + catch (JsonException) { } + } + + private static IVisualStudioCodeAdapter GetVscAdapter() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return new WindowsVisualStudioCodeAdapter(); + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + return new MacosVisualStudioCodeAdapter(); + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + return new LinuxVisualStudioCodeAdapter(); + } + + throw new PlatformNotSupportedException(); + } + + private static AzureCloudInstance GetAzureCloudInstance(string name) => + name switch + { + "Azure" => AzureCloudInstance.AzurePublic, + "AzureChina" => AzureCloudInstance.AzureChina, + "AzureGermanCloud" => AzureCloudInstance.AzureGermany, + "AzureUSGovernment" => AzureCloudInstance.AzureUsGovernment, + _ => AzureCloudInstance.AzurePublic + }; + } +} diff --git a/sdk/identity/Azure.Identity/src/VisualStudioCredential.cs b/sdk/identity/Azure.Identity/src/VisualStudioCredential.cs index f297994db0a4..41fbbd39ef0f 100644 --- a/sdk/identity/Azure.Identity/src/VisualStudioCredential.cs +++ b/sdk/identity/Azure.Identity/src/VisualStudioCredential.cs @@ -72,7 +72,8 @@ private async ValueTask GetTokenImplAsync(TokenRequestContext reque throw new CredentialUnavailableException("No installed instance of Visual Studio was found"); } - return await RunProcessesAsync(processStartInfos, async, cancellationToken).ConfigureAwait(false); + var accessToken = await RunProcessesAsync(processStartInfos, async, cancellationToken).ConfigureAwait(false); + return scope.Succeeded(accessToken); } catch (OperationCanceledException e) { diff --git a/sdk/identity/Azure.Identity/src/WindowsNativeMethods.cs b/sdk/identity/Azure.Identity/src/WindowsNativeMethods.cs new file mode 100644 index 000000000000..8fd589d7fa13 --- /dev/null +++ b/sdk/identity/Azure.Identity/src/WindowsNativeMethods.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Azure.Identity +{ + internal static class WindowsNativeMethods + { + public enum CRED_PERSIST : uint + { + CRED_PERSIST_SESSION = 1, + CRED_PERSIST_LOCAL_MACHINE = 2, + CRED_PERSIST_ENTERPRISE = 3 + } + + public enum CRED_TYPE + { + GENERIC = 1, + DOMAIN_PASSWORD = 2, + DOMAIN_CERTIFICATE = 3, + DOMAIN_VISIBLE_PASSWORD = 4, + MAXIMUM = 5 + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct CredentialData + { + public uint Flags; + public CRED_TYPE Type; + public string TargetName; + public string Comment; + public System.Runtime.InteropServices.ComTypes.FILETIME LastWritten; + public uint CredentialBlobSize; + public IntPtr CredentialBlob; + public CRED_PERSIST Persist; + public uint AttributeCount; + public IntPtr Attributes; + public string TargetAlias; + public string UserName; + } + + public const int ERROR_NOT_FOUND = 1168; + + public const uint FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100; + public const uint FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200; + public const uint FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000; + + public static IntPtr CredRead(string target, CRED_TYPE type) + { + ThrowIfFailed(Imports.CredRead(target, type, 0, out IntPtr userCredential)); + return userCredential; + } + + public static void CredWrite(IntPtr userCredential) => ThrowIfFailed(Imports.CredWrite(userCredential, 0)); + + public static void CredDelete(string target, CRED_TYPE type) => ThrowIfFailed(Imports.CredDelete(target, type, 0)); + + public static void CredFree(IntPtr userCredential) + { + if (userCredential != IntPtr.Zero) + { + Imports.CredFree(userCredential); + } + } + + private static void ThrowIfFailed(bool isSucceeded, [CallerMemberName] string methodName = default) + { + if (isSucceeded) + { + return; + } + + var error = Marshal.GetLastWin32Error(); + var message = error == ERROR_NOT_FOUND ? $"{methodName} has failed but error is unknown." : MessageFromErrorCode(error); + throw new InvalidOperationException(message); + } + + private static string MessageFromErrorCode(int errorCode) + { + // Twy Win32 first + uint flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; + + IntPtr messageBuffer = IntPtr.Zero; + string message = null; + + try + { + var length = Imports.FormatMessage(flags, IntPtr.Zero, errorCode, 0, ref messageBuffer, 0, IntPtr.Zero); + if (length == 0) + { + // If failed, try to convert NTSTATUS to Win32 error + int code = Imports.RtlNtStatusToDosError(errorCode); + return new Win32Exception(code).Message; + } + } + finally + { + if (messageBuffer != IntPtr.Zero) + { + message = Marshal.PtrToStringUni(messageBuffer); + Marshal.FreeHGlobal(messageBuffer); + } + } + + return message ?? string.Empty; + } + + private static class Imports + { + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)] + public static extern uint FormatMessage(uint dwFlags, IntPtr lpSource, int dwMessageId, uint dwLanguageId, ref IntPtr lpBuffer, uint nSize, IntPtr pArguments); + + [DllImport("ntdll.dll")] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)] + public static extern int RtlNtStatusToDosError(int Status); + + [DllImport("advapi32.dll", EntryPoint = "CredReadW", CharSet = CharSet.Unicode, SetLastError = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)] + public static extern bool CredRead(string target, CRED_TYPE type, int reservedFlag, out IntPtr userCredential); + + [DllImport("advapi32.dll", EntryPoint = "CredWriteW", CharSet = CharSet.Unicode, SetLastError = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)] + public static extern bool CredWrite(IntPtr userCredential, int reservedFlag); + + [DllImport("advapi32.dll", EntryPoint = "CredDeleteW", CharSet = CharSet.Unicode, SetLastError = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)] + public static extern bool CredDelete(string target, CRED_TYPE type, int reservedFlag); + + [DllImport("advapi32.dll", SetLastError = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)] + public static extern void CredFree([In] IntPtr buffer); + } + } +} diff --git a/sdk/identity/Azure.Identity/src/WindowsVisualStudioCodeAdapter.cs b/sdk/identity/Azure.Identity/src/WindowsVisualStudioCodeAdapter.cs new file mode 100644 index 000000000000..c0eb72b71958 --- /dev/null +++ b/sdk/identity/Azure.Identity/src/WindowsVisualStudioCodeAdapter.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ComponentModel; +using System.IO; +using System.Runtime.InteropServices; + +namespace Azure.Identity +{ + internal sealed class WindowsVisualStudioCodeAdapter : IVisualStudioCodeAdapter + { + private static readonly string s_userSettingsJsonPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Code", "User", "settings.json"); + + public string GetUserSettingsPath() => s_userSettingsJsonPath; + + public string GetCredentials(string serviceName, string accountName) + { + IntPtr credentials = WindowsNativeMethods.CredRead($"{serviceName}/{accountName}", WindowsNativeMethods.CRED_TYPE.GENERIC); + try + { + WindowsNativeMethods.CredentialData credData = Marshal.PtrToStructure(credentials); + return Marshal.PtrToStringAnsi(credData.CredentialBlob, (int) credData.CredentialBlobSize); + } + finally + { + WindowsNativeMethods.CredFree(credentials); + } + } + } +} diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential.json new file mode 100644 index 000000000000..e62c0d071f00 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential.json @@ -0,0 +1,255 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fc54fac88-3dd3-461f-a7c4-8a368e0340b3%2Foauth2%2Fv2.0%2Fauthorize", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "1a732f34-30f8-4e6d-ab46-d4e9ac3ff6b5", + "return-client-request-id": "true", + "traceparent": "00-e74f7d12082873418d2cff25dc3f8d9d-05a1725860e5f947-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "2922e79c517fdf8a3c060ffa683dd147", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "1a732f34-30f8-4e6d-ab46-d4e9ac3ff6b5", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:38 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcU; expires=Fri, 01-May-2020 15:56:38 GMT; path=/; secure; HttpOnly; SameSite=None", + "esctx=AQABAAAAAAAm-06blBE1TpVMil8KPQ41h9jW8Y95qDHWQxrd0pMkwt3V5coOHWQjWrweI-olGZjwVgVzLApfFeKwjt5YUJnVq5A_S5hQv-FBftjz0_LA82BPXHVsFt7bW7eaJODxehDtbqvEp1t5GRRbiPo2yUeQ63O-muvnn4GZ58CGanOTOUiNtbEBSAHYGcEEQ-5OK74gAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; SameSite=None; secure; HttpOnly" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "7f47e78d-3085-49e9-bb36-3cce42784b00" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "1a732f34-30f8-4e6d-ab46-d4e9ac3ff6b5", + "return-client-request-id": "true", + "traceparent": "00-e74f7d12082873418d2cff25dc3f8d9d-ead38ea20d1a9c4c-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "5bb30c46884590149c8d8c0159919a24", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "1a732f34-30f8-4e6d-ab46-d4e9ac3ff6b5", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:38 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcU; expires=Fri, 01-May-2020 15:56:38 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "841eba84-8a6c-431b-b032-7284668f5200" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "1a732f34-30f8-4e6d-ab46-d4e9ac3ff6b5", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-e74f7d12082873418d2cff25dc3f8d9d-599fcff8a8c74644-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "a642545434245438e18b377bc68f677b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "1a732f34-30f8-4e6d-ab46-d4e9ac3ff6b5", + "Content-Length": "4106", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:38 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAQAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:39 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,763.4106,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "324ef248-0303-4815-a773-a58eb8d55300" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "profile openid email 00000003-0000-0000-c000-000000000000/user_impersonation 00000003-0000-0000-c000-000000000000/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJhZWJjNjQ0My05OTZkLTQ1YzItOTBmMC0zODhmZjk2ZmFhNTYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODU3NTYyOTgsIm5iZiI6MTU4NTc1NjI5OCwiZXhwIjoxNTg1NzYwMTk4LCJhaW8iOiJBVFFBeS84UEFBQUFuZ2hZWHZoT0ZvS0J3NkpFUGxPMUN2VjFrQjBpa2RFaU1OOXpybWY0cDkwVzEyc1F6aVhNOTZxUkNIS0pPNXBhIiwibmFtZSI6IklkZW50aXR5IFRlc3QgVXNlciIsIm9pZCI6IjQyZDhlODg0LTI2NWEtNGNkNC05MDg5LTRjM2JjNDBhZjE4MyIsInByZWZlcnJlZF91c2VybmFtZSI6ImlkZW50aXR5dGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IldtbG55VUdGOFN5SnR4dDJzMTZ2TGYtaWEwVE9TZENOTFBHc3R6X1RsYVUiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJTUEpPTWdNREZVaW5jNldPdU5WVEFBIiwidmVyIjoiMi4wIn0.ksrxgLNFsCOHiJX_zp2oOHrBi2SppdyKZsN-Vs4ukRzyFKLI2S1p72lgZ07RhvBK5iFupPgq9nb5h4fuuj76Tzav3O31WI9YHSWLn8MgTL1mygcnRJj8s6qGfExmcNjP82cDX4PEYZt20vf-WK9nlveiXdCwC7JPVhrB4Xf9H0NvnKRlb3cm-M9cclr_uknvauMjig32W_KoOOUC8odxjtNAFuDIxc0Kz1KLEDL0ob3EzF_3EhVmKU4EFmn5AShdBIMY_kEVovG2t4tqUNFziYP2CVvHtJGLUZUlcskItOWCrY6x2TvUzitNKHYXbTPGBU-P_URo3jzt5OXkYQ7SXg", + "client_info": "eyJ1aWQiOiI0MmQ4ZTg4NC0yNjVhLTRjZDQtOTA4OS00YzNiYzQwYWYxODMiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "621468287" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredentialAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredentialAsync.json new file mode 100644 index 000000000000..62c66e780e06 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredentialAsync.json @@ -0,0 +1,255 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fc54fac88-3dd3-461f-a7c4-8a368e0340b3%2Foauth2%2Fv2.0%2Fauthorize", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "c1de98a1-1394-4f65-85cd-f8c7208d4470", + "return-client-request-id": "true", + "traceparent": "00-b23d05a9778e374c9646a2991fcb844c-87333932bcd7c745-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "2df47badcc1973b4e2e683b8d12546a0", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "c1de98a1-1394-4f65-85cd-f8c7208d4470", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 18:08:33 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=Ah_OXNIG7XFLrvIak3sSlr4; expires=Fri, 01-May-2020 18:08:34 GMT; path=/; secure; HttpOnly; SameSite=None", + "esctx=AQABAAAAAAAm-06blBE1TpVMil8KPQ411VhjviMGW07eVlYuP5bzAOEyB573lJxd_le-mpKFVEI-A9i7dqyYgnQjl0bfG-mf2H2TaPnKcSh0R9CcZPRqo5WdyEOr90cjh1IWAumyMlJfJrIvhoQnZbGYovVplN-F8ytippbdXOXdXlPaFN41RHCBKaM0i912IdDtASMWbMcgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; SameSite=None; secure; HttpOnly" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "69adb4eb-6ec0-4e99-88a5-bc02cd065b00" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "c1de98a1-1394-4f65-85cd-f8c7208d4470", + "return-client-request-id": "true", + "traceparent": "00-b23d05a9778e374c9646a2991fcb844c-f34e8de7a284794e-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "2ccc2d93d10c4ccd019bf804d48bd946", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "c1de98a1-1394-4f65-85cd-f8c7208d4470", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 18:08:33 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=Ah_OXNIG7XFLrvIak3sSlr4; expires=Fri, 01-May-2020 18:08:34 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "fd0fd6ed-ed42-43ab-af2c-220fc2765800" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "c1de98a1-1394-4f65-85cd-f8c7208d4470", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-b23d05a9778e374c9646a2991fcb844c-ab65f279f8aa7a40-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "1eec6d7d75d6e58b1a6859112af87d94", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "c1de98a1-1394-4f65-85cd-f8c7208d4470", + "Content-Length": "4112", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 18:08:33 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=Ah_OXNIG7XFLrvIak3sSlr5lEICiAQAAAKLPFtYOAAAA; expires=Fri, 01-May-2020 18:08:34 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,656.1021,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "33b3e92d-9aef-4896-975f-47ef692c4800" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "profile openid email 00000003-0000-0000-c000-000000000000/user_impersonation 00000003-0000-0000-c000-000000000000/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJhZWJjNjQ0My05OTZkLTQ1YzItOTBmMC0zODhmZjk2ZmFhNTYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODU3NjQyMTQsIm5iZiI6MTU4NTc2NDIxNCwiZXhwIjoxNTg1NzY4MTE0LCJhaW8iOiJBVFFBeS84UEFBQUE4THRzUnAvQzhpdktpNW1OU2tCNFdhczkyYWQzTTY2VkFSM0xhYk1lWFA0enVYVnBYUFZIdzZ6WFNYdXF0YTFyIiwibmFtZSI6IklkZW50aXR5IFRlc3QgVXNlciIsIm9pZCI6IjQyZDhlODg0LTI2NWEtNGNkNC05MDg5LTRjM2JjNDBhZjE4MyIsInByZWZlcnJlZF91c2VybmFtZSI6ImlkZW50aXR5dGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IldtbG55VUdGOFN5SnR4dDJzMTZ2TGYtaWEwVE9TZENOTFBHc3R6X1RsYVUiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJMZW16TS0tYWxraVhYMGZ2YVN4SUFBIiwidmVyIjoiMi4wIn0.DVh1b7IBMeGDVuJAIQPlH-i8VJMFHB6LLxgZjoTfmsA5cR_NduigTexyWIleKPCrB2gqupNsEDnnbusYdSvMGOg1oVqC26iWX-RrUDTXjf6okd34z_m-X-N2fo5NdRRjln7u7D7LZYMfySzPlIc4_j10r2SzWKG12YPHjQwBE84sDv1c3fAmEmXL0UFC4IirN1recglrqzhcUUyMJaO39vOFjyeeEvStByeJckBuQVhWE9zxOQboE4V6FLEDLqB_H9Hvcm82RQJLT3suJa2u57f6ei9GXHzKZFSBOK7Pl1jdVZSYuh5Z-Go3qG5OcJCKPmOXO5SoA3l0op8Z3DtbPQ", + "client_info": "eyJ1aWQiOiI0MmQ4ZTg4NC0yNjVhLTRjZDQtOTA4OS00YzNiYzQwYWYxODMiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "672667440" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_AuthenticationCodeInsteadOfRefreshToken.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_AuthenticationCodeInsteadOfRefreshToken.json new file mode 100644 index 000000000000..aaa2600b81fc --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_AuthenticationCodeInsteadOfRefreshToken.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "1872607964" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_AuthenticationCodeInsteadOfRefreshTokenAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_AuthenticationCodeInsteadOfRefreshTokenAsync.json new file mode 100644 index 000000000000..0329e5a30686 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_AuthenticationCodeInsteadOfRefreshTokenAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "1710709823" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_BrokenSettingsFile.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_BrokenSettingsFile.json new file mode 100644 index 000000000000..3fee2dbdc969 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_BrokenSettingsFile.json @@ -0,0 +1,254 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fc54fac88-3dd3-461f-a7c4-8a368e0340b3%2Foauth2%2Fv2.0%2Fauthorize", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "c1cb9255-f810-474d-9cdc-817e4c61763c", + "return-client-request-id": "true", + "traceparent": "00-c0793d1b96a11a409fc23736303d9617-b49eed2446c1774e-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "dc244e5b5371dd01a4da46a4060a75fd", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "c1cb9255-f810-474d-9cdc-817e4c61763c", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:38 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAQAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:39 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "111bfb3b-183f-4b7c-910f-a7f686ad4e00" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "c1cb9255-f810-474d-9cdc-817e4c61763c", + "return-client-request-id": "true", + "traceparent": "00-c0793d1b96a11a409fc23736303d9617-23d596216c066047-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "0d39717ee0f85447c268195631055faa", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "c1cb9255-f810-474d-9cdc-817e4c61763c", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:39 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAQAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:39 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "c351dbfc-543e-4581-9172-5bcd8bbc5100" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "c1cb9255-f810-474d-9cdc-817e4c61763c", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-c0793d1b96a11a409fc23736303d9617-0fc2ad6307a5334e-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "339ea785a3b3f591449055276f560b3a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "c1cb9255-f810-474d-9cdc-817e4c61763c", + "Content-Length": "4106", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:39 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAgAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:39 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,339.0719,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "7f7093fb-85bf-4674-9d2f-b0d78acb3f00" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "profile openid email 00000003-0000-0000-c000-000000000000/user_impersonation 00000003-0000-0000-c000-000000000000/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJhZWJjNjQ0My05OTZkLTQ1YzItOTBmMC0zODhmZjk2ZmFhNTYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODU3NTYyOTksIm5iZiI6MTU4NTc1NjI5OSwiZXhwIjoxNTg1NzYwMTk5LCJhaW8iOiJBVFFBeS84UEFBQUE1SGxTS3owaGZRclYvN3JJMkR6SjBLb0ZFUWc1WFlFcXYvS21tblNaOUp6ZG5aYkhKSmJmb2E5WFhrcVB6cGhqIiwibmFtZSI6IklkZW50aXR5IFRlc3QgVXNlciIsIm9pZCI6IjQyZDhlODg0LTI2NWEtNGNkNC05MDg5LTRjM2JjNDBhZjE4MyIsInByZWZlcnJlZF91c2VybmFtZSI6ImlkZW50aXR5dGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IldtbG55VUdGOFN5SnR4dDJzMTZ2TGYtaWEwVE9TZENOTFBHc3R6X1RsYVUiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiItNU53ZjctRmRFYWRMN0RYaXNzX0FBIiwidmVyIjoiMi4wIn0.JNzLWhx_0Vsle_9AQMs7BzQyb8q8RjLq7sj46mVPoi53Hcd4mQNglEncICJW-3BQuydh9uSkavQrLj0423iV_y8e18tYR072Y6swEnhVqiyuNLZliwYBmklFQYG2otQ9D0oToNH8az6is42oIr3peFzhH19w5IW2YhGzFbLJQlAztf1xzO0zQVbqhQMLM7JjL-4P_gIMkK6fyQVK7nH2BYWqBh4dxyFsiCZmB6eALgcUfchWpMZbGHd17enBCpXuob1tGxkogAzkZerbecYX7zq-rbFEFdB08IvAU3T6HEHQvT8qRarbFrLNbv7vduVvOAb6gL1eZPKqk9xEd9OozQ", + "client_info": "eyJ1aWQiOiI0MmQ4ZTg4NC0yNjVhLTRjZDQtOTA4OS00YzNiYzQwYWYxODMiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "1087424336" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_BrokenSettingsFileAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_BrokenSettingsFileAsync.json new file mode 100644 index 000000000000..df923134c562 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_BrokenSettingsFileAsync.json @@ -0,0 +1,254 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fc54fac88-3dd3-461f-a7c4-8a368e0340b3%2Foauth2%2Fv2.0%2Fauthorize", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "871590da-57cb-47c1-b857-776f0e7cb05a", + "return-client-request-id": "true", + "traceparent": "00-c54d429e5da20d4da08809ee00163622-a11c47108bd35243-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "c41dbb01316a7ce94d52af052985f3fc", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "871590da-57cb-47c1-b857-776f0e7cb05a", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:42 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiBgAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:43 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "79e64632-a823-441f-9db2-c8577f454400" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "871590da-57cb-47c1-b857-776f0e7cb05a", + "return-client-request-id": "true", + "traceparent": "00-c54d429e5da20d4da08809ee00163622-b3c912ff31646643-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "daa4420d3dd5ca392cad8bd2547dddca", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "871590da-57cb-47c1-b857-776f0e7cb05a", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:42 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiBgAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:43 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "dced97d3-767f-4985-bcf5-1709fea24f00" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "871590da-57cb-47c1-b857-776f0e7cb05a", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-c54d429e5da20d4da08809ee00163622-e018316092382e42-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "51738b816532e74686f06a2c29111b06", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "871590da-57cb-47c1-b857-776f0e7cb05a", + "Content-Length": "4112", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:42 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiBwAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:43 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,311.5756,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "fb5e20b6-230d-4159-8df6-06be9dba5000" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "profile openid email 00000003-0000-0000-c000-000000000000/user_impersonation 00000003-0000-0000-c000-000000000000/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJhZWJjNjQ0My05OTZkLTQ1YzItOTBmMC0zODhmZjk2ZmFhNTYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODU3NTYzMDMsIm5iZiI6MTU4NTc1NjMwMywiZXhwIjoxNTg1NzYwMjAzLCJhaW8iOiJBVFFBeS84UEFBQUFhek1udktHYTJYVFdrSVprUXVwRFJkTVN1QWlLUm8xTHRWTTlyNDJtaDdaWk5vbkU2R3pDUVdHUk92ZVNjRTlLIiwibmFtZSI6IklkZW50aXR5IFRlc3QgVXNlciIsIm9pZCI6IjQyZDhlODg0LTI2NWEtNGNkNC05MDg5LTRjM2JjNDBhZjE4MyIsInByZWZlcnJlZF91c2VybmFtZSI6ImlkZW50aXR5dGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IldtbG55VUdGOFN5SnR4dDJzMTZ2TGYtaWEwVE9TZENOTFBHc3R6X1RsYVUiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJ0aUJlLXcwaldVR045Z2EtbmJwUUFBIiwidmVyIjoiMi4wIn0.N-wagpkZMOkANkXk-XOR7UNF9dKF2EPGG1AiELrjM-x2o5xWNRb_UjwvW_okCWefkCYfEaw9vk7UTLHKcVqAJK_ChnQr33AZEKRGGGi0PkREjx7DGYRefy8DiU2qGIb-hWbz1fp_GIvbeiy_lvYXX7u3H6nnJK3hiUxGuP1dX0zRpmU1Vz8BIcjR42LXCFcwx728GEdCmrSERVyyEryxOqK3xiLEgVI3JZTL2r47yZdgb6ST5xCu0AAOP7SF-mPCshymDUSqZMSSA-93qceHnsGK_V0NPPNXfexN4D6UUJ1YXTmQ1K8TjdU9QgYMNW3c3pKKvSd2XjCQnEsrQv1TpQ", + "client_info": "eyJ1aWQiOiI0MmQ4ZTg4NC0yNjVhLTRjZDQtOTA4OS00YzNiYzQwYWYxODMiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "416295041" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_EmptySettingsFile.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_EmptySettingsFile.json new file mode 100644 index 000000000000..b9b00df6dcab --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_EmptySettingsFile.json @@ -0,0 +1,254 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2Foauth2%2Fv2.0%2Fauthorize", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "c74ef9f4-16fa-4c37-9536-6bd8606ae40d", + "return-client-request-id": "true", + "traceparent": "00-f40aaae09199c148994e8f183055c845-b099cf5e5460644d-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "7f759735c061c49baba0ada601b6993a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "c74ef9f4-16fa-4c37-9536-6bd8606ae40d", + "Content-Length": "950", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:39 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAgAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:40 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "fc21797f-f865-414b-9fd8-3bd20ff84100" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "c74ef9f4-16fa-4c37-9536-6bd8606ae40d", + "return-client-request-id": "true", + "traceparent": "00-f40aaae09199c148994e8f183055c845-2a17c05ddce03b41-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "64b320e2d3b954105f82533e3e5e1e98", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "c74ef9f4-16fa-4c37-9536-6bd8606ae40d", + "Content-Length": "1377", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:39 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAgAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:40 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "6680076c-289c-4f7c-88e7-dfb233a14100" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/common/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/{tenantid}/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": null, + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/common/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "c74ef9f4-16fa-4c37-9536-6bd8606ae40d", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-f40aaae09199c148994e8f183055c845-170170e289f8ed4a-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "eab420ecc7c37e1a6dc6947a07c2a511", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "c74ef9f4-16fa-4c37-9536-6bd8606ae40d", + "Content-Length": "4112", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:39 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAwAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:40 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,321.6296,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "58df056d-82aa-4f14-b197-639465a44c00" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "profile openid email 00000003-0000-0000-c000-000000000000/user_impersonation 00000003-0000-0000-c000-000000000000/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJhZWJjNjQ0My05OTZkLTQ1YzItOTBmMC0zODhmZjk2ZmFhNTYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODU3NTYzMDAsIm5iZiI6MTU4NTc1NjMwMCwiZXhwIjoxNTg1NzYwMjAwLCJhaW8iOiJBVFFBeS84UEFBQUFaenc5c1J3TFNFZTlIS3hRWG91NFRYaFk1cEtzVUg0amk2Q2tsZUZ6VHdpR0hyRTFrRDdLZjc0cEZWTnk3d3NhIiwibmFtZSI6IklkZW50aXR5IFRlc3QgVXNlciIsIm9pZCI6IjQyZDhlODg0LTI2NWEtNGNkNC05MDg5LTRjM2JjNDBhZjE4MyIsInByZWZlcnJlZF91c2VybmFtZSI6ImlkZW50aXR5dGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IldtbG55VUdGOFN5SnR4dDJzMTZ2TGYtaWEwVE9TZENOTFBHc3R6X1RsYVUiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJiUVhmV0txQ0ZFLXhsMk9VWmFSTUFBIiwidmVyIjoiMi4wIn0.GCp6nA74IwHmefKcJ1MD2d_M_XXi2G7wodfJvL5cMW9PRpMiDBGYPSOl_DGtjmhpuxk0Q9GS4v4B-qgFAespYoxPhSbvlt7gPmpbH9k3jshE3YuMxTT_zGCdqM7hBZcf5iSquRMAgFO9t0a3TPhtqTvVz1Xcq1DSAhyPhgl9RV_hEw_9V219Ez1g5SXW3nrrOtCEZhwQvaBRrFgK7RtlTpdjFSpPXuRo2tT5E-lo8Cbs_3pLMQNZ_PNBAp2cdLVZnXRgBNgCWwf4YsIzkoxablFC2-VQSidrlPiJIEAUYaj9lKhgUesxIraOBHmUuMiAdTUB0PR9v9aDf7qTDgw1yw", + "client_info": "eyJ1aWQiOiI0MmQ4ZTg4NC0yNjVhLTRjZDQtOTA4OS00YzNiYzQwYWYxODMiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "1814209897" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_EmptySettingsFileAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_EmptySettingsFileAsync.json new file mode 100644 index 000000000000..f5afb932e2ad --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_EmptySettingsFileAsync.json @@ -0,0 +1,254 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2Foauth2%2Fv2.0%2Fauthorize", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "6c91e4c7-5377-49d7-92dc-1d8ec03d5d93", + "return-client-request-id": "true", + "traceparent": "00-5750f254ac402c45b6a25861fccc1086-d1377cba321c614e-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "bf33f7ef86206a342d66a853d492bfbb", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "6c91e4c7-5377-49d7-92dc-1d8ec03d5d93", + "Content-Length": "950", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:43 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiBwAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:43 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "58df056d-82aa-4f14-b197-639440a54c00" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "6c91e4c7-5377-49d7-92dc-1d8ec03d5d93", + "return-client-request-id": "true", + "traceparent": "00-5750f254ac402c45b6a25861fccc1086-7ecc7e30d241ad4f-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "4fc12a15541f69414ebef46c815c3de2", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "6c91e4c7-5377-49d7-92dc-1d8ec03d5d93", + "Content-Length": "1377", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:43 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiBwAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:43 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "d65d7dca-0715-4bd1-91fa-bbe0c8c04f00" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/common/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/{tenantid}/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": null, + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/common/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "6c91e4c7-5377-49d7-92dc-1d8ec03d5d93", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-5750f254ac402c45b6a25861fccc1086-9fa0f6e607e9af40-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "b2058c7bd37257f8c206537e7c3a5a7b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "6c91e4c7-5377-49d7-92dc-1d8ec03d5d93", + "Content-Length": "4112", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:43 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiCAAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:44 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,298.3193,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "9e92673d-83df-4a5e-b651-957a402f5000" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "profile openid email 00000003-0000-0000-c000-000000000000/user_impersonation 00000003-0000-0000-c000-000000000000/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJhZWJjNjQ0My05OTZkLTQ1YzItOTBmMC0zODhmZjk2ZmFhNTYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODU3NTYzMDQsIm5iZiI6MTU4NTc1NjMwNCwiZXhwIjoxNTg1NzYwMjA0LCJhaW8iOiJBVFFBeS84UEFBQUFmTytTbE53T29UTnZybHpua1lvVjNFc1prVlUrNHZOTmlYcDFJVFIwa0l6WTFLNFRReHpZVnIyRVNEMUF2OVU1IiwibmFtZSI6IklkZW50aXR5IFRlc3QgVXNlciIsIm9pZCI6IjQyZDhlODg0LTI2NWEtNGNkNC05MDg5LTRjM2JjNDBhZjE4MyIsInByZWZlcnJlZF91c2VybmFtZSI6ImlkZW50aXR5dGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IldtbG55VUdGOFN5SnR4dDJzMTZ2TGYtaWEwVE9TZENOTFBHc3R6X1RsYVUiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJQV2VTbnQtRFhrcTJVWlY2UUM5UUFBIiwidmVyIjoiMi4wIn0.AmW_0ezAhm4GV65SAuX5NqMWg4TNLdHED6Lee_CAyvtGvFGzB0tFm-FCgSaef7depR17znyOR0s0UhTpevQvj5teYibHk5FMRPCI-cntBGLsi1TssXTLYDfMWozPI9NYmG2rLVoFkPAUtrXJlqRVF0H3nZjTvsE-Y9S_iQwC6Qb8JY4RWFYN81t2_DvUnO6J9H6hZX9S7vg1o4heq1obdXIa9YUtxQdzobz_U5t_BAeygGh2dcSgEUTfJ3TO9blJmzMG2tCiZiaORaY0oF7xX88B1nE5OqUwgtCA4MZcLZgF5ZFG4ZFcuv8GZ5w-dGUT-qWRFy--G8hWl5Adhu06gw", + "client_info": "eyJ1aWQiOiI0MmQ4ZTg4NC0yNjVhLTRjZDQtOTA4OS00YzNiYzQwYWYxODMiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "43695011" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_InvalidRefreshToken.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_InvalidRefreshToken.json new file mode 100644 index 000000000000..698253a428f0 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_InvalidRefreshToken.json @@ -0,0 +1,169 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "51c03379-2e54-420e-b315-5945a3c7b78b", + "return-client-request-id": "true", + "traceparent": "00-b4f801e35a6cf84c9f4180fc3669f4a5-8fac04d8bfdb8f40-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "feda22738c5348ee87b601f32a091770", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "51c03379-2e54-420e-b315-5945a3c7b78b", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:40 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAwAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:40 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "fc21797f-f865-414b-9fd8-3bd21ff84100" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "51c03379-2e54-420e-b315-5945a3c7b78b", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-b4f801e35a6cf84c9f4180fc3669f4a5-d82155fafb2aca4b-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "578eac650e0f4f3d3782e09e65e18809", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 400, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "51c03379-2e54-420e-b315-5945a3c7b78b", + "Content-Length": "508", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:40 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAwAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:40 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,9002313,0,,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "c351dbfc-543e-4581-9172-5bcdc3bc5100" + }, + "ResponseBody": { + "error": "invalid_grant", + "error_description": "AADSTS9002313: Invalid request. Request is malformed or invalid.\r\nTrace ID: c351dbfc-543e-4581-9172-5bcdc3bc5100\r\nCorrelation ID: 51c03379-2e54-420e-b315-5945a3c7b78b\r\nTimestamp: 2020-04-01 15:56:40Z", + "error_codes": [ + 9002313 + ], + "timestamp": "2020-04-01 15:56:40Z", + "trace_id": "c351dbfc-543e-4581-9172-5bcdc3bc5100", + "correlation_id": "51c03379-2e54-420e-b315-5945a3c7b78b", + "error_uri": "https://login.microsoftonline.com/error?code=9002313", + "suberror": "bad_token" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "1716890069" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_InvalidRefreshTokenAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_InvalidRefreshTokenAsync.json new file mode 100644 index 000000000000..25599756526f --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_InvalidRefreshTokenAsync.json @@ -0,0 +1,169 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "23643b6e-43e0-4067-9274-cd3b80ef695e", + "return-client-request-id": "true", + "traceparent": "00-0ad16de049c9b64a973b29b721c5257c-f0b67e60d76d1541-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "0d50fe598bba955a0e109867dc7335c0", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "23643b6e-43e0-4067-9274-cd3b80ef695e", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:43 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiCAAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:44 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "e1053ea6-95b1-4990-b0e0-7fff68243f00" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "23643b6e-43e0-4067-9274-cd3b80ef695e", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-0ad16de049c9b64a973b29b721c5257c-3ba127e4e935024f-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "98e41bdcaec5af3fbf06b41a2a611e91", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 400, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "23643b6e-43e0-4067-9274-cd3b80ef695e", + "Content-Length": "508", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:43 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiCAAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:44 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,9002313,0,,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "3ea90e1f-b1e3-4f12-b05e-c67f17524900" + }, + "ResponseBody": { + "error": "invalid_grant", + "error_description": "AADSTS9002313: Invalid request. Request is malformed or invalid.\r\nTrace ID: 3ea90e1f-b1e3-4f12-b05e-c67f17524900\r\nCorrelation ID: 23643b6e-43e0-4067-9274-cd3b80ef695e\r\nTimestamp: 2020-04-01 15:56:44Z", + "error_codes": [ + 9002313 + ], + "timestamp": "2020-04-01 15:56:44Z", + "trace_id": "3ea90e1f-b1e3-4f12-b05e-c67f17524900", + "correlation_id": "23643b6e-43e0-4067-9274-cd3b80ef695e", + "error_uri": "https://login.microsoftonline.com/error?code=9002313", + "suberror": "bad_token" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "608052039" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoRefreshToken.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoRefreshToken.json new file mode 100644 index 000000000000..5e86d0ca1cc9 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoRefreshToken.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "688559220" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoRefreshTokenAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoRefreshTokenAsync.json new file mode 100644 index 000000000000..4ab112e8472c --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoRefreshTokenAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "458534226" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoSettingsFile.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoSettingsFile.json new file mode 100644 index 000000000000..59c731590e18 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoSettingsFile.json @@ -0,0 +1,254 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fc54fac88-3dd3-461f-a7c4-8a368e0340b3%2Foauth2%2Fv2.0%2Fauthorize", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "1e9d5ac8-d32d-4576-ae41-51eb3da8d7fd", + "return-client-request-id": "true", + "traceparent": "00-71825dd0f5bffa46ba6a4e9a759135c0-a7aa543bf953f24b-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "1fe1422a39c6bca960de50ae25465b16", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "1e9d5ac8-d32d-4576-ae41-51eb3da8d7fd", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:40 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAwAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:41 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "95a9b9b7-7866-4cd6-bf83-a341d7434100" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "1e9d5ac8-d32d-4576-ae41-51eb3da8d7fd", + "return-client-request-id": "true", + "traceparent": "00-71825dd0f5bffa46ba6a4e9a759135c0-71dbdbe99ea4bc48-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "dea4643e627490424899806905861b31", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "1e9d5ac8-d32d-4576-ae41-51eb3da8d7fd", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:40 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiAwAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:41 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "770433c7-b438-4fe6-b489-f81338d94f00" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "1e9d5ac8-d32d-4576-ae41-51eb3da8d7fd", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-71825dd0f5bffa46ba6a4e9a759135c0-ec36896428a4464c-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "11927a2a8d571f4a05a4e07319859e06", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "1e9d5ac8-d32d-4576-ae41-51eb3da8d7fd", + "Content-Length": "4106", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:40 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiBAAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:41 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,309.6604,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "111bfb3b-183f-4b7c-910f-a7f607ae4e00" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "profile openid email 00000003-0000-0000-c000-000000000000/user_impersonation 00000003-0000-0000-c000-000000000000/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJhZWJjNjQ0My05OTZkLTQ1YzItOTBmMC0zODhmZjk2ZmFhNTYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODU3NTYzMDEsIm5iZiI6MTU4NTc1NjMwMSwiZXhwIjoxNTg1NzYwMjAxLCJhaW8iOiJBVFFBeS84UEFBQUFEU3dnN1d6a0x5MDVlb2ZYYk9COElhYnVKT0xXSDUvYnY3eW9PMEhqZGpSQ3dXZnNFbHA1Mm9hYnh1NjhuaXBaIiwibmFtZSI6IklkZW50aXR5IFRlc3QgVXNlciIsIm9pZCI6IjQyZDhlODg0LTI2NWEtNGNkNC05MDg5LTRjM2JjNDBhZjE4MyIsInByZWZlcnJlZF91c2VybmFtZSI6ImlkZW50aXR5dGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IldtbG55VUdGOFN5SnR4dDJzMTZ2TGYtaWEwVE9TZENOTFBHc3R6X1RsYVUiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJPX3NiRVQ4WWZFdVJENmYyQjY1T0FBIiwidmVyIjoiMi4wIn0.mOlj61T-fi38k775iiepqJEQ8PxLLzik0eDONONS0qvBuiQ5xhtivTI82wHL64HiX29AvpQZBmNDf1oC5zGr_3anAH1lqqAQYroadJHj98-qx27fP_C-nB9nDTwbqsZTTvVpbRSvPeonf52r-lHIviWSrsXW1qeug4usYT7ndYY_o5tahW6fnFl41uucMeIWspwYF6uYgaEmLzxaAVeDUaWymEkZnZRHaKHWy2aNZFcDtG6uyo7bX1uKNvoI_1R8QLP2cd2TbEvnqWkpfxJYxN_avx4ezU07MyUCIVtI2F1Cb7FYB2L6ooxSES4jBn3SlIen2aGahEoHCN5torO9Dg", + "client_info": "eyJ1aWQiOiI0MmQ4ZTg4NC0yNjVhLTRjZDQtOTA4OS00YzNiYzQwYWYxODMiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "70355856" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoSettingsFileAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoSettingsFileAsync.json new file mode 100644 index 000000000000..32075b53dd58 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_NoSettingsFileAsync.json @@ -0,0 +1,254 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fc54fac88-3dd3-461f-a7c4-8a368e0340b3%2Foauth2%2Fv2.0%2Fauthorize", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "bfa9a375-0e0f-4070-b4e1-10ed9405b98a", + "return-client-request-id": "true", + "traceparent": "00-d0c73743429db84d99daccdeeb8d6f64-e5f6f0a4cf9b194e-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "450370fc267f2065b4a4cbff466dd6ff", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "bfa9a375-0e0f-4070-b4e1-10ed9405b98a", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:44 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiCAAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:44 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "7ba133ee-e83d-44d1-b0fd-5f3f70fb3c00" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "bfa9a375-0e0f-4070-b4e1-10ed9405b98a", + "return-client-request-id": "true", + "traceparent": "00-d0c73743429db84d99daccdeeb8d6f64-d30efb2ad989384d-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "37e60eeb448355f694f25e2c04c5de17", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "bfa9a375-0e0f-4070-b4e1-10ed9405b98a", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:44 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiCAAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:44 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "0373ca6e-688e-4b8d-9e47-225bdf724f00" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "bfa9a375-0e0f-4070-b4e1-10ed9405b98a", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-d0c73743429db84d99daccdeeb8d6f64-ccd1ba775029db4b-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "88879d0552860b4eb3c76789f3ec667a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "bfa9a375-0e0f-4070-b4e1-10ed9405b98a", + "Content-Length": "4106", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:44 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiCQAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:44 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,353.9854,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "fba00dfa-b934-4c72-87de-b9e37c664e00" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "profile openid email 00000003-0000-0000-c000-000000000000/user_impersonation 00000003-0000-0000-c000-000000000000/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJhZWJjNjQ0My05OTZkLTQ1YzItOTBmMC0zODhmZjk2ZmFhNTYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODU3NTYzMDQsIm5iZiI6MTU4NTc1NjMwNCwiZXhwIjoxNTg1NzYwMjA0LCJhaW8iOiJBVFFBeS84UEFBQUFJekovMkpDdmdCUEhoeHFOcUlodXZIc05lKzBBeFBnMzZvWnp4UnVFYlFTT25tMW9Tc1BMcHpudWh4Z3h3WC9hIiwibmFtZSI6IklkZW50aXR5IFRlc3QgVXNlciIsIm9pZCI6IjQyZDhlODg0LTI2NWEtNGNkNC05MDg5LTRjM2JjNDBhZjE4MyIsInByZWZlcnJlZF91c2VybmFtZSI6ImlkZW50aXR5dGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IldtbG55VUdGOFN5SnR4dDJzMTZ2TGYtaWEwVE9TZENOTFBHc3R6X1RsYVUiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiItZzJnLXpTNWNreUgzcm5qZkdaT0FBIiwidmVyIjoiMi4wIn0.CfH441FyjyGPwDopvQSD1TnPR36xhyK3ClAxkmSC8mtd-UNI-crAen2VuqtBC4HCXlEGnNoRUEyZNFoGpiLcncjR4t-OUWSGOtuw3Z-P9w2SsAHFFU7FrTGsx_lj_OOvs6Bm51W94XvvXYZZxRa0n4Y_lsovTsLRMHpfO2zcNMaa-z6Li91zDhZAFZcg0sGEJYpChNQI5l-1BcPwDdYIMgRJ0W8OP7fSXU7Kz8U45Koil3NWNpA1um3HxEC-VnHQ4x4DDyRZJ6erMo8sXbsfdwHtu2YsdqRXvluNZPbYvyrFGUGTuDA_rgbOMp6N5npmBtbHtQgFSGipLu_I6kG67w", + "client_info": "eyJ1aWQiOiI0MmQ4ZTg4NC0yNjVhLTRjZDQtOTA4OS00YzNiYzQwYWYxODMiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "1044869523" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_TenantInSettings.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_TenantInSettings.json new file mode 100644 index 000000000000..443f47515bfc --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_TenantInSettings.json @@ -0,0 +1,254 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fc54fac88-3dd3-461f-a7c4-8a368e0340b3%2Foauth2%2Fv2.0%2Fauthorize", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "0abd15a2-0092-4436-9f7e-e7a46758815f", + "return-client-request-id": "true", + "traceparent": "00-9e0ecdfc46906f45ad47978a3f8856f3-e454696513ef9445-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "dceab0186a14d6369a54a5828f691a28", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "0abd15a2-0092-4436-9f7e-e7a46758815f", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:41 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiBAAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:41 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "3ea90e1f-b1e3-4f12-b05e-c67f6f514900" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "0abd15a2-0092-4436-9f7e-e7a46758815f", + "return-client-request-id": "true", + "traceparent": "00-9e0ecdfc46906f45ad47978a3f8856f3-3488a1d304eef449-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "8e1d6afa370defd4f9811db0c741ad94", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "0abd15a2-0092-4436-9f7e-e7a46758815f", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:41 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiBAAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:41 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "f225fd3e-b14e-436a-a7cf-92c0cb3a5400" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "0abd15a2-0092-4436-9f7e-e7a46758815f", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-9e0ecdfc46906f45ad47978a3f8856f3-6280aa61a839f14b-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "a858e390e63fe6ec02ccfe550c75d9a5", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "0abd15a2-0092-4436-9f7e-e7a46758815f", + "Content-Length": "4106", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:41 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiBQAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:42 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,349.56,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "8ec3a1f1-f8ad-405b-b657-0bc46e264d00" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "profile openid email 00000003-0000-0000-c000-000000000000/user_impersonation 00000003-0000-0000-c000-000000000000/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJhZWJjNjQ0My05OTZkLTQ1YzItOTBmMC0zODhmZjk2ZmFhNTYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODU3NTYzMDIsIm5iZiI6MTU4NTc1NjMwMiwiZXhwIjoxNTg1NzYwMjAyLCJhaW8iOiJBVFFBeS84UEFBQUExeWtoWERCang5N1Y0aWpiMWpCRUFtcGE1SmVOYktlZjl4STh2NXlhUDhmdnJ6TVRnRnAvMW5aZk91WWhFWFpiIiwibmFtZSI6IklkZW50aXR5IFRlc3QgVXNlciIsIm9pZCI6IjQyZDhlODg0LTI2NWEtNGNkNC05MDg5LTRjM2JjNDBhZjE4MyIsInByZWZlcnJlZF91c2VybmFtZSI6ImlkZW50aXR5dGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IldtbG55VUdGOFN5SnR4dDJzMTZ2TGYtaWEwVE9TZENOTFBHc3R6X1RsYVUiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiI4YUhEanEzNFcwQzJWd3ZFYmlaTkFBIiwidmVyIjoiMi4wIn0.LRQ538xbwq-EVo9-FwfiuTSjgbTdFW_jXAfmWcJqMP4LG7M49qgT5XgcFYisYZmufZwQWIFJBgHm76u8G7jAjhaEDSmpiGhXRkfz0HwV1XtvzsEltENJZkNVyiZEavsm1jUkX18L_CyqWrFVKvD0R04-1p-XlayozNdndiprFVmvRplSSHMjGqbcq_KAjtjEhS2e6uyru0kbpAGAjHUDfN_GMc_dEkxaeMeDnRVVY03scp9Kty3T1mx2OHGv0TQwdXEuNE7eIL7ZDUxVVVKJicXexl6Gk_oMu_y11pcdjF0YKkhd2PRu3_egcSz2DO-BxbMS5UNSHsdLmUaDVAMNAw", + "client_info": "eyJ1aWQiOiI0MmQ4ZTg4NC0yNjVhLTRjZDQtOTA4OS00YzNiYzQwYWYxODMiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "1430786117" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_TenantInSettingsAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_TenantInSettingsAsync.json new file mode 100644 index 000000000000..b9351a144302 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/VisualStudioCodeCredentialLiveTests/AuthenticateWithVscCredential_TenantInSettingsAsync.json @@ -0,0 +1,254 @@ +{ + "Entries": [ + { + "RequestUri": "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1\u0026authorization_endpoint=https%3A%2F%2Flogin.microsoftonline.com%2Fc54fac88-3dd3-461f-a7c4-8a368e0340b3%2Foauth2%2Fv2.0%2Fauthorize", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "2a8829d0-cc9c-4b0a-bbd1-f4194f794840", + "return-client-request-id": "true", + "traceparent": "00-30cc8af0a70a9b47a666d6316e0550ed-f5cd198371e1504d-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "f31f933add3f6bde90b64fb4c4f20785", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "2a8829d0-cc9c-4b0a-bbd1-f4194f794840", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:44 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiCQAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:45 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "87d348a3-0e5d-4966-beba-5b2c46eb4600" + }, + "ResponseBody": { + "tenant_discovery_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "api-version": "1.1", + "metadata": [ + { + "preferred_network": "login.microsoftonline.com", + "preferred_cache": "login.windows.net", + "aliases": [ + "login.microsoftonline.com", + "login.windows.net", + "login.microsoft.com", + "sts.windows.net" + ] + }, + { + "preferred_network": "login.partner.microsoftonline.cn", + "preferred_cache": "login.partner.microsoftonline.cn", + "aliases": [ + "login.partner.microsoftonline.cn", + "login.chinacloudapi.cn" + ] + }, + { + "preferred_network": "login.microsoftonline.de", + "preferred_cache": "login.microsoftonline.de", + "aliases": [ + "login.microsoftonline.de" + ] + }, + { + "preferred_network": "login.microsoftonline.us", + "preferred_cache": "login.microsoftonline.us", + "aliases": [ + "login.microsoftonline.us", + "login.usgovcloudapi.net" + ] + }, + { + "preferred_network": "login-us.microsoftonline.com", + "preferred_cache": "login-us.microsoftonline.com", + "aliases": [ + "login-us.microsoftonline.com" + ] + } + ] + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", + "RequestMethod": "GET", + "RequestHeaders": { + "client-request-id": "2a8829d0-cc9c-4b0a-bbd1-f4194f794840", + "return-client-request-id": "true", + "traceparent": "00-30cc8af0a70a9b47a666d6316e0550ed-4682e34b467d5f41-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "c1469078ef00d92b5871cd88a1078ed0", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Origin": "*", + "Cache-Control": "max-age=86400, private", + "client-request-id": "2a8829d0-cc9c-4b0a-bbd1-f4194f794840", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:44 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiCQAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:45 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "84d12992-f3ae-497b-973e-9ca2c5ff4100" + }, + "ResponseBody": { + "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "token_endpoint_auth_methods_supported": [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic" + ], + "jwks_uri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/discovery/v2.0/keys", + "response_modes_supported": [ + "query", + "fragment", + "form_post" + ], + "subject_types_supported": [ + "pairwise" + ], + "id_token_signing_alg_values_supported": [ + "RS256" + ], + "response_types_supported": [ + "code", + "id_token", + "code id_token", + "id_token token" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "offline_access" + ], + "issuer": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0", + "request_uri_parameter_supported": false, + "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", + "authorization_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/authorize", + "http_logout_supported": true, + "frontchannel_logout_supported": true, + "end_session_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/logout", + "claims_supported": [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email" + ], + "tenant_region_scope": "NA", + "cloud_instance_name": "microsoftonline.com", + "cloud_graph_host_name": "graph.windows.net", + "msgraph_host": "graph.microsoft.com", + "rbac_url": "https://pas.windows.net" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "2a8829d0-cc9c-4b0a-bbd1-f4194f794840", + "Content-Length": "9", + "return-client-request-id": "true", + "traceparent": "00-30cc8af0a70a9b47a666d6316e0550ed-814c0db121b6bd4e-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200401.1", + "(.NET Core 3.1.1; Microsoft Windows 10.0.18362)" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-OS": "Microsoft Windows 10.0.18362", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.1.0.0", + "x-ms-client-request-id": "743f84770aca13b7f53a055bf4ce2f65", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "2a8829d0-cc9c-4b0a-bbd1-f4194f794840", + "Content-Length": "4112", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Apr 2020 15:56:44 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=AuKdndUeH3REtEK73dxSTcVlEICiCgAAALawFtYOAAAA; expires=Fri, 01-May-2020 15:56:45 GMT; path=/; secure; HttpOnly; SameSite=None", + "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", + "stsservicecookie=ests; path=/; secure; HttpOnly; SameSite=None" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-clitelem": "1,0,0,304.2457,", + "x-ms-ests-server": "2.1.10244.32 - SAN ProdSlices", + "x-ms-request-id": "24c9295e-90ba-49ee-b5f1-171bf1324200" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "profile openid email 00000003-0000-0000-c000-000000000000/user_impersonation 00000003-0000-0000-c000-000000000000/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJhZWJjNjQ0My05OTZkLTQ1YzItOTBmMC0zODhmZjk2ZmFhNTYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODU3NTYzMDUsIm5iZiI6MTU4NTc1NjMwNSwiZXhwIjoxNTg1NzYwMjA1LCJhaW8iOiJBVFFBeS84UEFBQUEzMVZ2bGRmaTNrVFc5NWpQUTkweTg3WHVOWkxqeW5BK2RWaU5VK3h6MEtQaXNCdmNMcFlpSjVYVFd1d29LTmYzIiwibmFtZSI6IklkZW50aXR5IFRlc3QgVXNlciIsIm9pZCI6IjQyZDhlODg0LTI2NWEtNGNkNC05MDg5LTRjM2JjNDBhZjE4MyIsInByZWZlcnJlZF91c2VybmFtZSI6ImlkZW50aXR5dGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6IldtbG55VUdGOFN5SnR4dDJzMTZ2TGYtaWEwVE9TZENOTFBHc3R6X1RsYVUiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJYaW5KSkxxUTdrbTE4UmNiOFRKQ0FBIiwidmVyIjoiMi4wIn0.ih35ieGtSREwcQzlcxoyVXJXffu27Zk4tFJ4E_ZmZhV_9i7IdY38c6Qy2V-zujMdy2x6OvAH2jssEiwpDTUdODzOZ14bt8ibnNfUr7aJkUts8bBTjf2ZimCXm-Yn_zLaWxQt5n7viUzPiQqNV3lwl09kbBpXOfNM8wghPlt5pyNfDWzMZL0XduDC9vs__YsV3FSs3ky_acHuGk57P5JlN2Jh9pVyU0cs70dkEEZQUgopYTvReQb11OM93oKJZwB3PaOB9UqI-4_xnhQsmWNcbhkX9JelR0fnJe6Y_ZobvUFGd0WcXmg_bHKPKzhBta-W7jhuzT6CbLyNaAoYDnBxOw", + "client_info": "eyJ1aWQiOiI0MmQ4ZTg4NC0yNjVhLTRjZDQtOTA4OS00YzNiYzQwYWYxODMiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "RandomSeed": "1225131761" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/StaticCachesUtilities.cs b/sdk/identity/Azure.Identity/tests/StaticCachesUtilities.cs new file mode 100644 index 000000000000..930f50da3713 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/StaticCachesUtilities.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using Microsoft.Identity.Client; + +namespace Azure.Identity.Tests +{ + internal static class StaticCachesUtilities + { + private static readonly Lazy s_clearStaticMetadataProvider = new Lazy(() => + { + Type staticMetadataProviderType = typeof(PublicClientApplication).Assembly.GetType("Microsoft.Identity.Client.Instance.Discovery.StaticMetadataProvider", true); + MethodInfo clearMethod = staticMetadataProviderType.GetMethod("Clear", BindingFlags.Public | BindingFlags.Instance); + NewExpression callConstructor = Expression.New(staticMetadataProviderType); + MethodCallExpression invokeClear = Expression.Call(callConstructor, clearMethod); + return Expression.Lambda(invokeClear).Compile(); + }); + + private static readonly Lazy s_clearAuthorityEndpointResolutionManager = new Lazy(() => + { + var assembly = typeof(PublicClientApplication).Assembly; + Type authorityEndpointResolutionManagerType = assembly.GetType("Microsoft.Identity.Client.Instance.AuthorityEndpointResolutionManager", true); + Type iServiceBundleType = assembly.GetType("Microsoft.Identity.Client.Core.IServiceBundle", true); + Type booleanType = typeof(bool); + + ConstructorInfo[] constructors = authorityEndpointResolutionManagerType.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + foreach (ConstructorInfo constructor in constructors) + { + var parameters = constructor.GetParameters(); + if (parameters.Length == 2 && parameters[0].ParameterType == iServiceBundleType && parameters[1].ParameterType == booleanType) + { + NewExpression callConstructor = Expression.New(constructor, Expression.Constant(null, iServiceBundleType), Expression.Constant(true, booleanType)); + return Expression.Lambda(callConstructor).Compile(); + } + } + + throw new InvalidOperationException("Constructor wasn't found"); + }); + + public static void ClearStaticMetadataProviderCache() => s_clearStaticMetadataProvider.Value(); + public static void ClearAuthorityEndpointResolutionManagerCache() => s_clearAuthorityEndpointResolutionManager.Value(); + } +} diff --git a/sdk/identity/Azure.Identity/tests/UsernamePasswordCredentialLiveTests.cs b/sdk/identity/Azure.Identity/tests/UsernamePasswordCredentialLiveTests.cs index 0135faecacc8..aeeb865bf9a9 100644 --- a/sdk/identity/Azure.Identity/tests/UsernamePasswordCredentialLiveTests.cs +++ b/sdk/identity/Azure.Identity/tests/UsernamePasswordCredentialLiveTests.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Linq.Expressions; using System.Reflection; using System.Threading.Tasks; using Azure.Core; @@ -55,11 +56,7 @@ public UsernamePasswordCredentialLiveTests(bool isAsync) : base(isAsync) [SetUp] public void ClearDiscoveryCache() { - Type staticMetadataProviderType = typeof(PublicClientApplication).Assembly.GetType("Microsoft.Identity.Client.Instance.Discovery.StaticMetadataProvider", true); - - var staticMetadataProvider = Activator.CreateInstance(staticMetadataProviderType); - - staticMetadataProvider.GetType().GetMethod("Clear", BindingFlags.Public | BindingFlags.Instance).Invoke(staticMetadataProvider, null); + StaticCachesUtilities.ClearStaticMetadataProviderCache(); } // !!!!!! WARNING !!!!! diff --git a/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs b/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs new file mode 100644 index 000000000000..65890f83b946 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs @@ -0,0 +1,413 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Core.Testing; +using Microsoft.Identity.Client; +using NUnit.Framework; + +namespace Azure.Identity.Tests +{ + public class VisualStudioCodeCredentialLiveTests : RecordedTestBase + { + private const string ExpectedServiceName = "VS Code Azure"; + + public VisualStudioCodeCredentialLiveTests(bool isAsync) : base(isAsync) + { + Matcher.ExcludeHeaders.Add("Content-Length"); + Matcher.ExcludeHeaders.Add("client-request-id"); + Matcher.ExcludeHeaders.Add("x-client-OS"); + Matcher.ExcludeHeaders.Add("x-client-SKU"); + Matcher.ExcludeHeaders.Add("x-client-CPU"); + + Sanitizer = new IdentityRecordedTestSanitizer(); + } + + [Test] + [RunOnlyOnPlatforms(Windows = true, OSX = true)] // Comment this attribute to run this tests on Linux with Libsecret enabled + public async Task AuthenticateWithVscCredential() + { + var tenantId = GetTenantId(); + var cloudName = Guid.NewGuid().ToString(); + + var fileSystem = CreateTestFileSystemService(cloudName: cloudName); + using IDisposable fixture = await CreateRefreshTokenFixtureAsync(tenantId, cloudName); + + TokenCredentialOptions options = Recording.InstrumentClientOptions(new TokenCredentialOptions()); + VisualStudioCodeCredential credential = InstrumentClient(new VisualStudioCodeCredential(tenantId, options, fileSystem, default)); + AccessToken token = await credential.GetTokenAsync(new TokenRequestContext(new[] {".default"}), CancellationToken.None); + Assert.IsNotNull(token.Token); + } + + [Test] + public async Task AuthenticateWithVscCredential_NoSettingsFile() + { + var tenantId = GetTenantId(); + var refreshToken = await GetRefreshTokenAsync(tenantId); + var fileSystemService = new TestFileSystemService { ReadAllHandler = s => throw new FileNotFoundException() }; + var vscAdapter = new TestVscAdapter(ExpectedServiceName, "Azure", refreshToken); + + TokenCredentialOptions options = Recording.InstrumentClientOptions(new TokenCredentialOptions()); + VisualStudioCodeCredential credential = InstrumentClient(new VisualStudioCodeCredential(tenantId, options, fileSystemService, vscAdapter)); + AccessToken token = await credential.GetTokenAsync(new TokenRequestContext(new[] {".default"}), CancellationToken.None); + Assert.IsNotNull(token.Token); + } + + [Test] + public async Task AuthenticateWithVscCredential_BrokenSettingsFile() + { + var tenantId = GetTenantId(); + var refreshToken = await GetRefreshTokenAsync(tenantId); + var fileSystemService = new TestFileSystemService { ReadAllHandler = s => "{a,}" }; + var vscAdapter = new TestVscAdapter(ExpectedServiceName, "Azure", refreshToken); + + TokenCredentialOptions options = Recording.InstrumentClientOptions(new TokenCredentialOptions()); + VisualStudioCodeCredential credential = InstrumentClient(new VisualStudioCodeCredential(tenantId, options, fileSystemService, vscAdapter)); + AccessToken token = await credential.GetTokenAsync(new TokenRequestContext(new[] {".default"}), CancellationToken.None); + Assert.IsNotNull(token.Token); + } + + [Test] + public async Task AuthenticateWithVscCredential_EmptySettingsFile() + { + var tenantId = GetTenantId(); + + var refreshToken = await GetRefreshTokenAsync(tenantId); + var fileSystemService = CreateTestFileSystemService(); + var vscAdapter = new TestVscAdapter(ExpectedServiceName, "Azure", refreshToken); + + TokenCredentialOptions options = Recording.InstrumentClientOptions(new TokenCredentialOptions()); + VisualStudioCodeCredential credential = InstrumentClient(new VisualStudioCodeCredential(default, options, fileSystemService, vscAdapter)); + + AccessToken token = await credential.GetTokenAsync(new TokenRequestContext(new[] {".default"}), CancellationToken.None); + Assert.IsNotNull(token.Token); + } + + [Test] + [RunOnlyOnPlatforms(Windows = true, OSX = true)] // Comment this attribute to run this tests on Linux with Libsecret enabled + public async Task AuthenticateWithVscCredential_TenantInSettings() + { + var tenantId = GetTenantId(); + var cloudName = Guid.NewGuid().ToString(); + + var fileSystemService = CreateTestFileSystemService(tenantId, cloudName); + using IDisposable fixture = await CreateRefreshTokenFixtureAsync(tenantId, cloudName); + + TokenCredentialOptions options = Recording.InstrumentClientOptions(new TokenCredentialOptions()); + VisualStudioCodeCredential credential = InstrumentClient(new VisualStudioCodeCredential(Guid.NewGuid().ToString(), options, fileSystemService, default)); + + AccessToken token = await credential.GetTokenAsync(new TokenRequestContext(new[] {".default"}), CancellationToken.None); + Assert.IsNotNull(token.Token); + } + + [Test] + public void AuthenticateWithVscCredential_NoRefreshToken() + { + var tenantId = GetTenantId(); + var vscAdapter = new TestVscAdapter(ExpectedServiceName, "Azure", null); + var fileSystem = CreateTestFileSystemService(); + + TokenCredentialOptions options = Recording.InstrumentClientOptions(new TokenCredentialOptions()); + VisualStudioCodeCredential credential = InstrumentClient(new VisualStudioCodeCredential(tenantId, options, fileSystem, vscAdapter)); + + Assert.CatchAsync(async () => await credential.GetTokenAsync(new TokenRequestContext(new[] {".default"}), CancellationToken.None)); + } + + [Test] + public void AuthenticateWithVscCredential_AuthenticationCodeInsteadOfRefreshToken() + { + var tenantId = GetTenantId(); + var fileSystemService = CreateTestFileSystemService(); + var vscAdapter = new TestVscAdapter(ExpectedServiceName, "Azure", "{}"); + + TokenCredentialOptions options = Recording.InstrumentClientOptions(new TokenCredentialOptions()); + VisualStudioCodeCredential credential = InstrumentClient(new VisualStudioCodeCredential(tenantId, options, fileSystemService, vscAdapter)); + + Assert.ThrowsAsync(async () => await credential.GetTokenAsync(new TokenRequestContext(new[] {".default"}), CancellationToken.None)); + } + + [Test] + public void AuthenticateWithVscCredential_InvalidRefreshToken() + { + var tenantId = GetTenantId(); + var fileSystemService = CreateTestFileSystemService(); + var vscAdapter = new TestVscAdapter(ExpectedServiceName, "Azure", Guid.NewGuid().ToString()); + + TokenCredentialOptions options = Recording.InstrumentClientOptions(new TokenCredentialOptions()); + VisualStudioCodeCredential credential = InstrumentClient(new VisualStudioCodeCredential(tenantId, options, fileSystemService, vscAdapter)); + + Assert.ThrowsAsync(async () => await credential.GetTokenAsync(new TokenRequestContext(new[] {".default"}), CancellationToken.None)); + } + + private static TestFileSystemService CreateTestFileSystemService(string tenant = default, string cloudName = default) + { + var sb = new StringBuilder("{"); + + if (tenant != default) + { + sb.AppendFormat("\"azure.tenant\": \"{0}\"", tenant); + } + + if (tenant != default && cloudName != default) + { + sb.Append(","); + } + + if (cloudName != default) + { + sb.AppendFormat("\"azure.cloud\": \"{0}\"", cloudName); + } + + sb.Append("}"); + + return new TestFileSystemService {ReadAllHandler = s => sb.ToString()}; + } + + private async Task CreateRefreshTokenFixtureAsync(string tenantId, string cloudName) + { + var refreshToken = await GetRefreshTokenAsync(tenantId); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return WindowsRefreshTokenFixture.Create(cloudName, refreshToken); + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + return OsxRefreshTokenFixture.Create(cloudName, refreshToken); + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + return LinuxRefreshTokenFixture.Create(cloudName, refreshToken); + } + + throw new PlatformNotSupportedException(); + } + + private async Task GetRefreshTokenAsync(string tenantId) + { + if (Recording.Mode == RecordedTestMode.Playback) + { + return Guid.NewGuid().ToString(); + } + + var clientId = "aebc6443-996d-45c2-90f0-388ff96faa56"; + var username = Environment.GetEnvironmentVariable("AZURE_IDENTITY_TEST_USERNAME"); + var password = Environment.GetEnvironmentVariable("AZURE_IDENTITY_TEST_PASSWORD"); + + var client = PublicClientApplicationBuilder.Create(clientId) + .WithTenantId(tenantId) + .Build(); + + var retriever = new RefreshTokenRetriever(client.UserTokenCache); + await client.AcquireTokenByUsernamePassword(new[] {".default"}, username, password.ToSecureString()).ExecuteAsync(); + + StaticCachesUtilities.ClearStaticMetadataProviderCache(); + StaticCachesUtilities.ClearAuthorityEndpointResolutionManagerCache(); + return retriever.RefreshToken; + } + + private string GetTenantId() => Recording.GetVariableFromEnvironment("AZURE_IDENTITY_TEST_TENANTID"); + + private sealed class RefreshTokenRetriever + { + public string RefreshToken { get; private set; } + + public RefreshTokenRetriever(ITokenCache tokenCache) + { + tokenCache.SetAfterAccess(AfterAccessHandler); + } + + private void AfterAccessHandler(TokenCacheNotificationArgs args) + { + var data = args.TokenCache.SerializeMsalV3(); + var serializedData = new UTF8Encoding().GetString(data); + var root = JsonDocument.Parse(serializedData).RootElement; + var refreshTokenObject = root.GetProperty("RefreshToken"); + foreach (JsonProperty property in refreshTokenObject.EnumerateObject()) + { + if (property.Name.StartsWith(args.Account.HomeAccountId.Identifier)) + { + RefreshToken = property.Value.GetProperty("secret").GetString(); + return; + } + } + } + } + + private sealed class WindowsRefreshTokenFixture : IDisposable + { + private readonly string _target; + + public static IDisposable Create(string cloudName, string refreshToken) + { + var target = $"VS Code Azure/{cloudName}"; + var credentialBlobPtr = Marshal.StringToHGlobalAnsi(refreshToken); + + var credentialData = new WindowsNativeMethods.CredentialData + { + AttributeCount = 0, + Attributes = IntPtr.Zero, + Comment = null, + CredentialBlob = credentialBlobPtr, + CredentialBlobSize = (uint)refreshToken.Length, + Flags = 0, + Persist = WindowsNativeMethods.CRED_PERSIST.CRED_PERSIST_LOCAL_MACHINE, + TargetAlias = null, + TargetName = $"{ExpectedServiceName}/{cloudName}", + Type = WindowsNativeMethods.CRED_TYPE.GENERIC, + UserName = "Azure" + }; + + var credentialDataPtr = Marshal.AllocHGlobal(Marshal.SizeOf(credentialData)); + + try + { + Marshal.StructureToPtr(credentialData, credentialDataPtr, false); + WindowsNativeMethods.CredWrite(credentialDataPtr); + return new WindowsRefreshTokenFixture(target); + } + finally + { + Marshal.FreeHGlobal(credentialDataPtr); + Marshal.FreeHGlobal(credentialBlobPtr); + } + } + + private WindowsRefreshTokenFixture(string target) + { + _target = target; + } + + public void Dispose() => WindowsNativeMethods.CredDelete(_target, WindowsNativeMethods.CRED_TYPE.GENERIC); + } + + private sealed class OsxRefreshTokenFixture : IDisposable + { + private readonly string _cloudName; + + public static IDisposable Create(string cloudName, string refreshToken) + { + IntPtr itemRef = IntPtr.Zero; + + try + { + MacosNativeMethods.SecKeychainAddGenericPassword(IntPtr.Zero, ExpectedServiceName, cloudName, refreshToken, out itemRef); + } + finally + { + MacosNativeMethods.CFRelease(itemRef); + } + + return new OsxRefreshTokenFixture(cloudName); + } + + private OsxRefreshTokenFixture(string cloudName) + { + _cloudName = cloudName; + } + + public void Dispose() + { + IntPtr credentialsPtr = IntPtr.Zero; + IntPtr itemRef = IntPtr.Zero; + + try + { + MacosNativeMethods.SecKeychainFindGenericPassword(IntPtr.Zero, ExpectedServiceName, _cloudName, out _, out credentialsPtr, out itemRef); + MacosNativeMethods.SecKeychainItemDelete(itemRef); + } + finally + { + try + { + MacosNativeMethods.SecKeychainItemFreeContent(IntPtr.Zero, credentialsPtr); + } + finally + { + MacosNativeMethods.CFRelease(itemRef); + } + } + } + } + + private sealed class LinuxRefreshTokenFixture : IDisposable + { + private readonly string _cloudName; + + public static IDisposable Create(string cloudName, string refreshToken) + { + IntPtr schemaPtr = GetLibsecretSchema(); + + try + { + LinuxNativeMethods.secret_password_store_sync(schemaPtr, LinuxNativeMethods.SECRET_COLLECTION_SESSION, $"{ExpectedServiceName}/{cloudName}", refreshToken, IntPtr.Zero, "service", ExpectedServiceName, "account", cloudName); + } + finally + { + LinuxNativeMethods.secret_schema_unref(schemaPtr); + } + + return new LinuxRefreshTokenFixture(cloudName); + } + + public LinuxRefreshTokenFixture(string cloudName) + { + _cloudName = cloudName; + } + + public void Dispose() + { + IntPtr schemaPtr = GetLibsecretSchema(); + + try + { + LinuxNativeMethods.secret_password_clear_sync(schemaPtr, IntPtr.Zero, "service", ExpectedServiceName, "account", _cloudName); + } + finally + { + LinuxNativeMethods.secret_schema_unref(schemaPtr); + } + } + + private static IntPtr GetLibsecretSchema() + => LinuxNativeMethods.secret_schema_new("org.freedesktop.Secret.Generic", + LinuxNativeMethods.SecretSchemaFlags.SECRET_SCHEMA_DONT_MATCH_NAME, + "service", + LinuxNativeMethods.SecretSchemaAttributeType.SECRET_SCHEMA_ATTRIBUTE_STRING, + "account", + LinuxNativeMethods.SecretSchemaAttributeType.SECRET_SCHEMA_ATTRIBUTE_STRING); + } + + private sealed class TestVscAdapter : IVisualStudioCodeAdapter + { + private readonly string _expectedServiceName; + private readonly string _expectedAccountName; + private readonly string _refreshToken; + + public TestVscAdapter(string expectedServiceName, string expectedAccountName, string refreshToken) + { + _expectedServiceName = expectedServiceName; + _expectedAccountName = expectedAccountName; + _refreshToken = refreshToken; + } + + public string GetUserSettingsPath() => Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + public string GetCredentials(string serviceName, string accountName) + { + Assert.AreEqual(_expectedServiceName, serviceName); + Assert.AreEqual(_expectedAccountName, accountName); + return _refreshToken ?? throw new InvalidOperationException("No token found"); + } + } + } +} diff --git a/sdk/identity/test-resources.json b/sdk/identity/test-resources.json new file mode 100644 index 000000000000..2cc01d8d229d --- /dev/null +++ b/sdk/identity/test-resources.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "type": "string", + "defaultValue": "[resourceGroup().name]", + "metadata": { + "description": "The base resource name." + } + }, + "azureIdentityTestTenantId": { + "type": "string", + "metadata": { + "description": "The tenant ID to which the application and resources belong." + } + }, + "azureIdentityTestUsername": { + "type": "string", + "metadata": { + "description": "The test username used to run tests." + } + }, + "azureIdentityTestPassword": { + "type": "string", + "metadata": { + "description": "The test password used to run tests." + } + } + }, + "variables": {}, + "resources": [], + "outputs": { + "AZURE_IDENTITY_TEST_TENANTID": { + "type": "string", + "value": "[parameters('azureIdentityTestTenantId')]" + }, + "AZURE_IDENTITY_TEST_USERNAME": { + "type": "string", + "value": "[parameters('azureIdentityTestUsername')]" + }, + "AZURE_IDENTITY_TEST_PASSWORD": { + "type": "string", + "value": "[parameters('azureIdentityTestPassword')]" + } + } +} diff --git a/sdk/identity/tests.yml b/sdk/identity/tests.yml new file mode 100644 index 000000000000..21094cc8b547 --- /dev/null +++ b/sdk/identity/tests.yml @@ -0,0 +1,13 @@ +trigger: none + +resources: + repositories: + - repository: azure-sdk-tools + type: github + name: Azure/azure-sdk-tools + endpoint: azure + +jobs: +- template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml + parameters: + ServiceDirectory: identity \ No newline at end of file