简体   繁体   中英

SAS token using Azure AD Service Principle for ADLS Gen2 at directory level in java

I have been trying to get a SAS token for ADLS Gen2 using java but haven't got any good example or document, Can anyone please provide an example or document to follow. (I am able to generate for blob storage at container level but not for ADLS Gen2 at directory level)

Have you considered the azure-storage-file-datalake library?

Since version 12.3.0 it supports Directory scoped SAS tokens, try DataLakeDirectoryClient#generateSas() .

DataLakeDirectoryClient directoryClient = dataLakeServiceClient
    .getFileSystemClient("fileSystemName")
    .getDirectoryClient("path/to/directory");

var startTime = OffsetDateTime.now();
var permissions = new PathSasPermission().setReadPermission(true);
var values = new DataLakeServiceSasSignatureValues(startTime.plusDays(1),permissions)
    .setStartTime(startTime);

directoryClient.generateSas(values);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM