From 4e25dba63daaa8aebe2508fa3a7c75adb5878c3b Mon Sep 17 00:00:00 2001 From: AriZavala2 <77034370+AriZavala2@users.noreply.github.com> Date: Fri, 8 Oct 2021 10:17:25 -0700 Subject: [PATCH] Making identity optional when getting TURN credentials (#17983) * Making identity and communication request optional * Add recordings * Update PR * Fix build issues * Fix format --- ...credential_providing_a_user_identity.json} | 20 +-- ...ial_without_providing_a_user_identity.json | 31 ++++ ...credential_providing_a_user_identity.json} | 32 ++-- ...ial_without_providing_a_user_identity.json | 55 ++++++ ...ing_successfully_gets_a_turn_credential.js | 18 +- ...rn_credential_providing_a_user_identity.js | 61 +++++++ ...ntial_without_providing_a_user_identity.js | 33 ++++ ...ing_successfully_gets_a_turn_credential.js | 48 ++--- ...rn_credential_providing_a_user_identity.js | 167 ++++++++++++++++++ ...ntial_without_providing_a_user_identity.js | 139 +++++++++++++++ .../communication-network-traversal.api.md | 2 +- ...s => getRelayConfigurationWithIdentity.ts} | 2 +- .../getRelayConfigurationWithoutIdentity.ts | 33 ++++ .../src/communicationRelayClient.ts | 15 +- .../src/generated/src/models/index.ts | 13 +- .../src/generated/src/models/mappers.ts | 1 - .../src/generated/src/models/parameters.ts | 2 +- .../communicationNetworkTraversal.ts | 8 +- .../swagger/README.md | 2 +- ...ommunicationNetworkTraversalClient.spec.ts | 20 ++- 20 files changed, 624 insertions(+), 78 deletions(-) rename sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/{recording_successfully_gets_a_turn_credential.json => recording_successfully_gets_a_turn_credential_providing_a_user_identity.json} (71%) create mode 100644 sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.json rename sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/{recording_successfully_gets_a_turn_credential.json => recording_successfully_gets_a_turn_credential_providing_a_user_identity.json} (70%) create mode 100644 sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.json create mode 100644 sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_providing_a_user_identity.js create mode 100644 sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.js create mode 100644 sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_providing_a_user_identity.js create mode 100644 sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.js rename sdk/communication/communication-network-traversal/samples-dev/{getRelayConfiguration.ts => getRelayConfigurationWithIdentity.ts} (94%) create mode 100644 sdk/communication/communication-network-traversal/samples-dev/getRelayConfigurationWithoutIdentity.ts diff --git a/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential.json b/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_providing_a_user_identity.json similarity index 71% rename from sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential.json rename to sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_providing_a_user_identity.json index 4894de202d5b..aa5d36fe9522 100644 --- a/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential.json +++ b/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_providing_a_user_identity.json @@ -10,17 +10,16 @@ "status": 201, "response": "{\"identity\":{\"id\":\"sanitized\"}}", "responseHeaders": { - "api-supported-versions": "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "api-supported-versions": "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1, 2021-10-31-preview", "content-type": "application/json; charset=utf-8", - "date": "Fri, 09 Jul 2021 23:09:20 GMT", - "ms-cv": "YYsxXBuNJUu4FtGD6a2QBA.0", + "date": "Fri, 01 Oct 2021 00:39:02 GMT", + "ms-cv": "DuqNyyc7x0esWp8yuPcqIA.0", "request-context": "appId=", - "status": "201", "strict-transport-security": "max-age=2592000", - "x-azure-ref": "0IdfoYAAAAABJXwJsxwlOTJF91Kd4JdFQV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-azure-ref": "0plhWYQAAAAAKT9PvBBEzSpOqJFwoP5S5V1NURURHRTA4MTAAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", "x-cache": "CONFIG_NOCACHE", "x-ms-client-request-id": "sanitized", - "x-processing-time": "90ms" + "x-processing-time": "83ms" } }, { @@ -35,15 +34,14 @@ "responseHeaders": { "api-supported-versions": "2021-02-22-preview1, 2021-06-21-preview", "content-type": "application/json; charset=utf-8", - "date": "Fri, 09 Jul 2021 23:09:20 GMT", - "ms-cv": "F87s1Uc+eEWaaoSovbjrKg.0", + "date": "Fri, 01 Oct 2021 00:39:02 GMT", + "ms-cv": "0He8YCO3ukq2OEAdw36/dQ.0", "request-context": "appId=", - "status": "200", "strict-transport-security": "max-age=2592000", - "x-azure-ref": "0IdfoYAAAAADmTFI8h5fMTIxz2fBeMaoxV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-azure-ref": "0plhWYQAAAABx8hSEH+yGRZc7MBrmbFRiV1NURURHRTA4MTAAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", "x-cache": "CONFIG_NOCACHE", "x-ms-client-request-id": "sanitized", - "x-processing-time": "178ms" + "x-processing-time": "86ms" } } ], diff --git a/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.json b/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.json new file mode 100644 index 000000000000..8140f399c22a --- /dev/null +++ b/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.json @@ -0,0 +1,31 @@ +{ + "recordings": [ + { + "method": "POST", + "url": "https://endpoint/networktraversal/:issueRelayConfiguration", + "query": { + "api-version": "2021-06-21-preview" + }, + "requestBody": "{}", + "status": 200, + "response": "{\"expiresOn\":\"2022-05-18T12:00:00.00+00:00\",\"iceServers\":[{\"urls\":[\"turn.skype.com\"],\"username\":\"sanitized_username\",\"credential\":\"sanitized_credential\"}]}", + "responseHeaders": { + "api-supported-versions": "2021-02-22-preview1, 2021-06-21-preview", + "content-type": "application/json; charset=utf-8", + "date": "Fri, 01 Oct 2021 00:39:02 GMT", + "ms-cv": "LLmlz6WYRkKWM54GaKzBuw.0", + "request-context": "appId=", + "strict-transport-security": "max-age=2592000", + "x-azure-ref": "0p1hWYQAAAADs4ZqTEdXMSpzx2Y3OzqovV1NURURHRTA4MTAAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-cache": "CONFIG_NOCACHE", + "x-ms-client-request-id": "sanitized", + "x-processing-time": "24ms" + } + } + ], + "uniqueTestInfo": { + "uniqueName": {}, + "newDate": {} + }, + "hash": "70da043fd855f0019631cf80df5ebd63" +} \ No newline at end of file diff --git a/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential.json b/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_providing_a_user_identity.json similarity index 70% rename from sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential.json rename to sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_providing_a_user_identity.json index aba8d3ac264c..b1835452e441 100644 --- a/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential.json +++ b/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_providing_a_user_identity.json @@ -10,40 +10,39 @@ "status": 201, "response": "{\"identity\":{\"id\":\"sanitized\"}}", "responseHeaders": { - "api-supported-versions": "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "api-supported-versions": "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1, 2021-10-31-preview", "content-type": "application/json; charset=utf-8", - "date": "Fri, 09 Jul 2021 23:09:19 GMT", - "ms-cv": "TibUw67wDEq3wKz27PoWiA.0", + "date": "Fri, 01 Oct 2021 00:39:00 GMT", + "ms-cv": "P3MiKGJYuU+G+9ajc0XW/g.0", "request-context": "appId=", - "status": "201", "strict-transport-security": "max-age=2592000", - "x-azure-ref": "0H9foYAAAAADOHW2OoFx0Ranu9kjWnQ2DV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-azure-ref": "0pVhWYQAAAAAysRbmsjyqTI93JfKPgxEnV1NURURHRTA4MTAAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", "x-cache": "CONFIG_NOCACHE", "x-ms-client-request-id": "sanitized", - "x-processing-time": "108ms" + "x-processing-time": "104ms" } }, { "method": "POST", "url": "https://endpoint/sanitized/oauth2/v2.0/token", "query": {}, - "requestBody": "response_type=token&grant_type=client_credentials&client_id=SomeClientId&client_secret=azure_client_secret&scope=https%3A%2F%2Fsanitized%2F", + "requestBody": "response_type=token&grant_type=client_credentials&client_id=SomeClientId&client_secret=HtrZM_04%7E7C.aC2.o3EpjJsugBqHIa7HL6&scope=https%3A%2F%2Fsanitized%2F", "status": 200, - "response": "{\"token_type\":\"Bearer\",\"expires_in\":3599,\"ext_expires_in\":3599,\"access_token\":\"sanitized\"}", + "response": "{\"token_type\":\"Bearer\",\"expires_in\":86399,\"ext_expires_in\":86399,\"access_token\":\"sanitized\"}", "responseHeaders": { "cache-control": "no-store, no-cache", - "content-length": "1325", + "content-length": "1327", "content-type": "application/json; charset=utf-8", - "date": "Fri, 09 Jul 2021 23:09:20 GMT", + "date": "Fri, 01 Oct 2021 00:39:01 GMT", "expires": "-1", "nel": "{\"report_to\":\"network-errors\",\"max_age\":86400,\"success_fraction\":0.001,\"failure_fraction\":1.0}", "p3p": "CP=\"DSP CUR OTPi IND OTRi ONL FIN\"", "pragma": "no-cache", "referrer-policy": "strict-origin-when-cross-origin", - "report-to": "{\"group\":\"network-errors\",\"max_age\":86400,\"endpoints\":[{\"url\":\"https://endpoint/api/report?catId=GW+estsfd+san\"}]}", + "report-to": "{\"group\":\"network-errors\",\"max_age\":86400,\"endpoints\":[{\"url\":\"https://endpoint/api/report?catId=GW+estsfd+est\"}]}", "strict-transport-security": "max-age=31536000; includeSubDomains", "x-content-type-options": "nosniff", - "x-ms-ests-server": "2.1.11829.9 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.12071.23 - NCUS ProdSlices", "x-ms-request-id": "sanitized" } }, @@ -59,15 +58,14 @@ "responseHeaders": { "api-supported-versions": "2021-02-22-preview1, 2021-06-21-preview", "content-type": "application/json; charset=utf-8", - "date": "Fri, 09 Jul 2021 23:09:20 GMT", - "ms-cv": "CQ2xUytyMkOXCXGE5Hqo2w.0", + "date": "Fri, 01 Oct 2021 00:39:01 GMT", + "ms-cv": "YcScG97VJEC7+15OxRvyJQ.0", "request-context": "appId=", - "status": "200", "strict-transport-security": "max-age=2592000", - "x-azure-ref": "0INfoYAAAAABO5ME2E3TcRorTdyletV3dV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-azure-ref": "0pVhWYQAAAAAjyYg55DaZRabObK7cT5tGV1NURURHRTA4MTAAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", "x-cache": "CONFIG_NOCACHE", "x-ms-client-request-id": "sanitized", - "x-processing-time": "385ms" + "x-processing-time": "643ms" } } ], diff --git a/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.json b/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.json new file mode 100644 index 000000000000..eaaaf0031786 --- /dev/null +++ b/sdk/communication/communication-network-traversal/recordings/browsers/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.json @@ -0,0 +1,55 @@ +{ + "recordings": [ + { + "method": "POST", + "url": "https://endpoint/sanitized/oauth2/v2.0/token", + "query": {}, + "requestBody": "response_type=token&grant_type=client_credentials&client_id=SomeClientId&client_secret=HtrZM_04%7E7C.aC2.o3EpjJsugBqHIa7HL6&scope=https%3A%2F%2Fsanitized%2F", + "status": 200, + "response": "{\"token_type\":\"Bearer\",\"expires_in\":86399,\"ext_expires_in\":86399,\"access_token\":\"sanitized\"}", + "responseHeaders": { + "cache-control": "no-store, no-cache", + "content-length": "1327", + "content-type": "application/json; charset=utf-8", + "date": "Fri, 01 Oct 2021 00:39:02 GMT", + "expires": "-1", + "nel": "{\"report_to\":\"network-errors\",\"max_age\":86400,\"success_fraction\":0.001,\"failure_fraction\":1.0}", + "p3p": "CP=\"DSP CUR OTPi IND OTRi ONL FIN\"", + "pragma": "no-cache", + "referrer-policy": "strict-origin-when-cross-origin", + "report-to": "{\"group\":\"network-errors\",\"max_age\":86400,\"endpoints\":[{\"url\":\"https://endpoint/api/report?catId=GW+estsfd+est\"}]}", + "strict-transport-security": "max-age=31536000; includeSubDomains", + "x-content-type-options": "nosniff", + "x-ms-ests-server": "2.1.12071.23 - WUS2 ProdSlices", + "x-ms-request-id": "sanitized" + } + }, + { + "method": "POST", + "url": "https://endpoint/networktraversal/:issueRelayConfiguration", + "query": { + "api-version": "2021-06-21-preview" + }, + "requestBody": "{}", + "status": 200, + "response": "{\"expiresOn\":\"2022-05-18T12:00:00.00+00:00\",\"iceServers\":[{\"urls\":[\"turn.skype.com\"],\"username\":\"sanitized_username\",\"credential\":\"sanitized_credential\"}]}", + "responseHeaders": { + "api-supported-versions": "2021-02-22-preview1, 2021-06-21-preview", + "content-type": "application/json; charset=utf-8", + "date": "Fri, 01 Oct 2021 00:39:02 GMT", + "ms-cv": "IOn+xCbxZ0atzIwK7BX/Tw.0", + "request-context": "appId=", + "strict-transport-security": "max-age=2592000", + "x-azure-ref": "0plhWYQAAAAApCMJE2l17TJHHEKYUUqdhV1NURURHRTA4MTAAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "x-cache": "CONFIG_NOCACHE", + "x-ms-client-request-id": "sanitized", + "x-processing-time": "26ms" + } + } + ], + "uniqueTestInfo": { + "uniqueName": {}, + "newDate": {} + }, + "hash": "70da043fd855f0019631cf80df5ebd63" +} \ No newline at end of file diff --git a/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential.js b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential.js index ac0d07d7c5a3..f4ee25a860c9 100644 --- a/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential.js +++ b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential.js @@ -15,21 +15,21 @@ nock('https://endpoint', {"encodedQueryParams":true}) 'Request-Context', 'appId=', 'MS-CV', - 'BWf2LW5HFUS80eJkrjrX0A.0', + 'ttmkxqEKEEuxX/lJoh19og.0', 'Strict-Transport-Security', 'max-age=2592000', 'x-ms-client-request-id', 'sanitized', 'api-supported-versions', - '2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1', + '2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1, 2021-10-31-preview', 'X-Processing-Time', - '63ms', + '89ms', 'X-Cache', 'CONFIG_NOCACHE', 'X-Azure-Ref', - '0GtfoYAAAAAAU6CML7iEAQIaIM+C2R5Y/V1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', + '0aT5VYQAAAACUsegyM6EPTpCSWK3GYZbzV1NURURHRTA4MjEAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', 'Date', - 'Fri, 09 Jul 2021 23:09:14 GMT' + 'Thu, 30 Sep 2021 04:34:49 GMT' ]); nock('https://endpoint', {"encodedQueryParams":true}) @@ -43,7 +43,7 @@ nock('https://endpoint', {"encodedQueryParams":true}) 'Request-Context', 'appId=', 'MS-CV', - '6oce5S8VQEOGP6IeFcee1A.0', + 'xvXGTZhZKUeMoUqzQyCjtQ.0', 'Strict-Transport-Security', 'max-age=2592000', 'x-ms-client-request-id', @@ -51,11 +51,11 @@ nock('https://endpoint', {"encodedQueryParams":true}) 'api-supported-versions', '2021-02-22-preview1, 2021-06-21-preview', 'X-Processing-Time', - '37ms', + '91ms', 'X-Cache', 'CONFIG_NOCACHE', 'X-Azure-Ref', - '0GtfoYAAAAADtShGPpRw3RKhq2ug0r7gmV1NURURHRTA4MTgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', + '0aT5VYQAAAAC4mql97pGySIev9LiLopp4V1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', 'Date', - 'Fri, 09 Jul 2021 23:09:14 GMT' + 'Thu, 30 Sep 2021 04:34:49 GMT' ]); diff --git a/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_providing_a_user_identity.js b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_providing_a_user_identity.js new file mode 100644 index 000000000000..4b5e8f6cec94 --- /dev/null +++ b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_providing_a_user_identity.js @@ -0,0 +1,61 @@ +let nock = require('nock'); + +module.exports.hash = "1f61817d660cabf38eb319e982cea9f2"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/identities') + .query(true) + .reply(201, {"identity":{"id":"sanitized"}}, [ + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/json; charset=utf-8', + 'Request-Context', + 'appId=', + 'MS-CV', + 'ZA9Jz/mLjku7QC81bSTGTw.0', + 'Strict-Transport-Security', + 'max-age=2592000', + 'x-ms-client-request-id', + 'sanitized', + 'api-supported-versions', + '2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1, 2021-10-31-preview', + 'X-Processing-Time', + '61ms', + 'X-Cache', + 'CONFIG_NOCACHE', + 'X-Azure-Ref', + '0oVhWYQAAAAAh3y9eH/dET5X7unrOSKN7V1NURURHRTA4MTIAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', + 'Date', + 'Fri, 01 Oct 2021 00:38:57 GMT' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/networktraversal/:issueRelayConfiguration', {"id":"sanitized"}) + .query(true) + .reply(200, {"expiresOn":"2022-05-18T12:00:00.00+00:00","iceServers":[{"urls":["turn.skype.com"],"username":"sanitized_username","credential":"sanitized_credential"}]}, [ + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/json; charset=utf-8', + 'Request-Context', + 'appId=', + 'MS-CV', + '0PWvHh7hPEakwkbV1v9dtA.0', + 'Strict-Transport-Security', + 'max-age=2592000', + 'x-ms-client-request-id', + 'sanitized', + 'api-supported-versions', + '2021-02-22-preview1, 2021-06-21-preview', + 'X-Processing-Time', + '109ms', + 'X-Cache', + 'CONFIG_NOCACHE', + 'X-Azure-Ref', + '0oVhWYQAAAADxJ1Hg2vtST6453gmFYiIqV1NURURHRTA4MTgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', + 'Date', + 'Fri, 01 Oct 2021 00:38:57 GMT' +]); diff --git a/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.js b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.js new file mode 100644 index 000000000000..2230a588cf1c --- /dev/null +++ b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.js @@ -0,0 +1,33 @@ +let nock = require('nock'); + +module.exports.hash = "ab5063462995c36e470af2aa97a30467"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/networktraversal/:issueRelayConfiguration', {}) + .query(true) + .reply(200, {"expiresOn":"2022-05-18T12:00:00.00+00:00","iceServers":[{"urls":["turn.skype.com"],"username":"sanitized_username","credential":"sanitized_credential"}]}, [ + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/json; charset=utf-8', + 'Request-Context', + 'appId=', + 'MS-CV', + 'gBpbxBx7skqX/eSQ9Q4Hvw.0', + 'Strict-Transport-Security', + 'max-age=2592000', + 'x-ms-client-request-id', + 'sanitized', + 'api-supported-versions', + '2021-02-22-preview1, 2021-06-21-preview', + 'X-Processing-Time', + '40ms', + 'X-Cache', + 'CONFIG_NOCACHE', + 'X-Azure-Ref', + '0oVhWYQAAAAB3nMwaR3ceR7FK2XyRBwNsV1NURURHRTA4MTIAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', + 'Date', + 'Fri, 01 Oct 2021 00:38:57 GMT' +]); diff --git a/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential.js b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential.js index 6027c9a6f5e5..6ecd426c566f 100644 --- a/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential.js +++ b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential.js @@ -15,21 +15,21 @@ nock('https://endpoint', {"encodedQueryParams":true}) 'Request-Context', 'appId=', 'MS-CV', - 'yvt0FQhx2k+1xEAQwlaWWA.0', + 'gsFiDupfZ0W6RWwXxJj9zg.0', 'Strict-Transport-Security', 'max-age=2592000', 'x-ms-client-request-id', 'sanitized', 'api-supported-versions', - '2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1', + '2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1, 2021-10-31-preview', 'X-Processing-Time', - '65ms', + '111ms', 'X-Cache', 'CONFIG_NOCACHE', 'X-Azure-Ref', - '0GdfoYAAAAADd5X/nCaFzTY4kGoWGDddnV1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', + '0aD5VYQAAAAD0/7ieRilFRIH082aRMVhwV1NURURHRTA4MjEAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', 'Date', - 'Fri, 09 Jul 2021 23:09:13 GMT' + 'Thu, 30 Sep 2021 04:34:48 GMT' ]); nock('https://endpoint', {"encodedQueryParams":true}) @@ -53,24 +53,24 @@ nock('https://endpoint', {"encodedQueryParams":true}) 'x-ms-request-id', 'sanitized', 'x-ms-ests-server', - '2.1.11898.8 - WUS2 ProdSlices', + '2.1.12071.16 - NCUS ProdSlices', 'Set-Cookie', - 'fpc=AmRh8LfRTJJBsJFUxk7Q0Xk; expires=Sun, 08-Aug-2021 23:09:14 GMT; path=/; secure; HttpOnly; SameSite=None', + 'fpc=AtJ8MPfeP5JAmDuProtlFzU; expires=Sat, 30-Oct-2021 04:34:49 GMT; path=/; secure; HttpOnly; SameSite=None', 'Set-Cookie', - 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrKL7BjqkS8rJUQnaOwggga0ppVMMDybbR8beYyf_1dIYmrQlVOZdPhKf_3vR1ajv6VkXOre9OeGJWrsVaspWupxlnjjz-JixqOY5j60ZOsWTyPwQf2A_4x8AUvZrT9gKfR4iEhndMRvb6PJtpq_F1VuGX16tXJYecjbHYXyFJUWQgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr7e1SwErtzsNObnTnNUZ8RGY-wrRSKk2AUFNuKYylRcQ90YF2FGqOZu1iOJW2jzTrk07G4lJ4hAIWskyjLsrUWdAn6Sd3vQiyqThKdoLjp48DqtQUVxB8VqANJBA4iWpEFZ3EkA3uQz-cr6tUvxYU2D6-qZiqIS5LVU6VcvR5_OYgAA; 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', - 'Fri, 09 Jul 2021 23:09:13 GMT', + 'Thu, 30 Sep 2021 04:34:48 GMT', 'Content-Length', '980' ]); nock('https://endpoint', {"encodedQueryParams":true}) .get('/sanitized/v2.0/.well-known/openid-configuration') - .reply(200, {"token_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/sanitized/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/sanitized/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/sanitized/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/sanitized/kerberos","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"}, [ + .reply(200, {"token_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/sanitized/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/sanitized/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/sanitized/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/sanitized/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', @@ -88,24 +88,24 @@ nock('https://endpoint', {"encodedQueryParams":true}) 'x-ms-request-id', 'sanitized', 'x-ms-ests-server', - '2.1.11829.9 - SCUS ProdSlices', + '2.1.12071.23 - EUS ProdSlices', 'Set-Cookie', - 'fpc=AmRh8LfRTJJBsJFUxk7Q0Xk; expires=Sun, 08-Aug-2021 23:09:14 GMT; path=/; secure; HttpOnly; SameSite=None', + 'fpc=AiedBFzpty1KnUS7FjszJmQ; expires=Sat, 30-Oct-2021 04:34:49 GMT; path=/; secure; HttpOnly; SameSite=None', 'Set-Cookie', - 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevrdk5JMzlA1hrlVbmldmJAPF-5tWgdUG4wpldnMTn347hA0ZeIEkCGuy19ygwcM7VxcBffyBZmm3p0d1LKDv70zEGLsJfPXalHl2uEzs_JYBMxyWvGs72I6iMgiiJd4oklFuTTUrS9HtahyakNvaUc58g_Yj-wZJrm_zpYT3QfbmkgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr50ksDZVWmBNUGoU3IkLZqR7pu_xXYhggoIgTLFnKdHImbrWI5sfFMRh3tdClVPVss0rUntiEf9p5dNbV3WnuHVY0_1OC2mn9XwK9jZgn4JBufpdMoszTOSJsbQELamZ8hI5yBukBIozkzf4J2ebJ--3qVI5VTrvvaXqJwhtsancgAA; 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', - 'Fri, 09 Jul 2021 23:09:13 GMT', + 'Thu, 30 Sep 2021 04:34:48 GMT', 'Content-Length', '1753' ]); nock('https://endpoint', {"encodedQueryParams":true}) - .post('/sanitized/oauth2/v2.0/token', "client_id=SomeClientId&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.1.0&x-client-OS=win32&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=2|771,0|,&x-client-last-telemetry=2|0|||0,0&client-request-id=sanitized&client_secret=azure_client_secret") - .reply(200, {"token_type":"Bearer","expires_in":3599,"ext_expires_in":3599,"access_token":"sanitized"}, [ + .post('/sanitized/oauth2/v2.0/token', "client_id=SomeClientId&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.3.1&x-client-OS=win32&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=5|771,2,,,|,&x-client-last-telemetry=5|0|||0,0&client-request-id=sanitized&client_secret=azure_client_secret&claims=%7B%22access_token%22%3A%7B%22xms_cc%22%3A%7B%22values%22%3A%5B%22CP1%22%5D%7D%7D%7D") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"sanitized"}, [ 'Cache-Control', 'no-store, no-cache', 'Pragma', @@ -123,19 +123,19 @@ nock('https://endpoint', {"encodedQueryParams":true}) 'x-ms-request-id', 'sanitized', 'x-ms-ests-server', - '2.1.11898.8 - WUS2 ProdSlices', + '2.1.12071.23 - WUS2 ProdSlices', 'x-ms-clitelem', '1,0,0,,', 'Set-Cookie', - 'fpc=AmRh8LfRTJJBsJFUxk7Q0XlWvwPgAQAAABrOetgOAAAA; expires=Sun, 08-Aug-2021 23:09:14 GMT; path=/; secure; HttpOnly; SameSite=None', + 'fpc=Asp5rE5ll21Goopiy8lO_ytWyo4SAQAAAGg159gOAAAA; expires=Sat, 30-Oct-2021 04:34:49 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, 09 Jul 2021 23:09:14 GMT', + 'Thu, 30 Sep 2021 04:34:48 GMT', 'Content-Length', - '1325' + '1327' ]); nock('https://endpoint', {"encodedQueryParams":true}) @@ -149,7 +149,7 @@ nock('https://endpoint', {"encodedQueryParams":true}) 'Request-Context', 'appId=', 'MS-CV', - '9bxMDaFfCk+BDxrDGeIk0g.0', + 'rK2qVD+9Rkmombi+JDXYTA.0', 'Strict-Transport-Security', 'max-age=2592000', 'x-ms-client-request-id', @@ -157,11 +157,11 @@ nock('https://endpoint', {"encodedQueryParams":true}) 'api-supported-versions', '2021-02-22-preview1, 2021-06-21-preview', 'X-Processing-Time', - '232ms', + '176ms', 'X-Cache', 'CONFIG_NOCACHE', 'X-Azure-Ref', - '0GtfoYAAAAADMndz5gOsSSYildLwh7N06V1NURURHRTA4MTQAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', + '0aT5VYQAAAAA3Vwq1o5LiS7H4ZC9aorljV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', 'Date', - 'Fri, 09 Jul 2021 23:09:14 GMT' + 'Thu, 30 Sep 2021 04:34:49 GMT' ]); diff --git a/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_providing_a_user_identity.js b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_providing_a_user_identity.js new file mode 100644 index 000000000000..d7aafcc61693 --- /dev/null +++ b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_providing_a_user_identity.js @@ -0,0 +1,167 @@ +let nock = require('nock'); + +module.exports.hash = "1f61817d660cabf38eb319e982cea9f2"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/identities') + .query(true) + .reply(201, {"identity":{"id":"sanitized"}}, [ + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/json; charset=utf-8', + 'Request-Context', + 'appId=', + 'MS-CV', + 'EG0guWCwsUK4LCcHhq99fg.0', + 'Strict-Transport-Security', + 'max-age=2592000', + 'x-ms-client-request-id', + 'sanitized', + 'api-supported-versions', + '2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1, 2021-10-31-preview', + 'X-Processing-Time', + '277ms', + 'X-Cache', + 'CONFIG_NOCACHE', + 'X-Azure-Ref', + '0n1hWYQAAAADcSDbR059HRKcrkKwI3ilMV1NURURHRTA4MTIAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', + 'Date', + 'Fri, 01 Oct 2021 00:38:55 GMT' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .get('/common/discovery/instance') + .query(true) + .reply(200, {"tenant_discovery_endpoint":"https://login.microsoftonline.com/sanitized/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', + 'sanitized', + 'x-ms-ests-server', + '2.1.12071.23 - EUS ProdSlices', + 'Set-Cookie', + 'fpc=Alv23BDC821Gm4SCjEpJU9E; expires=Sun, 31-Oct-2021 00:38:56 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr68zJSYSmzDjEiqb0oC9-d3utHQQLQh0BKt8cP8ug048ODQONnEXgK5Sxz5waiTGu1KNIRZ695LrdXaWVkAdyv3zHn5bBFoKCHWDbPSJOSl9KTAk6Q4MAkm65jSrfua0ulxUThwDbLk0oSem1v5ZVFnxNjLZxFqWEYOLdkKE0Lh0gAA; 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', + 'Fri, 01 Oct 2021 00:38:55 GMT', + 'Content-Length', + '980' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .get('/sanitized/v2.0/.well-known/openid-configuration') + .reply(200, {"token_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/sanitized/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/sanitized/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/sanitized/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/sanitized/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', + 'sanitized', + 'x-ms-ests-server', + '2.1.12071.23 - NCUS ProdSlices', + 'Set-Cookie', + 'fpc=AtNjJTFSCKtHrdtX76KS10k; expires=Sun, 31-Oct-2021 00:38:56 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrpFJMgO5dIS-JXa1bAIoN7tfo8jycQKF-FtEE0wxgWRxFn4c6OLUnmxb_L7ZJ0-Dfdk00PLqQ0233wDcGSrh3ZKDqt7nBi3BYXGeupjr7qaYEPZBtmvJwjCN7fgiGywGS163BquAhlzVDwkpyZvRUGGk8hAJb-jzjhbQFdbHWI5EgAA; 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', + 'Fri, 01 Oct 2021 00:38:55 GMT', + 'Content-Length', + '1753' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/sanitized/oauth2/v2.0/token', "client_id=SomeClientId&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.3.1&x-client-OS=win32&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=5|771,2,,,|,&x-client-last-telemetry=5|0|||0,0&client-request-id=sanitized&client_secret=azure_client_secret&claims=%7B%22access_token%22%3A%7B%22xms_cc%22%3A%7B%22values%22%3A%5B%22CP1%22%5D%7D%7D%7D") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"sanitized"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + 'sanitized', + 'x-ms-ests-server', + '2.1.12071.23 - EUS ProdSlices', + 'x-ms-clitelem', + '1,0,0,,', + 'Set-Cookie', + 'fpc=AmwkJ0mgh3tBo5YB6yUnEZxWyo4SAQAAAKBP6NgOAAAA; expires=Sun, 31-Oct-2021 00:38:56 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, 01 Oct 2021 00:38:55 GMT', + 'Content-Length', + '1327' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/networktraversal/:issueRelayConfiguration', {"id":"sanitized"}) + .query(true) + .reply(200, {"expiresOn":"2022-05-18T12:00:00.00+00:00","iceServers":[{"urls":["turn.skype.com"],"username":"sanitized_username","credential":"sanitized_credential"}]}, [ + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/json; charset=utf-8', + 'Request-Context', + 'appId=', + 'MS-CV', + 'IGAZE1oO302p/ESxhVCPjw.0', + 'Strict-Transport-Security', + 'max-age=2592000', + 'x-ms-client-request-id', + 'sanitized', + 'api-supported-versions', + '2021-02-22-preview1, 2021-06-21-preview', + 'X-Processing-Time', + '148ms', + 'X-Cache', + 'CONFIG_NOCACHE', + 'X-Azure-Ref', + '0oFhWYQAAAADpPpMoKuw0TqL+qHePIiocV1NURURHRTA4MDkAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', + 'Date', + 'Fri, 01 Oct 2021 00:38:56 GMT' +]); diff --git a/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.js b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.js new file mode 100644 index 000000000000..5f19b28f9399 --- /dev/null +++ b/sdk/communication/communication-network-traversal/recordings/node/communicationnetworkingclient_playbacklive_aad/recording_successfully_gets_a_turn_credential_without_providing_a_user_identity.js @@ -0,0 +1,139 @@ +let nock = require('nock'); + +module.exports.hash = "ab5063462995c36e470af2aa97a30467"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://endpoint', {"encodedQueryParams":true}) + .get('/common/discovery/instance') + .query(true) + .reply(200, {"tenant_discovery_endpoint":"https://login.microsoftonline.com/sanitized/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', + 'sanitized', + 'x-ms-ests-server', + '2.1.12071.23 - WUS2 ProdSlices', + 'Set-Cookie', + 'fpc=AroRKg778GdGic9XhozLz4U; expires=Sun, 31-Oct-2021 00:38:56 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrHGqUNWBw7yNpy3_fRbSNG0694YaKQ7liWFJ47cHSX0iQQFhT2XlTY3eYtir6qtpBfwxK35d7JEvhwy2898v4rX2Ernk4LWVZbfAs_vPtxqqednh10-kP6HlfjdLyIikyhwanejTGfhwgYJ5uukkNwnCzqjcoM_g-hO1qPX7ESHUgAA; 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', + 'Fri, 01 Oct 2021 00:38:56 GMT', + 'Content-Length', + '980' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .get('/sanitized/v2.0/.well-known/openid-configuration') + .reply(200, {"token_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/sanitized/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/sanitized/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/sanitized/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/sanitized/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/sanitized/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', + 'sanitized', + 'x-ms-ests-server', + '2.1.12071.23 - NCUS ProdSlices', + 'Set-Cookie', + 'fpc=AuCvGWtA475Mq0xCT-4CiVs; expires=Sun, 31-Oct-2021 00:38:56 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevrvj9PdiOlsKD6U2_Lewmy0eBNypF1z8GO3BNaLtClEO1ZBRxYpH7qoPu3eQCpGMOVU8ZW5FttOBmqDLMNMH8IDdlWLuAk5Uz0zEt7EFbArLB-lFew5dFt28lRawy97ZFAxU_zMLGVn_HQTpktonQKIshfqCLiHL1N5mq4EC7xDnkgAA; 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', + 'Fri, 01 Oct 2021 00:38:56 GMT', + 'Content-Length', + '1753' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/sanitized/oauth2/v2.0/token', "client_id=SomeClientId&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.3.1&x-client-OS=win32&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=5|771,2,,,|,&x-client-last-telemetry=5|0|||0,0&client-request-id=sanitized&client_secret=azure_client_secret&claims=%7B%22access_token%22%3A%7B%22xms_cc%22%3A%7B%22values%22%3A%5B%22CP1%22%5D%7D%7D%7D") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"sanitized"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + 'sanitized', + 'x-ms-ests-server', + '2.1.12071.23 - NCUS ProdSlices', + 'x-ms-clitelem', + '1,0,0,,', + 'Set-Cookie', + 'fpc=AjvbRwwoJEpGuMI_f_xg7XpWyo4SAQAAAKBP6NgOAAAA; expires=Sun, 31-Oct-2021 00: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, 01 Oct 2021 00:38:56 GMT', + 'Content-Length', + '1327' +]); + +nock('https://endpoint', {"encodedQueryParams":true}) + .post('/networktraversal/:issueRelayConfiguration', {}) + .query(true) + .reply(200, {"expiresOn":"2022-05-18T12:00:00.00+00:00","iceServers":[{"urls":["turn.skype.com"],"username":"sanitized_username","credential":"sanitized_credential"}]}, [ + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/json; charset=utf-8', + 'Request-Context', + 'appId=', + 'MS-CV', + 'ItkR3snHXUSP68mzid+21A.0', + 'Strict-Transport-Security', + 'max-age=2592000', + 'x-ms-client-request-id', + 'sanitized', + 'api-supported-versions', + '2021-02-22-preview1, 2021-06-21-preview', + 'X-Processing-Time', + '140ms', + 'X-Cache', + 'CONFIG_NOCACHE', + 'X-Azure-Ref', + '0oVhWYQAAAABBMQx50Zy9RovToZydFE0DV1NURURHRTA4MDcAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx', + 'Date', + 'Fri, 01 Oct 2021 00:38:57 GMT' +]); diff --git a/sdk/communication/communication-network-traversal/review/communication-network-traversal.api.md b/sdk/communication/communication-network-traversal/review/communication-network-traversal.api.md index 64a798c8fa6b..057e1043846b 100644 --- a/sdk/communication/communication-network-traversal/review/communication-network-traversal.api.md +++ b/sdk/communication/communication-network-traversal/review/communication-network-traversal.api.md @@ -22,7 +22,7 @@ export class CommunicationRelayClient { constructor(connectionString: string, options?: CommunicationRelayClientOptions); constructor(endpoint: string, credential: KeyCredential, options?: CommunicationRelayClientOptions); constructor(endpoint: string, credential: TokenCredential, options?: CommunicationRelayClientOptions); - getRelayConfiguration(user: CommunicationUserIdentifier, options?: OperationOptions): Promise; + getRelayConfiguration(user?: CommunicationUserIdentifier, options?: OperationOptions): Promise; } // @public diff --git a/sdk/communication/communication-network-traversal/samples-dev/getRelayConfiguration.ts b/sdk/communication/communication-network-traversal/samples-dev/getRelayConfigurationWithIdentity.ts similarity index 94% rename from sdk/communication/communication-network-traversal/samples-dev/getRelayConfiguration.ts rename to sdk/communication/communication-network-traversal/samples-dev/getRelayConfigurationWithIdentity.ts index c5d442977976..bd2023b5cc62 100644 --- a/sdk/communication/communication-network-traversal/samples-dev/getRelayConfiguration.ts +++ b/sdk/communication/communication-network-traversal/samples-dev/getRelayConfigurationWithIdentity.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. /** - * @summary Issue a new Relay configuration + * @summary Issue a new Relay configuration providing a user identity */ import { CommunicationIdentityClient } from "@azure/communication-identity"; diff --git a/sdk/communication/communication-network-traversal/samples-dev/getRelayConfigurationWithoutIdentity.ts b/sdk/communication/communication-network-traversal/samples-dev/getRelayConfigurationWithoutIdentity.ts new file mode 100644 index 000000000000..facca4599c03 --- /dev/null +++ b/sdk/communication/communication-network-traversal/samples-dev/getRelayConfigurationWithoutIdentity.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Issue a new Relay configuration without user identity + */ + +import { CommunicationRelayClient } from "@azure/communication-network-traversal"; + +// Load the .env file if it exists +import * as dotenv from "dotenv"; +dotenv.config(); + +// You will need to set this environment variables or edit the following values +const connectionString = + process.env["COMMUNICATION_CONNECTION_STRING"] || ""; + +export async function main() { + console.log("\n== Get Relay configuration without identity sample ==\n"); + + const relayClient = new CommunicationRelayClient(connectionString); + console.log("Getting relay configuration"); + + const config = await relayClient.getRelayConfiguration(); + console.log("RelayConfig", config); +} + +main().catch((error) => { + console.error("Encountered an error while issuing relay configuration: "); + console.error("Request: \n", error.request); + console.error("\nResponse: \n", error.response); + console.error(error); +}); diff --git a/sdk/communication/communication-network-traversal/src/communicationRelayClient.ts b/sdk/communication/communication-network-traversal/src/communicationRelayClient.ts index 202f9cf96563..d32d5fc8f1ca 100644 --- a/sdk/communication/communication-network-traversal/src/communicationRelayClient.ts +++ b/sdk/communication/communication-network-traversal/src/communicationRelayClient.ts @@ -24,7 +24,10 @@ import { SDK_VERSION } from "./constants"; import { logger } from "./common/logger"; import { createSpan } from "./common/tracing"; import { CommunicationRelayClientOptions } from "./models"; -import { CommunicationRelayConfiguration } from "./generated/src/models"; +import { + CommunicationRelayConfiguration, + CommunicationNetworkTraversalIssueRelayConfigurationOptionalParams +} from "./generated/src/models"; const isCommunicationRelayClientOptions = ( options: any @@ -122,17 +125,19 @@ export class CommunicationRelayClient { * @param options - Additional options for the request. */ public async getRelayConfiguration( - user: CommunicationUserIdentifier, + user?: CommunicationUserIdentifier, options: OperationOptions = {} ): Promise { + const requestOptions: CommunicationNetworkTraversalIssueRelayConfigurationOptionalParams = options; + requestOptions.body = { id: user?.communicationUserId }; + const { span, updatedOptions } = createSpan( "CommunicationNetworkTraversal_IssueRelayConfiguration", - options + requestOptions ); try { - const { _response, ...result } = await this.client.issueRelayConfiguration( - { id: user.communicationUserId }, + const { ...result } = await this.client.issueRelayConfiguration( operationOptionsToRequestOptionsBase(updatedOptions) ); return result; diff --git a/sdk/communication/communication-network-traversal/src/generated/src/models/index.ts b/sdk/communication/communication-network-traversal/src/generated/src/models/index.ts index 2bc46db2ffc9..f88006c9c90a 100644 --- a/sdk/communication/communication-network-traversal/src/generated/src/models/index.ts +++ b/sdk/communication/communication-network-traversal/src/generated/src/models/index.ts @@ -15,7 +15,7 @@ export interface CommunicationRelayConfigurationRequest { /** * An existing ACS identity. */ - id: string; + id?: string; } /** @@ -86,6 +86,17 @@ export interface CommunicationError { readonly innerError?: CommunicationError; } +/** + * Optional parameters. + */ +export interface CommunicationNetworkTraversalIssueRelayConfigurationOptionalParams + extends coreHttp.OperationOptions { + /** + * Request for a CommunicationRelayConfiguration. + */ + body?: CommunicationRelayConfigurationRequest; +} + /** * Contains response data for the issueRelayConfiguration operation. */ diff --git a/sdk/communication/communication-network-traversal/src/generated/src/models/mappers.ts b/sdk/communication/communication-network-traversal/src/generated/src/models/mappers.ts index a0534008aae5..82d5669ac336 100644 --- a/sdk/communication/communication-network-traversal/src/generated/src/models/mappers.ts +++ b/sdk/communication/communication-network-traversal/src/generated/src/models/mappers.ts @@ -15,7 +15,6 @@ export const CommunicationRelayConfigurationRequest: coreHttp.CompositeMapper = modelProperties: { id: { serializedName: "id", - required: true, type: { name: "String" } diff --git a/sdk/communication/communication-network-traversal/src/generated/src/models/parameters.ts b/sdk/communication/communication-network-traversal/src/generated/src/models/parameters.ts index 63be405b5ad5..7e36cadf0a18 100644 --- a/sdk/communication/communication-network-traversal/src/generated/src/models/parameters.ts +++ b/sdk/communication/communication-network-traversal/src/generated/src/models/parameters.ts @@ -26,7 +26,7 @@ export const contentType: OperationParameter = { }; export const body: OperationParameter = { - parameterPath: "body", + parameterPath: ["options", "body"], mapper: CommunicationRelayConfigurationRequestMapper }; diff --git a/sdk/communication/communication-network-traversal/src/generated/src/operations/communicationNetworkTraversal.ts b/sdk/communication/communication-network-traversal/src/generated/src/operations/communicationNetworkTraversal.ts index b501ea52fb80..b40d0df0d23f 100644 --- a/sdk/communication/communication-network-traversal/src/generated/src/operations/communicationNetworkTraversal.ts +++ b/sdk/communication/communication-network-traversal/src/generated/src/operations/communicationNetworkTraversal.ts @@ -11,7 +11,7 @@ import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { NetworkRelayRestClient } from "../networkRelayRestClient"; import { - CommunicationRelayConfigurationRequest, + CommunicationNetworkTraversalIssueRelayConfigurationOptionalParams, CommunicationNetworkTraversalIssueRelayConfigurationResponse } from "../models"; @@ -31,18 +31,16 @@ export class CommunicationNetworkTraversal { /** * Issue a configuration for an STUN/TURN server for an existing identity. - * @param body Request for a CommunicationRelayConfiguration. * @param options The options parameters. */ issueRelayConfiguration( - body: CommunicationRelayConfigurationRequest, - options?: coreHttp.OperationOptions + options?: CommunicationNetworkTraversalIssueRelayConfigurationOptionalParams ): Promise { const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( options || {} ); return this.client.sendOperationRequest( - { body, options: operationOptions }, + { options: operationOptions }, issueRelayConfigurationOperationSpec ) as Promise; } diff --git a/sdk/communication/communication-network-traversal/swagger/README.md b/sdk/communication/communication-network-traversal/swagger/README.md index e21821aa47ba..cdf1634b4c40 100644 --- a/sdk/communication/communication-network-traversal/swagger/README.md +++ b/sdk/communication/communication-network-traversal/swagger/README.md @@ -14,7 +14,7 @@ license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../src/generated tag: package-2021-06-21-preview require: - - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/86408a8777e623f5f41e260472ed831309b85086/specification/communication/data-plane/Turn/readme.md + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4c8162b0a1f7bbd46e9aedc0e19bbe181e549c4c/specification/communication/data-plane/NetworkTraversal/readme.md model-date-time-as-string: false optional-response-headers: true payload-flattening-threshold: 10 diff --git a/sdk/communication/communication-network-traversal/test/public/communicationNetworkTraversalClient.spec.ts b/sdk/communication/communication-network-traversal/test/public/communicationNetworkTraversalClient.spec.ts index 956fb444fa06..3791c33bf9b5 100644 --- a/sdk/communication/communication-network-traversal/test/public/communicationNetworkTraversalClient.spec.ts +++ b/sdk/communication/communication-network-traversal/test/public/communicationNetworkTraversalClient.spec.ts @@ -32,7 +32,7 @@ matrix([[true, false]], async function(useAad) { } }); - it("successfully gets a turn credential", async function() { + it("successfully gets a turn credential providing a user identity", async function() { const connectionString = env.COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING; const identityClient = new CommunicationIdentityClient(connectionString); const user: CommunicationUserIdentifier = await identityClient.createUser(); @@ -53,5 +53,23 @@ matrix([[true, false]], async function(useAad) { assert.isNotNull(iceServer.credential); } }).timeout(5000); + + it("successfully gets a turn credential without providing a user identity", async function() { + const turnCredentialResponse = await client.getRelayConfiguration(); + assert.isNotNull(turnCredentialResponse); + + const turnTokenExpiresOn = turnCredentialResponse.expiresOn; + assert.isNotNull(turnTokenExpiresOn); + + const turnServers = turnCredentialResponse.iceServers; + + for (const iceServer of turnServers) { + for (const url of iceServer.urls) { + assert.isNotNull(url); + } + assert.isNotNull(iceServer.username); + assert.isNotNull(iceServer.credential); + } + }).timeout(5000); }); });