-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[communication-common] Add options bag for getToken function, mark @h…
…idden where applicable (#14046) * [communication-common] Add options bag for getToken function, mark @hidden where applicable * rename url to endpoint in CommunicationIdentityClient constructor
- Loading branch information
Showing
18 changed files
with
142 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 23 additions & 2 deletions
25
sdk/communication/communication-chat/src/signaling/signalingClient.browser.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,34 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import { CommunicationSignalingClient, SignalingClient } from "@azure/communication-signaling"; | ||
import { | ||
CommunicationSignalingClient, | ||
CommunicationUserCredential, | ||
SignalingClient | ||
} from "@azure/communication-signaling"; | ||
import { CommunicationTokenCredential } from "@azure/communication-common"; | ||
import { AzureLogger } from "@azure/logger"; | ||
import { AbortSignalLike, AccessToken } from "@azure/core-http"; | ||
|
||
export const getSignalingClient = ( | ||
credential: CommunicationTokenCredential, | ||
logger: AzureLogger | ||
): SignalingClient | undefined => { | ||
return new CommunicationSignalingClient(credential, logger); | ||
return new CommunicationSignalingClient(new SignalingCredentialType(credential), logger); | ||
}; | ||
|
||
/** | ||
* Bridge credential until @azure/communication-signaling has been updated | ||
* to match common's CommunicationTokenCredential interface. | ||
*/ | ||
class SignalingCredentialType implements CommunicationUserCredential { | ||
constructor(private credential: CommunicationTokenCredential) {} | ||
|
||
getToken(abortSignal?: AbortSignalLike): Promise<AccessToken> { | ||
return this.credential.getToken({ abortSignal }); | ||
} | ||
|
||
dispose() { | ||
this.credential.dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.