How to ensure user see the images pertaining to him only from private blob Azure Storage?

Viewed 3832

Some of the user’s images are stored in Azure BLOB which is not publicly accessible. In our scenario we upload the images (user’s images) on private blob which later needs to be shown at the client side(Angular). Moreover the user should only be able to see the images that is related to him and not the images of other users.

We can generate the list of images URLs at server side but when this is passed to client side to render, it would fail naturally being blob not being public.

Now, being all the users who would access the application are internal to the organization, I believe authorization to access the images can be achieved by AAD/SAS. However at the same time, I am fail to understand how would I ensure or apply the security that if wanted user X should not be able to read the images of user Y?

1 Answers

Regarding the issue, you can use the following suggestions to implement it.

  1. Store the User information and his image information (such as the image's azure blob container name, azure blob blob name ) in the database.

  2. When the user wants to access the image, query the database with the user information to get these image,

  3. After getting the image information, use the sdk to create sas token then return the image's blob url with sas token to cliend. Regarding how to create sas token, please refer to here.

Related