From 4ae35d47808b7f2e064e3189c1e20b1f1d9fde7c Mon Sep 17 00:00:00 2001 From: Scott Schaab Date: Fri, 5 Jun 2020 14:32:59 -0700 Subject: [PATCH] Identity Adding Authenticate APIs to UsernamePasswordCredential (#12502) * Adding Authenticate APIs to UsernamePasswordCredential * updating test recordings * updating api listing * update changelog --- sdk/identity/Azure.Identity/CHANGELOG.md | 1 + .../api/Azure.Identity.netstandard2.0.cs | 4 + .../src/UsernamePasswordCredential.cs | 69 ++++ .../AuthenticateNoContext.json | 311 ++++++++++++++++++ .../AuthenticateNoContextAsync.json | 310 +++++++++++++++++ ...Live.json => AuthenticateWithContext.json} | 87 ++--- ...json => AuthenticateWithContextAsync.json} | 87 ++--- .../GetToken.json | 310 +++++++++++++++++ .../GetTokenAsync.json | 310 +++++++++++++++++ .../UsernamePasswordCredentialLiveTests.cs | 40 ++- 10 files changed, 1444 insertions(+), 85 deletions(-) create mode 100644 sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateNoContext.json create mode 100644 sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateNoContextAsync.json rename sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/{AuthenticateUsernamePasswordLive.json => AuthenticateWithContext.json} (71%) rename sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/{AuthenticateUsernamePasswordLiveAsync.json => AuthenticateWithContextAsync.json} (71%) create mode 100644 sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/GetToken.json create mode 100644 sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/GetTokenAsync.json diff --git a/sdk/identity/Azure.Identity/CHANGELOG.md b/sdk/identity/Azure.Identity/CHANGELOG.md index 690c4575dedf8..791225d021f25 100644 --- a/sdk/identity/Azure.Identity/CHANGELOG.md +++ b/sdk/identity/Azure.Identity/CHANGELOG.md @@ -4,6 +4,7 @@ ### New Features - Makes `AzureCliCredential`, `VisualStudioCredential` and `VisualStudioCodeCredential` public to allow direct usage. +- Added `Authenticate` methods to `UsernamePasswordCredential` ## 1.2.0-preview.3 diff --git a/sdk/identity/Azure.Identity/api/Azure.Identity.netstandard2.0.cs b/sdk/identity/Azure.Identity/api/Azure.Identity.netstandard2.0.cs index ecef3a326a4b6..2b6c50a97fbc6 100644 --- a/sdk/identity/Azure.Identity/api/Azure.Identity.netstandard2.0.cs +++ b/sdk/identity/Azure.Identity/api/Azure.Identity.netstandard2.0.cs @@ -192,6 +192,10 @@ public partial class UsernamePasswordCredential : Azure.Core.TokenCredential protected UsernamePasswordCredential() { } public UsernamePasswordCredential(string username, string password, string tenantId, string clientId) { } public UsernamePasswordCredential(string username, string password, string tenantId, string clientId, Azure.Identity.TokenCredentialOptions options) { } + public virtual Azure.Identity.AuthenticationRecord Authenticate(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Identity.AuthenticationRecord Authenticate(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AuthenticateAsync(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AuthenticateAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override Azure.Core.AccessToken GetToken(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask GetTokenAsync(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } diff --git a/sdk/identity/Azure.Identity/src/UsernamePasswordCredential.cs b/sdk/identity/Azure.Identity/src/UsernamePasswordCredential.cs index 0daeef15f02e4..e4c0655f07565 100644 --- a/sdk/identity/Azure.Identity/src/UsernamePasswordCredential.cs +++ b/sdk/identity/Azure.Identity/src/UsernamePasswordCredential.cs @@ -18,10 +18,13 @@ namespace Azure.Identity /// public class UsernamePasswordCredential : TokenCredential { + private const string NoDefaultScopeMessage = "Authenticating in this environment requires specifying a TokenRequestContext."; + private readonly MsalPublicClient _client; private readonly CredentialPipeline _pipeline; private readonly string _username; private readonly SecureString _password; + private AuthenticationRecord _record; /// @@ -76,6 +79,54 @@ internal UsernamePasswordCredential(string username, string password, Credential _client = client; } + /// + /// Authenticates the user using the specified username and password. + /// + /// A controlling the request lifetime. + /// The of the authenticated account. + public virtual AuthenticationRecord Authenticate(CancellationToken cancellationToken = default) + { + // get the default scope for the authority, throw if no default scope exists + string defaultScope = KnownAuthorityHosts.GetDefaultScope(_pipeline.AuthorityHost) ?? throw new CredentialUnavailableException(NoDefaultScopeMessage); + + return Authenticate(new TokenRequestContext(new string[] { defaultScope }), cancellationToken); + } + + /// + /// Authenticates the user using the specified username and password. + /// + /// A controlling the request lifetime. + /// The of the authenticated account. + public virtual async Task AuthenticateAsync(CancellationToken cancellationToken = default) + { + // get the default scope for the authority, throw if no default scope exists + string defaultScope = KnownAuthorityHosts.GetDefaultScope(_pipeline.AuthorityHost) ?? throw new CredentialUnavailableException(NoDefaultScopeMessage); + + return await AuthenticateAsync(new TokenRequestContext(new string[] { defaultScope }), cancellationToken).ConfigureAwait(false); + } + + /// + /// Authenticates the user using the specified username and password. + /// + /// A controlling the request lifetime. + /// The details of the authentication request. + /// The of the authenticated account. + public virtual AuthenticationRecord Authenticate(TokenRequestContext requestContext, CancellationToken cancellationToken = default) + { + return AuthenticateImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); + } + + /// + /// Authenticates the user using the specified username and password. + /// + /// A controlling the request lifetime. + /// The details of the authentication request. + /// The of the authenticated account. + public virtual async Task AuthenticateAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) + { + return await AuthenticateImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); + } + /// /// Obtains a token for a user account, authenticating them using the given username and password. Note: This will fail with /// an if the specified user account has MFA enabled. This method is called by Azure SDK clients. It isn't intended for use in application code. @@ -100,6 +151,22 @@ public override async ValueTask GetTokenAsync(TokenRequestContext r return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); } + private async Task AuthenticateImplAsync(bool async, TokenRequestContext requestContext, CancellationToken cancellationToken) + { + using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope($"{nameof(UsernamePasswordCredential)}.{nameof(Authenticate)}", requestContext); + + try + { + scope.Succeeded(await GetTokenImplAsync(async, requestContext, cancellationToken).ConfigureAwait(false)); + + return _record; + } + catch (Exception e) + { + throw scope.FailWrapAndThrow(e); + } + } + private async Task GetTokenImplAsync(bool async, TokenRequestContext requestContext, CancellationToken cancellationToken) { using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("UsernamePasswordCredential.GetToken", requestContext); @@ -110,6 +177,8 @@ private async Task GetTokenImplAsync(bool async, TokenRequestContex .AcquireTokenByUsernamePasswordAsync(requestContext.Scopes, _username, _password, async, cancellationToken) .ConfigureAwait(false); + _record = new AuthenticationRecord(result); + return scope.Succeeded(new AccessToken(result.AccessToken, result.ExpiresOn)); } catch (Exception e) diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateNoContext.json b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateNoContext.json new file mode 100644 index 0000000000000..3184c2576a39a --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateNoContext.json @@ -0,0 +1,311 @@ +{ + "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": "2b2bb097-b03a-45f2-95e9-eb7478f034bc", + "Request-Id": "00-37781b495a4ef248abfcb09e0d8f4c84-3f3c1a8ab91ea647-00", + "return-client-request-id": "true", + "traceparent": "00-37781b495a4ef248abfcb09e0d8f4c84-3f3c1a8ab91ea647-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "bdc193d438381f612e03bbf6722b423c", + "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": "2b2bb097-b03a-45f2-95e9-eb7478f034bc", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:05 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nM; expires=Sat, 04-Jul-2020 13:08:06 GMT; path=/; secure; HttpOnly; SameSite=None", + "esctx=AQABAAAAAAAm-06blBE1TpVMil8KPQ41DFEEzt70S2WH1Mu5Lrdu_LUQQlP1Cnx6y6qvy-r0qRH4S6nYBjU0q7TefO-n_vpTy46yOnq-5gtAAVxKSWeLp0KVAULYWjYhyI_MDAfw2m0s4BrBOo4oVhJPVqNmuItL9HU_3YDXojpOge5YZhd6DuLsv_wo3f7GHu6hJcjmA8sgAA; 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "bb033e7d-4ce6-42d3-bdf3-5ec44d6f5400" + }, + "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": "2b2bb097-b03a-45f2-95e9-eb7478f034bc", + "Request-Id": "00-37781b495a4ef248abfcb09e0d8f4c84-b02b34be8c302848-00", + "return-client-request-id": "true", + "traceparent": "00-37781b495a4ef248abfcb09e0d8f4c84-b02b34be8c302848-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "886b2b2aaaed2ac8db7d283d631fa6d3", + "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": "2b2bb097-b03a-45f2-95e9-eb7478f034bc", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:06 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nM; expires=Sat, 04-Jul-2020 13:08:06 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "0123059b-7d9c-45ed-8f55-fdbf53335800" + }, + "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/common/userrealm/testuser@azuresdkplayground.onmicrosoft.com?api-version=1.0", + "RequestMethod": "GET", + "RequestHeaders": { + "Request-Id": "00-37781b495a4ef248abfcb09e0d8f4c84-5f9ad7f20541584d-00", + "traceparent": "00-37781b495a4ef248abfcb09e0d8f4c84-5f9ad7f20541584d-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "7033cc3d6eaf666ebf4ccc819d566ec6", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "Content-Disposition": "inline; filename=userrealm.json", + "Content-Length": "187", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:06 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nM; expires=Sat, 04-Jul-2020 13:08:06 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.10681.6 - WUS2 ProdSlices", + "x-ms-request-id": "4197af44-b58e-4ea1-89da-2eecc7451500" + }, + "ResponseBody": { + "ver": "1.0", + "account_type": "Managed", + "domain_name": "azuresdkplayground.onmicrosoft.com", + "cloud_instance_name": "microsoftonline.com", + "cloud_audience_urn": "urn:federation:MicrosoftOnline" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "2b2bb097-b03a-45f2-95e9-eb7478f034bc", + "Content-Length": "9", + "Request-Id": "00-37781b495a4ef248abfcb09e0d8f4c84-dd32681375a9d549-00", + "return-client-request-id": "true", + "traceparent": "00-37781b495a4ef248abfcb09e0d8f4c84-dd32681375a9d549-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "04759cb7d5402a16ca97e2ba0f23bb0f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "2b2bb097-b03a-45f2-95e9-eb7478f034bc", + "Content-Length": "1538", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:06 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAA; expires=Sat, 04-Jul-2020 13:08:07 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,,", + "x-ms-ests-server": "2.1.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "feea6931-97e2-472f-963c-88d0edb37a00" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "foci": "1", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlNzWnNCTmhaY0YzUTlTNHRycFFCVEJ5TlJSSSJ9.eyJhdWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1OTEyNzU3ODYsIm5iZiI6MTU5MTI3NTc4NiwiZXhwIjoxNTkxMjc5Njg2LCJhaW8iOiJBVFFBeS84UEFBQUEwd3AvWm1DQ2RPbjQwU0NMVGZjajBwbGkrUGxDUUJmaGlJN1JjY3ZvZTRpUmdURWpJZEo2OUNpUG16eE1kRkJtIiwibmFtZSI6InRlc3R1c2VyIiwib2lkIjoiMjMzNjY0ZmEtNGU5Mi00Yzg1LTg5NzctZjc4MmEyNDI1OGU0IiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6InppWGhoM2RGVF9ERFA2a2w4aGI0aGVVUGdmTWlJRUJmUUt6RjZIYTZuc0UiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJNV25xX3VLWEwwZVdQSWpRN2JONkFBIiwidmVyIjoiMi4wIn0.bsAOVRdd3u03-NYOLnvek-9o6IBrmaXEbI-a04630wuoxapBqDwa6rrsFFDthDznod9TUJncC-FF0tYx3qnqW-MbYRi6T0KKZUudwVqIKhdWvzjhjyHyoMPxKCFmkVMOvmKNCFLXFy9yDXVilmS8271NT5bDUVMgpQITm5Ih7kDndL5igknwPBnMHdsbgaowJoT5cKjIM0ny-6bT_x6uTp_BD-7Et6i50FXEDSWcv1AuR5FUROdBfvuronN36eFiQMOPO4QfWG92qJLGFMr1NEWWbr9pJkYR2beZ2uDcvzhrSZltkEVhCslkIEyWUc3WnsBOwBNQOf36lrRjgFjaxA", + "client_info": "eyJ1aWQiOiIyMzM2NjRmYS00ZTkyLTRjODUtODk3Ny1mNzgyYTI0MjU4ZTQiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "AZURE_IDENTITY_TEST_USERNAME": "testuser@azuresdkplayground.onmicrosoft.com", + "RandomSeed": "1452968491" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateNoContextAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateNoContextAsync.json new file mode 100644 index 0000000000000..1a396adda9ae1 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateNoContextAsync.json @@ -0,0 +1,310 @@ +{ + "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": "13ee3c04-ea06-48d7-be57-fe3314b75d0d", + "Request-Id": "00-c8fc1bc8d7dc1147803358eab129da55-f3e7d171fd7faf4e-00", + "return-client-request-id": "true", + "traceparent": "00-c8fc1bc8d7dc1147803358eab129da55-f3e7d171fd7faf4e-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "a6d388007a7e173addabb06d0dc925d7", + "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": "13ee3c04-ea06-48d7-be57-fe3314b75d0d", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:08 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAAdzmUzwIAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:08 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "4b1e44c1-d21d-438e-a23b-9c5483e49b00" + }, + "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": "13ee3c04-ea06-48d7-be57-fe3314b75d0d", + "Request-Id": "00-c8fc1bc8d7dc1147803358eab129da55-553f43cc807d9e4f-00", + "return-client-request-id": "true", + "traceparent": "00-c8fc1bc8d7dc1147803358eab129da55-553f43cc807d9e4f-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "43aa33225ffefaf26a5b007e79b27e8a", + "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": "13ee3c04-ea06-48d7-be57-fe3314b75d0d", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:08 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAAdzmUzwIAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:08 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "f93d503c-8831-4b4f-8b08-3ca9bae15900" + }, + "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/common/userrealm/testuser@azuresdkplayground.onmicrosoft.com?api-version=1.0", + "RequestMethod": "GET", + "RequestHeaders": { + "Request-Id": "00-c8fc1bc8d7dc1147803358eab129da55-2b93b5d9ccdb1547-00", + "traceparent": "00-c8fc1bc8d7dc1147803358eab129da55-2b93b5d9ccdb1547-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "63baa256cbfa541d107b96125ea27ed7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "Content-Disposition": "inline; filename=userrealm.json", + "Content-Length": "187", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:08 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAAdzmUzwIAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:09 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "bc3512ea-9ef3-4d8d-8b2a-d96a1842a700" + }, + "ResponseBody": { + "ver": "1.0", + "account_type": "Managed", + "domain_name": "azuresdkplayground.onmicrosoft.com", + "cloud_instance_name": "microsoftonline.com", + "cloud_audience_urn": "urn:federation:MicrosoftOnline" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "13ee3c04-ea06-48d7-be57-fe3314b75d0d", + "Content-Length": "9", + "Request-Id": "00-c8fc1bc8d7dc1147803358eab129da55-5a3627be2c472844-00", + "return-client-request-id": "true", + "traceparent": "00-c8fc1bc8d7dc1147803358eab129da55-5a3627be2c472844-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "2c02be336af8a14395d93c2279bc9e2a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "13ee3c04-ea06-48d7-be57-fe3314b75d0d", + "Content-Length": "1538", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:09 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAgAAADbpatYOAAAAdzmUzwIAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:09 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,,", + "x-ms-ests-server": "2.1.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "e5543da2-1760-4a76-818a-d0ce2fb97800" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "foci": "1", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlNzWnNCTmhaY0YzUTlTNHRycFFCVEJ5TlJSSSJ9.eyJhdWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1OTEyNzU3ODksIm5iZiI6MTU5MTI3NTc4OSwiZXhwIjoxNTkxMjc5Njg5LCJhaW8iOiJBVFFBeS84UEFBQUFRLzk3UUdzV1QybE9pZ3JUTnFYSEFBc2pjeG5qZmllcGFRamlydm01dzlrcy9NTk45V0ppZXFlSGlIdGVtWkhnIiwibmFtZSI6InRlc3R1c2VyIiwib2lkIjoiMjMzNjY0ZmEtNGU5Mi00Yzg1LTg5NzctZjc4MmEyNDI1OGU0IiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6InppWGhoM2RGVF9ERFA2a2w4aGI0aGVVUGdmTWlJRUJmUUt6RjZIYTZuc0UiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJvajFVNVdBWGRrcUJpdERPTDdsNEFBIiwidmVyIjoiMi4wIn0.BoCjHW0dLd623fvnmx_45uT8On-D6r5c2Nnt9z9E2L-B8Zhi_xh10Z8ZqPIxzM83ENihCzXHAdYGVN6NapOVN-IbEXLonuWNIz_GX5JSDFboXI-cmFFRBeIluhL1xfCxqJJlv5nrbWoKqR6_NNn9sGacC6RR57mBCvdN_qkZ-xWkNKirXqduSnESsxckQ3EI0mJFE0kt-UGatyuDO5mFENdzL2tTDh02RKCC1EFQ6MYwW9zgFvEXJqke6lRGbZQs8vtWzG5tQfJm1u6w9sG9qu94VFpfeTDTpaYyWTsPn0QKI-_z5Fpt3s0KI2PPTjoWPHH1wmxtmp36GAERIN6IvA", + "client_info": "eyJ1aWQiOiIyMzM2NjRmYS00ZTkyLTRjODUtODk3Ny1mNzgyYTI0MjU4ZTQiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "AZURE_IDENTITY_TEST_USERNAME": "testuser@azuresdkplayground.onmicrosoft.com", + "RandomSeed": "1437414500" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateUsernamePasswordLive.json b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateWithContext.json similarity index 71% rename from sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateUsernamePasswordLive.json rename to sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateWithContext.json index 0431323022634..561c2a6ade5cf 100644 --- a/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateUsernamePasswordLive.json +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateWithContext.json @@ -4,12 +4,13 @@ "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": "f725cb55-765e-44dd-97fa-bfa994501733", + "client-request-id": "32463f0c-f6eb-4c09-b59f-c93c0c19f38a", + "Request-Id": "00-d2388a12148d6d448a9e1999a71404f0-54e2688c3cd07846-00", "return-client-request-id": "true", - "traceparent": "00-2bbd94f110c01e4781df229d08ee2c94-e880bc865bda3e4f-00", + "traceparent": "00-d2388a12148d6d448a9e1999a71404f0-54e2688c3cd07846-00", "User-Agent": [ - "azsdk-net-Identity/1.2.0-dev.20200501.1\u002B5c64a3e68df3938066705cb385320fa586525a09", - "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" ], "x-app-name": "UnknownClient", "x-app-ver": "0.0.0.0", @@ -18,7 +19,7 @@ "x-client-OS": "Microsoft Windows 10.0.18363 ", "x-client-SKU": "MSAL.NetCore", "x-client-Ver": "4.10.0.0", - "x-ms-client-request-id": "33fd0c163d049f782d2aab8e56b4fcc8", + "x-ms-client-request-id": "d8b989c0381f173cf71f1cd961a04d5e", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -27,21 +28,20 @@ "Access-Control-Allow-Methods": "GET, OPTIONS", "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", - "client-request-id": "f725cb55-765e-44dd-97fa-bfa994501733", + "client-request-id": "32463f0c-f6eb-4c09-b59f-c93c0c19f38a", "Content-Length": "980", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 01 May 2020 17:08:50 GMT", + "Date": "Thu, 04 Jun 2020 13:08:07 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": [ - "fpc=AmntdWj2vclJplfwvOQTFxk; expires=Sun, 31-May-2020 17:08:51 GMT; path=/; secure; HttpOnly; SameSite=None", - "esctx=AQABAAAAAAAm-06blBE1TpVMil8KPQ41Ft0Hb7R6E4UclRP16lx8O5Mxpz_zsZ5fgiAcpzVesWenHuapAzcaszh2KrDeIHgsX2OO-12elprk6NMrcYTJIREhhwly5ThfmYAMz6pigB43Pbqhtd9ZyOtvlpvBkT3mGIKlQmwKF1k0ZunwjDwaKSu3krq4nNMzxqadCbvmWs4gAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None", + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAA; expires=Sat, 04-Jul-2020 13:08:07 GMT; path=/; secure; HttpOnly; SameSite=None", "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", - "stsservicecookie=ests; 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.10476.10 - WST ProdSlices", - "x-ms-request-id": "df081447-2158-4630-9e01-7a6023883200" + "x-ms-ests-server": "2.1.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "f93d503c-8831-4b4f-8b08-3ca967e15900" }, "ResponseBody": { "tenant_discovery_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", @@ -94,12 +94,13 @@ "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", "RequestMethod": "GET", "RequestHeaders": { - "client-request-id": "f725cb55-765e-44dd-97fa-bfa994501733", + "client-request-id": "32463f0c-f6eb-4c09-b59f-c93c0c19f38a", + "Request-Id": "00-d2388a12148d6d448a9e1999a71404f0-65f51080f6424845-00", "return-client-request-id": "true", - "traceparent": "00-2bbd94f110c01e4781df229d08ee2c94-50df67976af58d4c-00", + "traceparent": "00-d2388a12148d6d448a9e1999a71404f0-65f51080f6424845-00", "User-Agent": [ - "azsdk-net-Identity/1.2.0-dev.20200501.1\u002B5c64a3e68df3938066705cb385320fa586525a09", - "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" ], "x-app-name": "UnknownClient", "x-app-ver": "0.0.0.0", @@ -108,7 +109,7 @@ "x-client-OS": "Microsoft Windows 10.0.18363 ", "x-client-SKU": "MSAL.NetCore", "x-client-Ver": "4.10.0.0", - "x-ms-client-request-id": "b3bccfb96fca0a30d8f7d6b3c8ab3a55", + "x-ms-client-request-id": "eb185f4fd86c1c512a53fb60fb61dd32", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -117,20 +118,20 @@ "Access-Control-Allow-Methods": "GET, OPTIONS", "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", - "client-request-id": "f725cb55-765e-44dd-97fa-bfa994501733", + "client-request-id": "32463f0c-f6eb-4c09-b59f-c93c0c19f38a", "Content-Length": "1523", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 01 May 2020 17:08:50 GMT", + "Date": "Thu, 04 Jun 2020 13:08:07 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": [ - "fpc=AmntdWj2vclJplfwvOQTFxk; expires=Sun, 31-May-2020 17:08:51 GMT; path=/; secure; HttpOnly; SameSite=None", + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAA; expires=Sat, 04-Jul-2020 13:08:07 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.10476.10 - WST ProdSlices", - "x-ms-request-id": "03867cdd-3209-4bb4-8bfa-f124479b3900" + "x-ms-ests-server": "2.1.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "4ed2dea5-a547-4237-afaa-179413e25700" }, "ResponseBody": { "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", @@ -202,15 +203,16 @@ "RequestUri": "https://login.microsoftonline.com/common/userrealm/testuser@azuresdkplayground.onmicrosoft.com?api-version=1.0", "RequestMethod": "GET", "RequestHeaders": { - "traceparent": "00-2bbd94f110c01e4781df229d08ee2c94-e51de99383a3c346-00", + "Request-Id": "00-d2388a12148d6d448a9e1999a71404f0-caa26bbb9961164e-00", + "traceparent": "00-d2388a12148d6d448a9e1999a71404f0-caa26bbb9961164e-00", "User-Agent": [ - "azsdk-net-Identity/1.2.0-dev.20200501.1\u002B5c64a3e68df3938066705cb385320fa586525a09", - "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" ], "x-client-OS": "Microsoft Windows 10.0.18363 ", "x-client-SKU": "MSAL.NetCore", "x-client-Ver": "4.10.0.0", - "x-ms-client-request-id": "b556633aa52b6b5609aed00dc86cd1f8", + "x-ms-client-request-id": "103e8761ee2ecebb5fe7e68ce28371c1", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -220,19 +222,19 @@ "Content-Disposition": "inline; filename=userrealm.json", "Content-Length": "187", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 01 May 2020 17:08:50 GMT", + "Date": "Thu, 04 Jun 2020 13:08:07 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", "Set-Cookie": [ - "fpc=AmntdWj2vclJplfwvOQTFxk; expires=Sun, 31-May-2020 17:08:51 GMT; path=/; secure; HttpOnly; SameSite=None", + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAA; expires=Sat, 04-Jul-2020 13:08:07 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.10476.10 - WST ProdSlices", - "x-ms-request-id": "bf0e4b46-b0ee-4a79-8a17-00778fb43f00" + "x-ms-ests-server": "2.1.10681.6 - WUS2 ProdSlices", + "x-ms-request-id": "9246c45f-eb44-4107-abbf-1d71785b0b00" }, "ResponseBody": { "ver": "1.0", @@ -246,13 +248,14 @@ "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", "RequestMethod": "POST", "RequestHeaders": { - "client-request-id": "f725cb55-765e-44dd-97fa-bfa994501733", + "client-request-id": "32463f0c-f6eb-4c09-b59f-c93c0c19f38a", "Content-Length": "9", + "Request-Id": "00-d2388a12148d6d448a9e1999a71404f0-b375d2ce72fd444b-00", "return-client-request-id": "true", - "traceparent": "00-2bbd94f110c01e4781df229d08ee2c94-59ef276b8db3ee46-00", + "traceparent": "00-d2388a12148d6d448a9e1999a71404f0-b375d2ce72fd444b-00", "User-Agent": [ - "azsdk-net-Identity/1.2.0-dev.20200501.1\u002B5c64a3e68df3938066705cb385320fa586525a09", - "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" ], "x-app-name": "UnknownClient", "x-app-ver": "0.0.0.0", @@ -261,30 +264,30 @@ "x-client-OS": "Microsoft Windows 10.0.18363 ", "x-client-SKU": "MSAL.NetCore", "x-client-Ver": "4.10.0.0", - "x-ms-client-request-id": "c1b89239168aa78edbf25b0c67c5d681", + "x-ms-client-request-id": "ffddeb93fd88e8fb389daecb3ddc1c95", "x-ms-return-client-request-id": "true" }, "RequestBody": "U2FuaXRpemVk", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "f725cb55-765e-44dd-97fa-bfa994501733", + "client-request-id": "32463f0c-f6eb-4c09-b59f-c93c0c19f38a", "Content-Length": "1512", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 01 May 2020 17:08:51 GMT", + "Date": "Thu, 04 Jun 2020 13:08:07 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", "Set-Cookie": [ - "fpc=AmntdWj2vclJplfwvOQTFxl3OZTPAQAAAKNOPtYOAAAA; expires=Sun, 31-May-2020 17:08:52 GMT; path=/; secure; HttpOnly; SameSite=None", + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAAdzmUzwEAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:07 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,,", - "x-ms-ests-server": "2.1.10476.10 - WST ProdSlices", - "x-ms-request-id": "981efc89-f3e9-4d41-8778-5f3c51973f00" + "x-ms-ests-server": "2.1.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "f311569c-b40a-47aa-95fd-4561fce29b00" }, "ResponseBody": { "token_type": "Bearer", @@ -294,7 +297,7 @@ "access_token": "Sanitized", "refresh_token": "Sanitized", "foci": "1", - "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IkN0VHVoTUptRDVNN0RMZHpEMnYyeDNRS1NSWSJ9.eyJhdWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODgzNTI2MzIsIm5iZiI6MTU4ODM1MjYzMiwiZXhwIjoxNTg4MzU2NTMyLCJhaW8iOiJBVFFBeS84UEFBQUE1N1FLNmh4TzQxR2NwNXdNdXhqSDUrYnlnZlNFMzJEZnVXdTBNMnQ5SlhSZ1pja2JCNGZOcGNyb1daSlg2UDZQIiwibmFtZSI6InRlc3R1c2VyIiwib2lkIjoiMjMzNjY0ZmEtNGU5Mi00Yzg1LTg5NzctZjc4MmEyNDI1OGU0IiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6InppWGhoM2RGVF9ERFA2a2w4aGI0aGVVUGdmTWlJRUJmUUt6RjZIYTZuc0UiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJpZndlbU9uelFVMkhlRjg4VVpjX0FBIiwidmVyIjoiMi4wIn0.YGepoeJxclycbeyRhBwUOEGwUluLtmm5jb_XZteNOb8-_pNvbbFudkD05t-octiWGRITa8TiDi-QEeo6kthANJ9r_ugx3dJUYhXdcWwS1sTCBTERSEnIN_QDZKxi3TVIiPOA2S5uIcXhmcQJFnjuXvlEY9SF9NHe11SaYc777hH_FS3dNMJuhJ038ETR35TqCX2KH_v15kGls42chw4iQOhAU3sB0gDg0wOBTd3OvhBar_mMC5r5TGQbK3TdejTxZJQZcP2Dv_ikmJyVzlheIi983qDAMuDwyLZsm7g80fme9vlFJ1z7pbjoUdrEzQCjgDcPJQNa4NRIghG_ahBPqg", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlNzWnNCTmhaY0YzUTlTNHRycFFCVEJ5TlJSSSJ9.eyJhdWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1OTEyNzU3ODcsIm5iZiI6MTU5MTI3NTc4NywiZXhwIjoxNTkxMjc5Njg3LCJhaW8iOiJBVFFBeS84UEFBQUFGR1J5cHZOd1I0WURTT3lsT3MwdUoyMUJvVFRBOE1GODVYcHlhL3lhaEZ2T2dxVy90Zm9XY2V3dHd6L2JERnMwIiwibmFtZSI6InRlc3R1c2VyIiwib2lkIjoiMjMzNjY0ZmEtNGU5Mi00Yzg1LTg5NzctZjc4MmEyNDI1OGU0IiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6InppWGhoM2RGVF9ERFA2a2w4aGI0aGVVUGdmTWlJRUJmUUt6RjZIYTZuc0UiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJuRllSOHdxMHFrZVZfVVZoX09LYkFBIiwidmVyIjoiMi4wIn0.J-O6-sse9o2rVsYFxIAa2mGDMJdi7gcydB2YbZ4k-LOZzOv3yHgNfzMLZDik9VTkYRKc6Mo__ddFqcANuvqvfrrPrwOi8GvNSqNrxybt_k0BQTO80GjiuXc98c7ejH5vnUVrzNko22r7ZYazqgtVZgyBl84H0OQ6hlvO-haF6fG80pwUSDusKKiFRnpATAPBfj8He5s-jinXLz3yfY2od8b30i7jJj8s1PZ0JNuVKxnW3MbTOzh7dKbB5J6a606z6OFM6YjrVasmjN2hGXcqDkJ0pk5JfNMrrJ2cnkk583ri2kRlYgMOojPQKtTI6bCRAPuCpfZTddXJUnstlxmxBQ", "client_info": "eyJ1aWQiOiIyMzM2NjRmYS00ZTkyLTRjODUtODk3Ny1mNzgyYTI0MjU4ZTQiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" } } @@ -302,6 +305,6 @@ "Variables": { "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", "AZURE_IDENTITY_TEST_USERNAME": "testuser@azuresdkplayground.onmicrosoft.com", - "RandomSeed": "1640485913" + "RandomSeed": "1467541649" } } \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateUsernamePasswordLiveAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateWithContextAsync.json similarity index 71% rename from sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateUsernamePasswordLiveAsync.json rename to sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateWithContextAsync.json index 29a704a35c9c9..f3c8e9d776850 100644 --- a/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateUsernamePasswordLiveAsync.json +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/AuthenticateWithContextAsync.json @@ -4,12 +4,13 @@ "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": "188d06c2-35ac-42bb-acaa-75e939f64965", + "client-request-id": "404f2323-e5dc-4881-b0c1-06729e18a1a6", + "Request-Id": "00-a5431b59819a3d4f884700f89713706c-ba91ced5f60e4f44-00", "return-client-request-id": "true", - "traceparent": "00-0ee4e59871e75d468cf4182eef387198-bd5b6ea073d73d46-00", + "traceparent": "00-a5431b59819a3d4f884700f89713706c-ba91ced5f60e4f44-00", "User-Agent": [ - "azsdk-net-Identity/1.2.0-dev.20200501.1\u002B5c64a3e68df3938066705cb385320fa586525a09", - "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" ], "x-app-name": "UnknownClient", "x-app-ver": "0.0.0.0", @@ -18,7 +19,7 @@ "x-client-OS": "Microsoft Windows 10.0.18363 ", "x-client-SKU": "MSAL.NetCore", "x-client-Ver": "4.10.0.0", - "x-ms-client-request-id": "04abe87d1e994cd9c8ffaf86d1a5283b", + "x-ms-client-request-id": "f3548871c2bd992649339173ae0eba69", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -27,21 +28,20 @@ "Access-Control-Allow-Methods": "GET, OPTIONS", "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", - "client-request-id": "188d06c2-35ac-42bb-acaa-75e939f64965", + "client-request-id": "404f2323-e5dc-4881-b0c1-06729e18a1a6", "Content-Length": "980", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 01 May 2020 17:08:42 GMT", + "Date": "Thu, 04 Jun 2020 13:08:09 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": [ - "fpc=AnsVsjaSN-xMizwKStJWKiM; expires=Sun, 31-May-2020 17:08:43 GMT; path=/; secure; HttpOnly; SameSite=None", - "esctx=AQABAAAAAAAm-06blBE1TpVMil8KPQ41HAuLoLfUm47s75M2aurDzb7w_AekMyt4PQLGUO3fXjN09SBX0zDNYhMyMOwVN2q4OcEJmlNmS6xOAmymuObK_8m0Rib-lvcCcwqEcYQW9ItGaJL7dEDZNRGNONM9uxD_pAYDCwPk1w9RAMYZAR-8oQEJmK2ogbifdTyLsfd2AIsgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None", + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAgAAADbpatYOAAAAdzmUzwIAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:09 GMT; path=/; secure; HttpOnly; SameSite=None", "x-ms-gateway-slice=prod; path=/; SameSite=None; secure; HttpOnly", - "stsservicecookie=ests; 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.10476.10 - WST ProdSlices", - "x-ms-request-id": "0e02bbcb-c6b5-497a-b12f-af22c8144000" + "x-ms-ests-server": "2.1.10681.6 - WUS2 ProdSlices", + "x-ms-request-id": "b95b9fae-25d1-4886-a8f5-e65457771400" }, "ResponseBody": { "tenant_discovery_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", @@ -94,12 +94,13 @@ "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/v2.0/.well-known/openid-configuration", "RequestMethod": "GET", "RequestHeaders": { - "client-request-id": "188d06c2-35ac-42bb-acaa-75e939f64965", + "client-request-id": "404f2323-e5dc-4881-b0c1-06729e18a1a6", + "Request-Id": "00-a5431b59819a3d4f884700f89713706c-24b9a34cfe908844-00", "return-client-request-id": "true", - "traceparent": "00-0ee4e59871e75d468cf4182eef387198-28e48dc880c1f447-00", + "traceparent": "00-a5431b59819a3d4f884700f89713706c-24b9a34cfe908844-00", "User-Agent": [ - "azsdk-net-Identity/1.2.0-dev.20200501.1\u002B5c64a3e68df3938066705cb385320fa586525a09", - "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" ], "x-app-name": "UnknownClient", "x-app-ver": "0.0.0.0", @@ -108,7 +109,7 @@ "x-client-OS": "Microsoft Windows 10.0.18363 ", "x-client-SKU": "MSAL.NetCore", "x-client-Ver": "4.10.0.0", - "x-ms-client-request-id": "a6f0ba89f608dba8a1208003edc07d6b", + "x-ms-client-request-id": "ff5eb3275aa50db1e05f5b911c16748c", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -117,20 +118,20 @@ "Access-Control-Allow-Methods": "GET, OPTIONS", "Access-Control-Allow-Origin": "*", "Cache-Control": "max-age=86400, private", - "client-request-id": "188d06c2-35ac-42bb-acaa-75e939f64965", + "client-request-id": "404f2323-e5dc-4881-b0c1-06729e18a1a6", "Content-Length": "1523", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 01 May 2020 17:08:42 GMT", + "Date": "Thu, 04 Jun 2020 13:08:09 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": [ - "fpc=AnsVsjaSN-xMizwKStJWKiM; expires=Sun, 31-May-2020 17:08:43 GMT; path=/; secure; HttpOnly; SameSite=None", + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAgAAADbpatYOAAAAdzmUzwIAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:09 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.10476.10 - WST ProdSlices", - "x-ms-request-id": "a8217829-7513-4236-ae51-70f7c66b3f00" + "x-ms-ests-server": "2.1.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "05f1898f-e921-4c70-a8f0-79c1f6a15900" }, "ResponseBody": { "token_endpoint": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", @@ -202,15 +203,16 @@ "RequestUri": "https://login.microsoftonline.com/common/userrealm/testuser@azuresdkplayground.onmicrosoft.com?api-version=1.0", "RequestMethod": "GET", "RequestHeaders": { - "traceparent": "00-0ee4e59871e75d468cf4182eef387198-040a7dcc2393c746-00", + "Request-Id": "00-a5431b59819a3d4f884700f89713706c-31ea4ccbf27d9245-00", + "traceparent": "00-a5431b59819a3d4f884700f89713706c-31ea4ccbf27d9245-00", "User-Agent": [ - "azsdk-net-Identity/1.2.0-dev.20200501.1\u002B5c64a3e68df3938066705cb385320fa586525a09", - "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" ], "x-client-OS": "Microsoft Windows 10.0.18363 ", "x-client-SKU": "MSAL.NetCore", "x-client-Ver": "4.10.0.0", - "x-ms-client-request-id": "ffe420794f0581b0ba5b7c2af67b3447", + "x-ms-client-request-id": "001ced6ba6baeafa0eef57b864245024", "x-ms-return-client-request-id": "true" }, "RequestBody": null, @@ -220,19 +222,19 @@ "Content-Disposition": "inline; filename=userrealm.json", "Content-Length": "187", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 01 May 2020 17:08:42 GMT", + "Date": "Thu, 04 Jun 2020 13:08:09 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", "Set-Cookie": [ - "fpc=AnsVsjaSN-xMizwKStJWKiM; expires=Sun, 31-May-2020 17:08:43 GMT; path=/; secure; HttpOnly; SameSite=None", + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAgAAADbpatYOAAAAdzmUzwIAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:09 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.10476.10 - WUS2 ProdSlices", - "x-ms-request-id": "214668ad-7872-4c66-aca5-823a9aee2500" + "x-ms-ests-server": "2.1.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "87a39310-cc10-4a7d-9d69-04b99a694600" }, "ResponseBody": { "ver": "1.0", @@ -246,13 +248,14 @@ "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", "RequestMethod": "POST", "RequestHeaders": { - "client-request-id": "188d06c2-35ac-42bb-acaa-75e939f64965", + "client-request-id": "404f2323-e5dc-4881-b0c1-06729e18a1a6", "Content-Length": "9", + "Request-Id": "00-a5431b59819a3d4f884700f89713706c-213bf768489d104e-00", "return-client-request-id": "true", - "traceparent": "00-0ee4e59871e75d468cf4182eef387198-02621dcc0ec7f14a-00", + "traceparent": "00-a5431b59819a3d4f884700f89713706c-213bf768489d104e-00", "User-Agent": [ - "azsdk-net-Identity/1.2.0-dev.20200501.1\u002B5c64a3e68df3938066705cb385320fa586525a09", - "(.NET Core 4.6.28619.01; Microsoft Windows 10.0.18363 )" + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" ], "x-app-name": "UnknownClient", "x-app-ver": "0.0.0.0", @@ -261,30 +264,30 @@ "x-client-OS": "Microsoft Windows 10.0.18363 ", "x-client-SKU": "MSAL.NetCore", "x-client-Ver": "4.10.0.0", - "x-ms-client-request-id": "1e59d6c1dddc87f13fcf62789dd55f07", + "x-ms-client-request-id": "afd9aafb9ec31795d646125d67957d33", "x-ms-return-client-request-id": "true" }, "RequestBody": "U2FuaXRpemVk", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "188d06c2-35ac-42bb-acaa-75e939f64965", + "client-request-id": "404f2323-e5dc-4881-b0c1-06729e18a1a6", "Content-Length": "1512", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 01 May 2020 17:08:43 GMT", + "Date": "Thu, 04 Jun 2020 13:08:09 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", "Set-Cookie": [ - "fpc=AnsVsjaSN-xMizwKStJWKiN3OZTPAQAAAJpOPtYOAAAA; expires=Sun, 31-May-2020 17:08:43 GMT; path=/; secure; HttpOnly; SameSite=None", + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAgAAADbpatYOAAAAdzmUzwMAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:10 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,,", - "x-ms-ests-server": "2.1.10476.10 - WUS2 ProdSlices", - "x-ms-request-id": "214668ad-7872-4c66-aca5-823a9eee2500" + "x-ms-ests-server": "2.1.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "ecd2e59e-d104-46f0-8af5-94cf93505600" }, "ResponseBody": { "token_type": "Bearer", @@ -294,7 +297,7 @@ "access_token": "Sanitized", "refresh_token": "Sanitized", "foci": "1", - "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IkN0VHVoTUptRDVNN0RMZHpEMnYyeDNRS1NSWSJ9.eyJhdWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1ODgzNTI2MjMsIm5iZiI6MTU4ODM1MjYyMywiZXhwIjoxNTg4MzU2NTIzLCJhaW8iOiJBVFFBeS84UEFBQUFSWEhiZWE2aGZlUmN4bU1YNkpuZG1LUGtUS3pNL3JZRlQ2NmFyNU42eXpQUStTdWgxdGErL2VHVk9XNmh2aTBpIiwibmFtZSI6InRlc3R1c2VyIiwib2lkIjoiMjMzNjY0ZmEtNGU5Mi00Yzg1LTg5NzctZjc4MmEyNDI1OGU0IiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6InppWGhoM2RGVF9ERFA2a2w4aGI0aGVVUGdmTWlJRUJmUUt6RjZIYTZuc0UiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJyV2hHSVhKNFpreXNwWUk2bnU0bEFBIiwidmVyIjoiMi4wIn0.NFZ7qi-zBZXCFssfQXx-MGHIRlrDvLRAqH13DMcM1q0OgqVkJ_UCw47XRegl1zks4fseW6BHc32pTlt1QaebmX9rKEjM3eV470hcb0cXB-OXQdG2yNdx95HOB6gTjavn9W9-476R7suGJpYf_nmF-Pn_2E9bykLkPsLgL55ygCdlBpE8mBB_CRt4FJIzKl0s45wUeksx0pmEssjdWcpdqu8OA5vaLbnScTGYcKTQyRyV8LLTe4RpHcC9i6SkukTNtfoirq7VwRqAqIh77sLPC8RpeGfLVRKZb7vuB8CIh8QzioWSOkTqWjVj9pP6OC6qRWqjlL7_epfLBCJ9xjLpBA", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlNzWnNCTmhaY0YzUTlTNHRycFFCVEJ5TlJSSSJ9.eyJhdWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1OTEyNzU3ODksIm5iZiI6MTU5MTI3NTc4OSwiZXhwIjoxNTkxMjc5Njg5LCJhaW8iOiJBVFFBeS84UEFBQUFJQzA1QUd4Z0h4NWdtLzRzTlBkL21iT2xhdExiMnh4ZEsyYVZwT0p5TUQ3UkUwcitqbThndlZlNFJpMHpYalAzIiwibmFtZSI6InRlc3R1c2VyIiwib2lkIjoiMjMzNjY0ZmEtNGU5Mi00Yzg1LTg5NzctZjc4MmEyNDI1OGU0IiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6InppWGhoM2RGVF9ERFA2a2w4aGI0aGVVUGdmTWlJRUJmUUt6RjZIYTZuc0UiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJudVhTN0FUUjhFYUs5WlRQazFCV0FBIiwidmVyIjoiMi4wIn0.jZFvCEZY6Y0Y4RKtlHR3uMmLMborMQYuI1eQjhmxeob-RQtdfPxg4QtnAno-YtLHMsBKnd7bS-sP0WCvAqSJOeITOP_DF9oZo372OoTzzgvL3ocFwS8eDxfcCab_sGzHXsH-_3pE5QH_CPhSVGujmG33W0_Ztulrljtl9xwAsfspok97_TzqwaJv_r_WAc7aEWBSqG2tIYgPNfe6o5TcdT5HrGat1cOLSViL1SzEbQ1ZR_Onmqjl7XdtnvbVHUDdxkxzmCeVCFAE4tfb4dyeEtq10HkLixHFbfcrXvU8j6QIiLqB6A6Q1Eq8ts_OPsXvOJKk5iXr3wdPso-C5cIQgg", "client_info": "eyJ1aWQiOiIyMzM2NjRmYS00ZTkyLTRjODUtODk3Ny1mNzgyYTI0MjU4ZTQiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" } } @@ -302,6 +305,6 @@ "Variables": { "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", "AZURE_IDENTITY_TEST_USERNAME": "testuser@azuresdkplayground.onmicrosoft.com", - "RandomSeed": "2008179389" + "RandomSeed": "456267963" } } \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/GetToken.json b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/GetToken.json new file mode 100644 index 0000000000000..cf4d13dc81add --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/GetToken.json @@ -0,0 +1,310 @@ +{ + "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": "4b58ae2c-17ff-4e8e-af72-cf2eff0e567e", + "Request-Id": "00-089e44500b6b1b448c90b6dd678865c1-84994c6e495ba941-00", + "return-client-request-id": "true", + "traceparent": "00-089e44500b6b1b448c90b6dd678865c1-84994c6e495ba941-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "d8ccb782f5e117fd9c41e7d0be9d8be2", + "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": "4b58ae2c-17ff-4e8e-af72-cf2eff0e567e", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:07 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAAdzmUzwEAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:08 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "ed214c55-cfb5-4cb0-92b7-25973adc8500" + }, + "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": "4b58ae2c-17ff-4e8e-af72-cf2eff0e567e", + "Request-Id": "00-089e44500b6b1b448c90b6dd678865c1-62b24c03d0f4d04b-00", + "return-client-request-id": "true", + "traceparent": "00-089e44500b6b1b448c90b6dd678865c1-62b24c03d0f4d04b-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "8108e0ee2b9c5e9193c7d3b63981f663", + "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": "4b58ae2c-17ff-4e8e-af72-cf2eff0e567e", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:07 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAAdzmUzwEAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:08 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "b8d68b4c-4b0c-4e35-8d06-8a32f7bfa400" + }, + "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/common/userrealm/testuser@azuresdkplayground.onmicrosoft.com?api-version=1.0", + "RequestMethod": "GET", + "RequestHeaders": { + "Request-Id": "00-089e44500b6b1b448c90b6dd678865c1-de6842ee3ca92243-00", + "traceparent": "00-089e44500b6b1b448c90b6dd678865c1-de6842ee3ca92243-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "0b85252f1c6f7fa24a0a95edb1f0fd62", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "Content-Disposition": "inline; filename=userrealm.json", + "Content-Length": "187", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:08 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAAdzmUzwEAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:08 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "4ed2dea5-a547-4237-afaa-179444e25700" + }, + "ResponseBody": { + "ver": "1.0", + "account_type": "Managed", + "domain_name": "azuresdkplayground.onmicrosoft.com", + "cloud_instance_name": "microsoftonline.com", + "cloud_audience_urn": "urn:federation:MicrosoftOnline" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "4b58ae2c-17ff-4e8e-af72-cf2eff0e567e", + "Content-Length": "9", + "Request-Id": "00-089e44500b6b1b448c90b6dd678865c1-c1f0e5d5e6bf714a-00", + "return-client-request-id": "true", + "traceparent": "00-089e44500b6b1b448c90b6dd678865c1-c1f0e5d5e6bf714a-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "3d4a8d8c0761566e266d451a2247de1b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "4b58ae2c-17ff-4e8e-af72-cf2eff0e567e", + "Content-Length": "1512", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:08 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAQAAADbpatYOAAAAdzmUzwIAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:08 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,,", + "x-ms-ests-server": "2.1.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "4b1e44c1-d21d-438e-a23b-9c5461e49b00" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "https://vault.azure.net/user_impersonation https://vault.azure.net/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "foci": "1", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlNzWnNCTmhaY0YzUTlTNHRycFFCVEJ5TlJSSSJ9.eyJhdWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1OTEyNzU3ODgsIm5iZiI6MTU5MTI3NTc4OCwiZXhwIjoxNTkxMjc5Njg4LCJhaW8iOiI0MmRnWUlpeTFjNjVJTjdKMHlVWk95dFRmMWJoaEJudGpKYVBIUDBtenJiVGVPUEJ3Q3JYMml5V3R2bkY0UlR6ZHkzNWh0WUhBQT09IiwibmFtZSI6InRlc3R1c2VyIiwib2lkIjoiMjMzNjY0ZmEtNGU5Mi00Yzg1LTg5NzctZjc4MmEyNDI1OGU0IiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6InppWGhoM2RGVF9ERFA2a2w4aGI0aGVVUGdmTWlJRUJmUUt6RjZIYTZuc0UiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJ3VVFlU3gzU2prT2lPNXhVWWVTYkFBIiwidmVyIjoiMi4wIn0.miuWhb8ymV1GQnl9h808QdIzmBrli1g31YE1ZZ6-b-6hg9gFdqyT2rDRBhl_uJXZMAUX_gnab_yhu6dgD9w3OcQYOZ06f7RxWM5f_o631OEUbwBafqhsfPhwZ0y53kDU8WK-kAYBa6XX1sN8VHPSVDtZ_XxpKHhuFsoZCEoCJvfw9-g86VKvoEMlbahgX4wW399aqgJOaR_2j8POdWkukAkPBHaD1EQ0yw1IrksgHk_UgfxA09M1YSqLLG0GoZM4T1ykNicBpd_aeWn_GsPve4zYQr8qbuO4rMWjwq7WZfFh9y5zYjWjfGxqoANDWvenHKbaTK6xayXWogqLx3_AKQ", + "client_info": "eyJ1aWQiOiIyMzM2NjRmYS00ZTkyLTRjODUtODk3Ny1mNzgyYTI0MjU4ZTQiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "AZURE_IDENTITY_TEST_USERNAME": "testuser@azuresdkplayground.onmicrosoft.com", + "RandomSeed": "177763837" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/GetTokenAsync.json b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/GetTokenAsync.json new file mode 100644 index 0000000000000..7a29160d5c152 --- /dev/null +++ b/sdk/identity/Azure.Identity/tests/SessionRecords/UsernamePasswordCredentialLiveTests/GetTokenAsync.json @@ -0,0 +1,310 @@ +{ + "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": "bd3260b2-12f0-4e49-aa66-367a9f6ceccc", + "Request-Id": "00-ead8fcef4259ae4da7ca12fe303f4552-5763a8e36fa4644d-00", + "return-client-request-id": "true", + "traceparent": "00-ead8fcef4259ae4da7ca12fe303f4552-5763a8e36fa4644d-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "c4507150f034ddcb92bb7a9ee0de770c", + "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": "bd3260b2-12f0-4e49-aa66-367a9f6ceccc", + "Content-Length": "980", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:10 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAgAAADbpatYOAAAAdzmUzwMAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:10 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "7fedc2a7-af68-4ffd-884a-531b1eba7d00" + }, + "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": "bd3260b2-12f0-4e49-aa66-367a9f6ceccc", + "Request-Id": "00-ead8fcef4259ae4da7ca12fe303f4552-7c41e4422ff1a247-00", + "return-client-request-id": "true", + "traceparent": "00-ead8fcef4259ae4da7ca12fe303f4552-7c41e4422ff1a247-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "1c97e3805e12dc0d952c72b4111f03db", + "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": "bd3260b2-12f0-4e49-aa66-367a9f6ceccc", + "Content-Length": "1523", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:10 GMT", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAgAAADbpatYOAAAAdzmUzwMAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:10 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "feea6931-97e2-472f-963c-88d054b57a00" + }, + "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/common/userrealm/testuser@azuresdkplayground.onmicrosoft.com?api-version=1.0", + "RequestMethod": "GET", + "RequestHeaders": { + "Request-Id": "00-ead8fcef4259ae4da7ca12fe303f4552-270c5fc1ba0ea74a-00", + "traceparent": "00-ead8fcef4259ae4da7ca12fe303f4552-270c5fc1ba0ea74a-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "8a88bf7af0b9eb1a652d728e0d4bca2d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "Content-Disposition": "inline; filename=userrealm.json", + "Content-Length": "187", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:10 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAgAAADbpatYOAAAAdzmUzwMAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:10 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.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "f23e79c6-b9db-4764-b9d0-1e483d6d8100" + }, + "ResponseBody": { + "ver": "1.0", + "account_type": "Managed", + "domain_name": "azuresdkplayground.onmicrosoft.com", + "cloud_instance_name": "microsoftonline.com", + "cloud_audience_urn": "urn:federation:MicrosoftOnline" + } + }, + { + "RequestUri": "https://login.microsoftonline.com/c54fac88-3dd3-461f-a7c4-8a368e0340b3/oauth2/v2.0/token", + "RequestMethod": "POST", + "RequestHeaders": { + "client-request-id": "bd3260b2-12f0-4e49-aa66-367a9f6ceccc", + "Content-Length": "9", + "Request-Id": "00-ead8fcef4259ae4da7ca12fe303f4552-efd290baea591c4e-00", + "return-client-request-id": "true", + "traceparent": "00-ead8fcef4259ae4da7ca12fe303f4552-efd290baea591c4e-00", + "User-Agent": [ + "azsdk-net-Identity/1.2.0-dev.20200604.1\u002Bd07dcc5a7b904af0bb3c2b801eee4b2ec1d10750", + "(.NET Core 4.6.28801.04; Microsoft Windows 10.0.18363 )" + ], + "x-app-name": "UnknownClient", + "x-app-ver": "0.0.0.0", + "x-client-current-telemetry": "1|1003,0|", + "x-client-last-telemetry": "", + "x-client-OS": "Microsoft Windows 10.0.18363 ", + "x-client-SKU": "MSAL.NetCore", + "x-client-Ver": "4.10.0.0", + "x-ms-client-request-id": "39db546f0b1df19063732e077e17cc72", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "U2FuaXRpemVk", + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-store, no-cache", + "client-request-id": "bd3260b2-12f0-4e49-aa66-367a9f6ceccc", + "Content-Length": "1512", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 04 Jun 2020 13:08:10 GMT", + "Expires": "-1", + "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", + "Pragma": "no-cache", + "Set-Cookie": [ + "fpc=ArwN4Sp0iuZArCOiVpol7nMZVSmMAgAAADbpatYOAAAAdzmUzwQAAAA36WrWDgAAAA; expires=Sat, 04-Jul-2020 13:08:11 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,,", + "x-ms-ests-server": "2.1.10681.4 - WUS2 ProdSlices", + "x-ms-request-id": "e5543da2-1760-4a76-818a-d0ceeab97800" + }, + "ResponseBody": { + "token_type": "Bearer", + "scope": "https://vault.azure.net/user_impersonation https://vault.azure.net/.default", + "expires_in": 3599, + "ext_expires_in": 3599, + "access_token": "Sanitized", + "refresh_token": "Sanitized", + "foci": "1", + "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlNzWnNCTmhaY0YzUTlTNHRycFFCVEJ5TlJSSSJ9.eyJhdWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzL3YyLjAiLCJpYXQiOjE1OTEyNzU3OTEsIm5iZiI6MTU5MTI3NTc5MSwiZXhwIjoxNTkxMjc5NjkxLCJhaW8iOiJBVFFBeS84UEFBQUFIS20rQ3R3d1N4L3BocjhhNHJiVzlpc0xyK1htK09NNWhDdlpOQ0FtNkpVcnByTkdrTzM2S0dvYklXQ0pxT0tiIiwibmFtZSI6InRlc3R1c2VyIiwib2lkIjoiMjMzNjY0ZmEtNGU5Mi00Yzg1LTg5NzctZjc4MmEyNDI1OGU0IiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJAYXp1cmVzZGtwbGF5Z3JvdW5kLm9ubWljcm9zb2Z0LmNvbSIsInN1YiI6InppWGhoM2RGVF9ERFA2a2w4aGI0aGVVUGdmTWlJRUJmUUt6RjZIYTZuc0UiLCJ0aWQiOiJjNTRmYWM4OC0zZGQzLTQ2MWYtYTdjNC04YTM2OGUwMzQwYjMiLCJ1dGkiOiJvajFVNVdBWGRrcUJpdERPNnJsNEFBIiwidmVyIjoiMi4wIn0.C1iiZyeIPXgdQlbR17VIpsCVhrlZLXLpx173oWw0DDWNsj_8WGv4kPY7OrQyztPRvygHTloHTfAEfgUJ2XxPe6DPzC3UDaE1RHqWayw45iYSpitUm8I2qnYMH-PlRMoTCKqw4FlzICGwXPufnKWh1o2Q5UXEC6UtNxvraC3uX-2PG7XdOR6hQ-kUWxz1eZR4p_AdiUca-AJPPFvWQba2lyfxjWI4H5dCCI17v4SlCi280QTVH5Gi_IjyauSubqp6wNkhXPZNRII-wcq4edcEZBFSKwBm6Uu48IfKx-J0U4BtdSOKCeI4Swaw7v3_aAQDYjii1_Ud7vbtcDMKn3RXbQ", + "client_info": "eyJ1aWQiOiIyMzM2NjRmYS00ZTkyLTRjODUtODk3Ny1mNzgyYTI0MjU4ZTQiLCJ1dGlkIjoiYzU0ZmFjODgtM2RkMy00NjFmLWE3YzQtOGEzNjhlMDM0MGIzIn0" + } + } + ], + "Variables": { + "AZURE_IDENTITY_TEST_TENANTID": "c54fac88-3dd3-461f-a7c4-8a368e0340b3", + "AZURE_IDENTITY_TEST_USERNAME": "testuser@azuresdkplayground.onmicrosoft.com", + "RandomSeed": "507064302" + } +} \ No newline at end of file diff --git a/sdk/identity/Azure.Identity/tests/UsernamePasswordCredentialLiveTests.cs b/sdk/identity/Azure.Identity/tests/UsernamePasswordCredentialLiveTests.cs index b968c8d8cfaaa..42040d2961c3d 100644 --- a/sdk/identity/Azure.Identity/tests/UsernamePasswordCredentialLiveTests.cs +++ b/sdk/identity/Azure.Identity/tests/UsernamePasswordCredentialLiveTests.cs @@ -69,7 +69,7 @@ public void ClearDiscoveryCache() // or fork. To re-record these tests the following steps MUST be COMPLETELY // followed before pushing any updates. See class comment for instructions [Test] - public async Task AuthenticateUsernamePasswordLive() + public async Task GetToken() { var tenantId = TestEnvironment.IdentityTenantId; var username = TestEnvironment.Username; @@ -83,5 +83,43 @@ public async Task AuthenticateUsernamePasswordLive() Assert.IsNotNull(token.Token); } + + [Test] + public async Task AuthenticateNoContext() + { + var tenantId = TestEnvironment.IdentityTenantId; + var username = TestEnvironment.Username; + var password = TestEnvironment.TestPassword; + + var options = Recording.InstrumentClientOptions(new TokenCredentialOptions()); + + var cred = InstrumentClient(new UsernamePasswordCredential(username, password, tenantId, ClientId, options)); + + AuthenticationRecord record = await cred.AuthenticateAsync(); + + Assert.IsNotNull(record); + + Assert.AreEqual(username, record.Username); + Assert.AreEqual(tenantId, record.TenantId); + } + + [Test] + public async Task AuthenticateWithContext() + { + var tenantId = TestEnvironment.IdentityTenantId; + var username = TestEnvironment.Username; + var password = TestEnvironment.TestPassword; + + var options = Recording.InstrumentClientOptions(new TokenCredentialOptions()); + + var cred = InstrumentClient(new UsernamePasswordCredential(username, password, tenantId, ClientId, options)); + + AuthenticationRecord record = await cred.AuthenticateAsync(new TokenRequestContext(new[] { "https://vault.azure.net/.default" })); + + Assert.IsNotNull(record); + + Assert.AreEqual(username, record.Username); + Assert.AreEqual(tenantId, record.TenantId); + } } }