-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ops new endpoints #32375
base: feature/communication/entra-identity
Are you sure you want to change the base?
Ops new endpoints #32375
Conversation
|
||
const entraTokenCredentialOptions: EntraCommunicationTokenCredentialOptions = { | ||
resourceEndpoint: "https://<your-resource>.communication.azure.com", | ||
tokenCredential: entraTokenCredential, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's inform clients using js to install the @azure/identity package
@@ -106,6 +106,25 @@ const entraTokenCredentialOptions: EntraCommunicationTokenCredentialOptions = { | |||
const credential = new AzureCommunicationTokenCredential(entraTokenCredentialOptions); | |||
``` | |||
|
|||
The same approach can be used for authorizing an Entra user with a Teams license to use Teams Phone Extensibility features through your Azure Communication Services resource. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also update changelog.md file with the upcoming changes
@@ -16,6 +16,13 @@ import { | |||
createPipelineRequest, | |||
} from "@azure/core-rest-pipeline"; | |||
|
|||
const TeamsExtensionScopePrefix = "https://auth.msft.communication.azure.com/"; | |||
const ComunicationClientsScopePrefix = "https://communication.azure.com/clients/"; | |||
const TeamsExtensionEndpoint = "/access/teamsPhone/:exchangeTeamsAccessToken"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TeamsExtensionEndpoint = "/access/teamsPhone/:exchangeTeamsAccessToken"; | |
const TeamsExtensionEndpoint = "/access/teamsPhone/:exchangeAccessToken"; |
wrong endpoint, it should be this one
|
||
constructor(private options: EntraCommunicationTokenCredentialOptions) { | ||
constructor(options: EntraCommunicationTokenCredentialOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the private keyword was removed?
this.client = getClient(options.resourceEndpoint); | ||
this.httpClient = createDefaultHttpClient(); | ||
this.options = options; | ||
this.options.scopes = this.options.scopes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.options.scopes = this.options.scopes | |
this.options.scopes = this.options.scopes || ["https://communication.azure.com/clients/.default"]; | |
can we simplify as follow?
return requestUri; | ||
} | ||
|
||
private DetermineEndpointAndApiVersion() : [string, string] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private DetermineEndpointAndApiVersion() : [string, string] { | |
private determineEndpointAndApiVersion() : [string, string] { |
const scopes = ["https://communication.azure.com/clients/VoIP"]; | ||
const comunicationClientsEndpoint = "/access/entra/:exchangeAccessToken?api-version=2024-04-01-preview"; | ||
const communicationClientsScope = "https://communication.azure.com/clients/VoIP"; | ||
const teamsExtensionEndpoint = "/access/teamsPhone/:exchangeTeamsAccessToken?api-version=2025-03-02-preview"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const teamsExtensionEndpoint = "/access/teamsPhone/:exchangeTeamsAccessToken?api-version=2025-03-02-preview"; | |
const teamsExtensionEndpoint = "/access/teamsPhone/:exchangeAccessToken?api-version=2025-03-02-preview"; |
|
||
it("Token exchange is not called again when Entra token stays the same", async function () { | ||
let scope = successApiMock(); | ||
it("Token exchange is not called again when Entra token stays the same " + apiVersion, async function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of the apiVersion can we use the endpoint, so we can differentiate between two endpoints
const credential = new AzureCommunicationTokenCredential(entraTokenCredentialOptions); | ||
|
||
const tokenResult = (await credential.getToken()).token; | ||
assert.strictEqual(tokenResult, acsToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we verify that the Entra endpoint is being called?
assert.isTrue(getTokenSpy.alwaysCalledWithExactly([scopes], undefined)); | ||
assert.isTrue(getTokenSpy.callCount > 0); | ||
assert.isTrue(apiMock.isDone()); | ||
getTokenSpy.restore(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we verify if the correct endpoint is being called based on the provided scopes?
} | ||
|
||
private DetermineEndpointAndApiVersion() : [string, string] { | ||
if (!this.options.scopes || this.options.scopes.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this if condition and the last else condition are not covered by unit tests
Packages impacted by this PR
Issues associated with this PR
Describe the problem that is addressed by this PR
What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?
Are there test cases added in this PR? (If not, why?)
Provide a list of related PRs (if any)
Command used to generate this PR:**(Applicable only to SDK release request PRs)
Checklists