使用 Java sdk 在 azure blob 存储中上传文件时强制执行 TLS 1.2
适用于 Azure Blob 存储的 Java SDK 使用 NFS,但我们希望在使用 blobclient 上传文件时使用 TLS 1.2。虽然帐户中的最低设置设置为 TLS 1.2,但客户端如何使用 TLS 1.2 从其应用程序上传文件?
BlobServiceClient blobSvcClient = new BlobServiceClientBuilder()
.endpoint(storageActUrl) // https://myaccount.blob.core.windows.net/testcontainer/blob.txt
.sasToken(sasToken)
.buildClient();
BlobClient blobClient = blobSvcClient.getBlobContainerClient(containerName).getBlobClient(blobName);
BlobHttpHeaders blobHeaders = new BlobHttpHeaders().setContentLanguage("en-US").setContentType("binary");
blobClient.uploadFromFile(filePath, null, headers, null, AccessTier.HOT, new BlobRequestConditions(), Duration.ofMinutes(30));
Java SDK for Azure Blob Storage uses NFS but we want to use TLS 1.2 when uploading files using blobclient. Though the minimum setting in account is set as TLS 1.2 but how can client upload files from their application using TLS 1.2 ?
BlobServiceClient blobSvcClient = new BlobServiceClientBuilder()
.endpoint(storageActUrl) // https://myaccount.blob.core.windows.net/testcontainer/blob.txt
.sasToken(sasToken)
.buildClient();
BlobClient blobClient = blobSvcClient.getBlobContainerClient(containerName).getBlobClient(blobName);
BlobHttpHeaders blobHeaders = new BlobHttpHeaders().setContentLanguage("en-US").setContentType("binary");
blobClient.uploadFromFile(filePath, null, headers, null, AccessTier.HOT, new BlobRequestConditions(), Duration.ofMinutes(30));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过研究,发现以下代码强制执行 TLS 1.2。写下来以防对其他人有帮助。
After research, found below code which enforces TLS 1.2. Writing it down in case it helps others.