@azure/communication-common
Advanced tools
Comparing version 1.0.0-alpha.20210113.1 to 1.0.0-alpha.20210114.1
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { isTokenCredential } from "@azure/core-auth"; | ||
import { URLBuilder } from "@azure/core-http"; | ||
@@ -33,3 +34,3 @@ import { parseConnectionString } from "./connectionString"; | ||
export const parseClientArguments = (connectionStringOrUrl, credentialOrOptions) => { | ||
if (isKeyCredential(credentialOrOptions)) { | ||
if (isKeyCredential(credentialOrOptions) || isTokenCredential(credentialOrOptions)) { | ||
assertValidEndpoint(connectionStringOrUrl); | ||
@@ -36,0 +37,0 @@ return { url: connectionStringOrUrl, credential: credentialOrOptions }; |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
export * from "./communicationAccessKeyCredentialPolicy"; | ||
export * from "./communicationAuthPolicy"; | ||
export * from "./clientArguments"; | ||
//# sourceMappingURL=index.js.map |
@@ -257,2 +257,17 @@ 'use strict'; | ||
/** | ||
* Creates a pipeline policy to authenticate request based | ||
* on the credential passed in | ||
* | ||
* @param {KeyCredential | TokenCredential} credential The key credential | ||
*/ | ||
const createCommunicationAuthPolicy = (credential) => { | ||
if (coreAuth.isTokenCredential(credential)) { | ||
return coreHttp.bearerTokenAuthenticationPolicy(credential, "https://communication.azure.com//.default"); | ||
} | ||
else { | ||
return createCommunicationAccessKeyCredentialPolicy(credential); | ||
} | ||
}; | ||
// Copyright (c) Microsoft Corporation. | ||
@@ -307,3 +322,3 @@ // TODO: update when connection string format is finalized | ||
const parseClientArguments = (connectionStringOrUrl, credentialOrOptions) => { | ||
if (isKeyCredential(credentialOrOptions)) { | ||
if (isKeyCredential(credentialOrOptions) || coreAuth.isTokenCredential(credentialOrOptions)) { | ||
assertValidEndpoint(connectionStringOrUrl); | ||
@@ -384,2 +399,3 @@ return { url: connectionStringOrUrl, credential: credentialOrOptions }; | ||
exports.createCommunicationAccessKeyCredentialPolicy = createCommunicationAccessKeyCredentialPolicy; | ||
exports.createCommunicationAuthPolicy = createCommunicationAuthPolicy; | ||
exports.getIdentifierKind = getIdentifierKind; | ||
@@ -386,0 +402,0 @@ exports.isCallingApplicationIdentifier = isCallingApplicationIdentifier; |
{ | ||
"name": "@azure/communication-common", | ||
"version": "1.0.0-alpha.20210113.1", | ||
"version": "1.0.0-alpha.20210114.1", | ||
"description": "Common package for Azure Communication services.", | ||
@@ -5,0 +5,0 @@ "sdk-type": "client", |
@@ -5,2 +5,3 @@ import { AbortSignalLike } from '@azure/core-http'; | ||
import { RequestPolicyFactory } from '@azure/core-http'; | ||
import { TokenCredential } from '@azure/core-auth'; | ||
@@ -129,2 +130,10 @@ /** | ||
/** | ||
* Creates a pipeline policy to authenticate request based | ||
* on the credential passed in | ||
* | ||
* @param {KeyCredential | TokenCredential} credential The key credential | ||
*/ | ||
export declare const createCommunicationAuthPolicy: (credential: KeyCredential | TokenCredential) => RequestPolicyFactory; | ||
/** | ||
* Returns the CommunicationIdentifierKind for a given CommunicationIdentifier. Returns undefined if the kind couldn't be inferred. | ||
@@ -255,5 +264,5 @@ * | ||
url: string; | ||
credential: KeyCredential; | ||
credential: TokenCredential | KeyCredential; | ||
}; | ||
export { } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121259
35
1093