简体   繁体   中英

Blob storage temporary URL

I am trying to create the temporary url for an azure storage blob. I created the url with the help of these below commands.

 const sasToken = generateBlobSASQueryParameters(sasOptions, sharedKeyCredential).toString();
                  
 sasUrls[serialNo] = `${containerClient.getBlockBlobClient(blobName).url}?${sasToken}`;

from the 2nd line of code, The sas url has formed with the permanent uri. so even if i share the temporary url having some expiry time with someone, then they can see/take blob's permanent uri and can use that after the expiry time also. So then what is the use of temporary link? Is there any way/ any method to hide my permanent uri in the temporary link?

Please guide me if i am wrong.

FY: i am using typescript.

Please check if below referred cases narrows down your requirement partially.

  1. See if sas token can be replaced with Display name and sent in the request header (see reference i.)
  2. You can make use of cache control using cdn (as in comment) Manage expiration -cdn .
  3. With cache control header with public accessible and max age set to expiration time equal to that of sas expiry.

Ex:

 blockBlob.Properties.CacheControl = "max-age=300, must-revalidate"; 
      
blockBlob.SetProperties(); //(300seconds)

Or

var headers = new SharedAccessBlobHeaders() { CacheControl = "max-age=" +  };

If private is set,you can set max-age=0, no-cache, no-store

Note: With this If the client requests the blob, it will not use the cached-blob in cdn(which is already expired). Instead, it will directly request the blob stored in blob storage.

  1. You can use a stored access policy to change the expiry time, or to revoke it after it has been issued.

References:

i. Securing SAS Token from Azure Logic Apps

ii. Manage stored access policies

iii. SO reference-cache control

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