diff --git a/sdk/template/template/package.json b/sdk/template/template/package.json index ca60570e6b3d..68bbc136a6bc 100644 --- a/sdk/template/template/package.json +++ b/sdk/template/template/package.json @@ -90,7 +90,7 @@ "devDependencies": { "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@azure/identity": "^1.1.0", + "@azure/identity": "2.0.0-beta.4", "@azure/test-utils-recorder": "^1.0.0", "@microsoft/api-extractor": "7.7.11", "@types/chai": "^4.1.6", diff --git a/sdk/template/template/recordings/browsers/aad_configurationclient_functional_tests/recording_predetermined_setting_has_expected_value.json b/sdk/template/template/recordings/browsers/aad_configurationclient_functional_tests/recording_predetermined_setting_has_expected_value.json index 2994f728b5be..b1ad21521a3e 100644 --- a/sdk/template/template/recordings/browsers/aad_configurationclient_functional_tests/recording_predetermined_setting_has_expected_value.json +++ b/sdk/template/template/recordings/browsers/aad_configurationclient_functional_tests/recording_predetermined_setting_has_expected_value.json @@ -1,56 +1,56 @@ { - "recordings": [ - { - "method": "POST", - "url": "https://login.microsoftonline.com/azure_tenant_id/oauth2/v2.0/token", - "query": {}, - "requestBody": "response_type=token&grant_type=client_credentials&client_id=azure_client_id&client_secret=azure_client_secret&scope=https%3A%2F%2Fmyappconfig.azconfig.io%2F.default", - "status": 200, - "response": "{\"token_type\":\"Bearer\",\"expires_in\":3599,\"ext_expires_in\":3599,\"access_token\":\"access_token\"}", - "responseHeaders": { - "cache-control": "no-store, no-cache", - "content-length": "1491", - "content-type": "application/json; charset=utf-8", - "date": "Mon, 26 Oct 2020 21:18:44 GMT", - "expires": "-1", - "p3p": "CP=\"DSP CUR OTPi IND OTRi ONL FIN\"", - "pragma": "no-cache", - "referrer-policy": "strict-origin-when-cross-origin", - "strict-transport-security": "max-age=31536000; includeSubDomains", - "x-content-type-options": "nosniff", - "x-ms-ests-server": "2.1.11169.11 - SCUS ProdSlices", - "x-ms-request-id": "a05c2f53-347b-43be-8e75-8adac3e40101" - } + "recordings": [ + { + "method": "POST", + "url": "https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/oauth2/v2.0/token", + "query": {}, + "requestBody": "response_type=token&grant_type=client_credentials&client_id=azure_client_id&client_secret=azure_client_secret&scope=https%3A%2F%2Fmyappconfig.azconfig.io%2F.default", + "status": 200, + "response": "{\"token_type\":\"Bearer\",\"expires_in\":3599,\"ext_expires_in\":3599,\"access_token\":\"access_token\"}", + "responseHeaders": { + "cache-control": "no-store, no-cache", + "content-length": "1491", + "content-type": "application/json; charset=utf-8", + "date": "Mon, 26 Oct 2020 21:18:44 GMT", + "expires": "-1", + "p3p": "CP=\"DSP CUR OTPi IND OTRi ONL FIN\"", + "pragma": "no-cache", + "referrer-policy": "strict-origin-when-cross-origin", + "strict-transport-security": "max-age=31536000; includeSubDomains", + "x-content-type-options": "nosniff", + "x-ms-ests-server": "2.1.11169.11 - SCUS ProdSlices", + "x-ms-request-id": "a05c2f53-347b-43be-8e75-8adac3e40101" + } + }, + { + "method": "GET", + "url": "https://myappconfig.azconfig.io/kv/test-key", + "query": { + "api-version": "1.0" + }, + "requestBody": null, + "status": 200, + "response": "{\"etag\":\"cbARBFLodwGLL3qktvCwmLa1vet\",\"key\":\"test-key\",\"label\":null,\"content_type\":\"\",\"value\":\"test-value\",\"tags\":{},\"locked\":false,\"last_modified\":\"2020-10-16T00:08:12+00:00\"}", + "responseHeaders": { + "access-control-allow-credentials": "true", + "access-control-allow-origin": "*", + "access-control-expose-headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, WWW-Authenticate", + "content-type": "application/vnd.microsoft.appconfig.kv+json; charset=utf-8", + "date": "Mon, 26 Oct 2020 21:18:45 GMT", + "etag": "\"cbARBFLodwGLL3qktvCwmLa1vet\"", + "last-modified": "Fri, 16 Oct 2020 00:08:12 GMT", + "server": "openresty/1.17.8.2", + "status": "200", + "strict-transport-security": "max-age=15724800; includeSubDomains", + "sync-token": "zAJw6V16=MDozIzUxNTAyNjY=;sn=5150266", + "x-ms-correlation-request-id": "764e6e56-1dac-4c11-94b7-8a45c90d3bb9", + "x-ms-request-id": "764e6e56-1dac-4c11-94b7-8a45c90d3bb9" + } + } + ], + "uniqueTestInfo": { + "uniqueName": {}, + "newDate": {} }, - { - "method": "GET", - "url": "https://myappconfig.azconfig.io/kv/test-key", - "query": { - "api-version": "1.0" - }, - "requestBody": null, - "status": 200, - "response": "{\"etag\":\"cbARBFLodwGLL3qktvCwmLa1vet\",\"key\":\"test-key\",\"label\":null,\"content_type\":\"\",\"value\":\"test-value\",\"tags\":{},\"locked\":false,\"last_modified\":\"2020-10-16T00:08:12+00:00\"}", - "responseHeaders": { - "access-control-allow-credentials": "true", - "access-control-allow-origin": "*", - "access-control-expose-headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, WWW-Authenticate", - "content-type": "application/vnd.microsoft.appconfig.kv+json; charset=utf-8", - "date": "Mon, 26 Oct 2020 21:18:45 GMT", - "etag": "\"cbARBFLodwGLL3qktvCwmLa1vet\"", - "last-modified": "Fri, 16 Oct 2020 00:08:12 GMT", - "server": "openresty/1.17.8.2", - "status": "200", - "strict-transport-security": "max-age=15724800; includeSubDomains", - "sync-token": "zAJw6V16=MDozIzUxNTAyNjY=;sn=5150266", - "x-ms-correlation-request-id": "764e6e56-1dac-4c11-94b7-8a45c90d3bb9", - "x-ms-request-id": "764e6e56-1dac-4c11-94b7-8a45c90d3bb9" - } - } - ], - "uniqueTestInfo": { - "uniqueName": {}, - "newDate": {} - }, - "hash": "dbff5419a75940fa5401dd76cca9de72" -} \ No newline at end of file + "hash": "dbff5419a75940fa5401dd76cca9de72" +} diff --git a/sdk/template/template/recordings/node/aad_configurationclient_functional_tests/recording_predetermined_setting_has_expected_value.js b/sdk/template/template/recordings/node/aad_configurationclient_functional_tests/recording_predetermined_setting_has_expected_value.js index 5ae0a3376925..75b93d96caa5 100644 --- a/sdk/template/template/recordings/node/aad_configurationclient_functional_tests/recording_predetermined_setting_has_expected_value.js +++ b/sdk/template/template/recordings/node/aad_configurationclient_functional_tests/recording_predetermined_setting_has_expected_value.js @@ -1,12 +1,86 @@ let nock = require('nock'); -module.exports.hash = "4396ae23de09111d66f4ad1027657096"; +module.exports.hash = "284f885078bc2c7cebc8f8ae9be8dc2c"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) - .post('/azure_tenant_id/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=azure_client_id&client_secret=azure_client_secret&scope=https%3A%2F%2Fmyappconfig.azconfig.io%2F.default") - .reply(200, {"token_type":"Bearer","expires_in":3599,"ext_expires_in":3599,"access_token":"access_token"}, [ + .get('/common/discovery/instance') + .query(true) + .reply(200, {"tenant_discovery_endpoint":"https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/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"]}]}, [ + 'Cache-Control', + 'max-age=86400, private', + 'Content-Type', + 'application/json; charset=utf-8', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Access-Control-Allow-Origin', + '*', + 'Access-Control-Allow-Methods', + 'GET, OPTIONS', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '07df832e-67e9-4b00-a217-88c0f83e7f00', + 'x-ms-ests-server', + '2.1.11787.14 - EUS ProdSlices', + 'Set-Cookie', + 'fpc=AklbZDuZ-z9MvbjTqYC1cm8; expires=Mon, 12-Jul-2021 01:38:57 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrYhrtx1chLthdEhWpdZwpobQFLC2yhGY-8rL3wgE7RjM205Ajz4xnCH8x0mUNVi1RcdQhSO79VS7W98F2Mbf6_OqjZmj7TZeFQVHtI7KnhnWFbCVEn0i_FdC6Hgat2UX1trwts4Ys0BRS98pJhrPfcw5swe5GfqxASqvnVdcDYNUgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Sat, 12 Jun 2021 01:38:56 GMT', + 'Content-Length', + '980' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .get('/12345678-1234-1234-1234-123456789012/v2.0/.well-known/openid-configuration') + .reply(200, {"token_endpoint":"https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/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/12345678-1234-1234-1234-123456789012/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/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"],"kerberos_endpoint":"https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/kerberos","tenant_region_scope":"WW","cloud_instance_name":"microsoftonline.com","cloud_graph_host_name":"graph.windows.net","msgraph_host":"graph.microsoft.com","rbac_url":"https://pas.windows.net"}, [ + 'Cache-Control', + 'max-age=86400, private', + 'Content-Type', + 'application/json; charset=utf-8', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Access-Control-Allow-Origin', + '*', + 'Access-Control-Allow-Methods', + 'GET, OPTIONS', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + 'b9fedfca-792d-4092-a143-9f31d7e52c00', + 'x-ms-ests-server', + '2.1.11829.4 - NCUS ProdSlices', + 'Set-Cookie', + 'fpc=AklbZDuZ-z9MvbjTqYC1cm8; expires=Mon, 12-Jul-2021 01:38:57 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrurErfe2krcodjLBX3bYrJNkeQj7BF8DuCR2-j08XG0ytP_sNsxDKfhz1rhOwUoWCU2wpg9eQyutCZwjrX3KxUzp1ey7l4J7r7tZ3GMvTOB3QV8qgObPsDEUfmuZUucHJCK2qUlt_MHho9PUVhxotbi4w4SyKcAsOfe2O6UnNRDogAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Sat, 12 Jun 2021 01:38:56 GMT', + 'Content-Length', + '1753' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .filteringRequestBody(function (body) { + return body.replace(/client-request-id=[^&]*/g, "client-request-id=client-request-id"); + }) + .post('/12345678-1234-1234-1234-123456789012/oauth2/v2.0/token', "client_id=azure_client_id&scope=https%3A%2F%2Fmyappconfig.azconfig.io%2F.default%20openid%20profile%20offline_access&grant_type=client_credentials&client-request-id=client-request-id&client_secret=azure_client_secret") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"access_token"}, [ 'Cache-Control', 'no-store, no-cache', 'Pragma', @@ -22,29 +96,31 @@ nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) 'P3P', 'CP="DSP CUR OTPi IND OTRi ONL FIN"', 'x-ms-request-id', - '12c6bd6d-e57d-40c2-921a-bb61e1d57d00', + 'ba53f6ce-8702-41dd-8091-90869e8f2c00', 'x-ms-ests-server', - '2.1.11140.11 - EUS ProdSlices', + '2.1.11829.4 - EUS ProdSlices', + 'x-ms-clitelem', + '1,0,0,,', 'Set-Cookie', - 'fpc=Ao37r96OlpdEqDng7XQpw6iqBNuqAQAAAGjdG9cOAAAA; expires=Sun, 15-Nov-2020 18:28:56 GMT; path=/; secure; HttpOnly; SameSite=None', + 'fpc=AklbZDuZ-z9MvbjTqYC1cm-WH-CrAQAAADAHVtgOAAAA; expires=Mon, 12-Jul-2021 01:38:57 GMT; path=/; secure; HttpOnly; SameSite=None', 'Set-Cookie', 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', 'Set-Cookie', 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', 'Date', - 'Fri, 16 Oct 2020 18:28:56 GMT', + 'Sat, 12 Jun 2021 01:38:56 GMT', 'Content-Length', - '1491' + '1335' ]); nock('https://myappconfig.azconfig.io:443', {"encodedQueryParams":true}) .get('/kv/test-key') .query(true) - .reply(200, {"etag":"cbARBFLodwGLL3qktvCwmLa1vet","key":"test-key","label":null,"content_type":"","value":"test-value","tags":{},"locked":false,"last_modified":"2020-10-16T00:08:12+00:00"}, [ + .reply(200, {"etag":"FQ2XSpKRpSv2FAbNvw2sdY9Hq2G","key":"test-key","label":null,"content_type":"text/plain","value":"test-value","tags":{},"locked":false,"last_modified":"2021-02-16T18:26:35+00:00"}, [ 'Server', 'openresty/1.17.8.2', 'Date', - 'Fri, 16 Oct 2020 18:28:57 GMT', + 'Sat, 12 Jun 2021 01:38:58 GMT', 'Content-Type', 'application/vnd.microsoft.appconfig.kv+json; charset=utf-8', 'Transfer-Encoding', @@ -52,21 +128,21 @@ nock('https://myappconfig.azconfig.io:443', {"encodedQueryParams":true}) 'Connection', 'keep-alive', 'Last-Modified', - 'Fri, 16 Oct 2020 00:08:12 GMT', + 'Tue, 16 Feb 2021 18:26:35 GMT', 'ETag', - '"cbARBFLodwGLL3qktvCwmLa1vet"', + '"FQ2XSpKRpSv2FAbNvw2sdY9Hq2G"', 'Sync-Token', - 'zAJw6V16=MDoyIzUwMDA4MTgjNj0tMQ==;sn=5000818', + 'zAJw6V16=MDoxNyM5MjU3MTIx;sn=9257121', 'x-ms-request-id', - 'c216d2fc-a04f-40d6-aa9b-5eb170434239', + 'd24c5c59-432d-46ba-ad96-598703b18e87', 'x-ms-correlation-request-id', - 'c216d2fc-a04f-40d6-aa9b-5eb170434239', + 'd24c5c59-432d-46ba-ad96-598703b18e87', 'Access-Control-Allow-Origin', '*', 'Access-Control-Allow-Credentials', 'true', 'Access-Control-Expose-Headers', - 'DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, WWW-Authenticate', + 'DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-useragent, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, retry-after-ms, x-ms-request-id, x-ms-client-session-id, x-ms-effective-locale, WWW-Authenticate', 'Strict-Transport-Security', 'max-age=15724800; includeSubDomains' ]); diff --git a/sdk/template/template/test/public/configurationClient.spec.ts b/sdk/template/template/test/public/configurationClient.spec.ts index c6a4212de7f4..3915e67de6e1 100644 --- a/sdk/template/template/test/public/configurationClient.spec.ts +++ b/sdk/template/template/test/public/configurationClient.spec.ts @@ -16,7 +16,7 @@ const replaceableVariables: Record = { APPCONFIG_ENDPOINT: "https://myappconfig.azconfig.io", APPCONFIG_TEST_SETTING_KEY: "test-key", APPCONFIG_TEST_SETTING_EXPECTED_VALUE: "test-value", - AZURE_TENANT_ID: "azure_tenant_id", + AZURE_TENANT_ID: "12345678-1234-1234-1234-123456789012", AZURE_CLIENT_ID: "azure_client_id", AZURE_CLIENT_SECRET: "azure_client_secret" };