Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new RetryPolicyFactory(pipelineOptions.retryOptions),
new LoggingPolicyFactory()
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
let proxySettings: ProxySettings | undefined;
if (typeof pipelineOptions.proxy === "string") {
proxySettings = getDefaultProxySettings(pipelineOptions.proxy);
} else {
proxySettings = pipelineOptions.proxy;
}
factories.push(proxyPolicy(proxySettings));
}
factories.push(
isTokenCredential(credential)
? bearerTokenAuthenticationPolicy(credential, "https://storage.azure.com/.default")
: credential
);
return new Pipeline(factories, {
HTTPClient: pipelineOptions.httpClient,
logger: pipelineOptions.logger
});
}
new StorageBrowserPolicyFactory(),
deserializationPolicy(), // Default deserializationPolicy is provided by protocol layer
new StorageRetryPolicyFactory(pipelineOptions.retryOptions),
logPolicy({
logger: logger.info,
allowedHeaderNames: StorageBlobLoggingAllowedHeaderNames,
allowedQueryParameters: StorageBlobLoggingAllowedQueryParameters
})
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
factories.push(proxyPolicy(pipelineOptions.proxyOptions));
}
factories.push(
isTokenCredential(credential)
? bearerTokenAuthenticationPolicy(credential, StorageOAuthScopes)
: credential
);
return new Pipeline(factories, {
httpClient: pipelineOptions.httpClient
});
}
this.url = escapeURLPath(url);
this.accountName = getAccountNameFromUrl(url);
this.pipeline = pipeline;
this.storageClientContext = new StorageClientContext(
this.url,
pipeline.toServiceClientOptions()
);
this.isHttps = iEqual(getURLScheme(this.url) || "", "https");
this.credential = new AnonymousCredential();
for (const factory of this.pipeline.factories) {
if (
(isNode && factory instanceof StorageSharedKeyCredential) ||
factory instanceof AnonymousCredential ||
isTokenCredential(factory)
) {
this.credential = factory;
}
}
// Override protocol layer's default content-type
const storageClientContext = this.storageClientContext as any;
storageClientContext.requestContentType = undefined;
}
}
new StorageBrowserPolicyFactory(),
deserializationPolicy(), // Default deserializationPolicy is provided by protocol layer
new StorageRetryPolicyFactory(pipelineOptions.retryOptions),
logPolicy({
logger: logger.info,
allowedHeaderNames: StorageDataLakeLoggingAllowedHeaderNames,
allowedQueryParameters: StorageDataLakeLoggingAllowedQueryParameters
})
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
factories.push(proxyPolicy(pipelineOptions.proxyOptions));
}
factories.push(
isTokenCredential(credential)
? bearerTokenAuthenticationPolicy(credential, StorageOAuthScopes)
: credential
);
return new Pipeline(factories, {
httpClient: pipelineOptions.httpClient
});
}
key: string | KeyVaultKey, // keyUrl or KeyVaultKey
credential: TokenCredential,
pipelineOptions: PipelineOptions = {}
) {
const libInfo = `azsdk-js-keyvault-keys/${SDK_VERSION}`;
if (pipelineOptions.userAgentOptions) {
pipelineOptions.userAgentOptions.userAgentPrefix !== undefined
? `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`
: libInfo;
} else {
pipelineOptions.userAgentOptions = {
userAgentPrefix: libInfo
};
}
const authPolicy = isTokenCredential(credential)
? challengeBasedAuthenticationPolicy(credential)
: signingPolicy(credential);
const internalPipelineOptions = {
...pipelineOptions,
...{
loggingOptions: {
logger: logger.info,
logPolicyOptions: {
allowedHeaderNames: [
"x-ms-keyvault-region",
"x-ms-keyvault-network-info",
"x-ms-keyvault-service-version"
]
}
}
new StorageBrowserPolicyFactory(),
deserializationPolicy(), // Default deserializationPolicy is provided by protocol layer
new StorageRetryPolicyFactory(pipelineOptions.retryOptions),
logPolicy({
logger: logger.info,
allowedHeaderNames: StorageQueueLoggingAllowedHeaderNames,
allowedQueryParameters: StorageQueueLoggingAllowedQueryParameters
})
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
factories.push(proxyPolicy(pipelineOptions.proxyOptions));
}
factories.push(
isTokenCredential(credential)
? bearerTokenAuthenticationPolicy(credential, StorageOAuthScopes)
: credential
);
return new Pipeline(factories, {
httpClient: pipelineOptions.httpClient
});
}
pipelineOptions: PipelineOptions = {}
) {
this.vaultUrl = vaultUrl;
const libInfo = `azsdk-js-keyvault-secrets/${SDK_VERSION}`;
if (pipelineOptions.userAgentOptions) {
pipelineOptions.userAgentOptions.userAgentPrefix !== undefined
? `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`
: libInfo;
} else {
pipelineOptions.userAgentOptions = {
userAgentPrefix: libInfo
};
}
const authPolicy = isTokenCredential(credential)
? challengeBasedAuthenticationPolicy(credential)
: signingPolicy(credential);
const internalPipelineOptions = {
...pipelineOptions,
...{
loggingOptions: {
logger: logger.info,
logPolicyOptions: {
allowedHeaderNames: [
"x-ms-keyvault-region",
"x-ms-keyvault-network-info",
"x-ms-keyvault-service-version"
]
}
}
pipelineOptions: PipelineOptions = {}
) {
this.vaultUrl = vaultUrl;
const libInfo = `azsdk-js-keyvault-keys/${SDK_VERSION}`;
if (pipelineOptions.userAgentOptions) {
pipelineOptions.userAgentOptions.userAgentPrefix !== undefined
? `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`
: libInfo;
} else {
pipelineOptions.userAgentOptions = {
userAgentPrefix: libInfo
};
}
const authPolicy = isTokenCredential(credential)
? challengeBasedAuthenticationPolicy(credential)
: signingPolicy(credential);
const internalPipelineOptions = {
...pipelineOptions,
...{
loggingOptions: {
logger: logger.info,
logPolicyOptions: {
allowedHeaderNames: [
"x-ms-keyvault-region",
"x-ms-keyvault-network-info",
"x-ms-keyvault-service-version"
]
}
}
) {
this.vaultUrl = vaultUrl;
this.credential = credential;
const libInfo = `azsdk-js-keyvault-certificates/${packageVersion}`;
if (pipelineOptions.userAgentOptions) {
pipelineOptions.userAgentOptions.userAgentPrefix !== undefined
? `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`
: libInfo;
} else {
pipelineOptions.userAgentOptions = {
userAgentPrefix: libInfo
};
}
const authPolicy = isTokenCredential(credential)
? challengeBasedAuthenticationPolicy(credential)
: signingPolicy(credential);
const internalPipelineOptions = {
...pipelineOptions,
...{
loggingOptions: {
logger: logger.info,
logPolicyOptions: {
allowedHeaderNames: [
"x-ms-keyvault-region",
"x-ms-keyvault-network-info",
"x-ms-keyvault-service-version"
]
}
}