Skip to content
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

[communication] switch to bearerTokenAuthenticationPolicy #13220

Merged
merged 2 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sdk/communication/communication-chat/src/chatClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import {
TypingIndicatorReceivedEvent
} from "@azure/communication-signaling";
import { getSignalingClient } from "./signaling/signalingClient";
import { createCommunicationTokenCredentialPolicy } from "./credential/communicationTokenCredentialPolicy";
import { ChatApiClient } from "./generated/src/chatApiClient";
import {
InternalPipelineOptions,
createPipelineFromOptions,
operationOptionsToRequestOptionsBase
operationOptionsToRequestOptionsBase,
bearerTokenAuthenticationPolicy
} from "@azure/core-http";
import "@azure/core-paging";
import { PagedAsyncIterableIterator } from "@azure/core-paging";
Expand Down Expand Up @@ -94,7 +94,7 @@ export class ChatClient {
}
};

const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);
const authPolicy = bearerTokenAuthenticationPolicy(this.tokenCredential, []);
const pipeline = createPipelineFromOptions(internalPipelineOptions, authPolicy);

this.api = new ChatApiClient(this.url, pipeline);
Expand Down
6 changes: 3 additions & 3 deletions sdk/communication/communication-chat/src/chatThreadClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
CommunicationUserIdentifier,
CommunicationTokenCredential
} from "@azure/communication-common";
import { createCommunicationTokenCredentialPolicy } from "./credential/communicationTokenCredentialPolicy";
import { ChatApiClient } from "./generated/src/chatApiClient";
import {
InternalPipelineOptions,
createPipelineFromOptions,
operationOptionsToRequestOptionsBase
operationOptionsToRequestOptionsBase,
bearerTokenAuthenticationPolicy
} from "@azure/core-http";
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import { CanonicalCode } from "@opentelemetry/api";
Expand Down Expand Up @@ -101,7 +101,7 @@ export class ChatThreadClient {
}
};

const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);
const authPolicy = bearerTokenAuthenticationPolicy(this.tokenCredential, []);
const pipeline = createPipelineFromOptions(internalPipelineOptions, authPolicy);

this.api = new ChatApiClient(this.url, pipeline);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type CommunicationIdentifierKind = CommunicationUserKind | PhoneNumberKin
// @public
export interface CommunicationTokenCredential {
dispose(): void;
getToken(abortSignal?: AbortSignalLike): Promise<AccessToken>;
getToken(abortSignalOrScopes?: AbortSignalLike | string | string[]): Promise<AccessToken>;
0rland0Wats0n marked this conversation as resolved.
Show resolved Hide resolved
}

// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export type TokenCredential = Pick<AzureCommunicationTokenCredential, "getToken"
export interface CommunicationTokenCredential {
/**
* Gets an `AccessToken` for the user. Throws if already disposed.
* @param abortSignal An implementation of `AbortSignalLike` to cancel the operation.
* @param abortSignalOrScopes An implementation of `AbortSignalLike` to cancel the operation or the scopes the token apply to.
*/
getToken(abortSignal?: AbortSignalLike): Promise<AccessToken>;
getToken(abortSignalOrScopes?: AbortSignalLike | string | string[]): Promise<AccessToken>;
/**
* Disposes the CommunicationTokenCredential and cancels any internal auto-refresh operation.
*/
Expand Down