How to restrict asset downloads on the AEM publish side? | Community
Skip to main content
SRK_1D
New Participant
April 28, 2022
Solved

How to restrict asset downloads on the AEM publish side?

  • April 28, 2022
  • 3 replies
  • 1763 views

We are building a website on AEM where the website visitors are allowed to download few assets (Such as PDF files, zip files, images etc). However, for certain assets, we have a requirement to capture the user's name and email ID before they could download the asset. Is there a way to implement this restriction on the publish side?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anish-Sinha

Hi @sai_rama_krishn ,

You can utilize CUG concept in order to achieve this. see this example - https://experienceleague.adobe.com/docs/experience-manager-learn/assets/advanced/closed-user-groups....

Just this configuration will not help you to achieve this, you will have to write a custom authentication handler. As soon as the user tries to access the restricted asset,  you can show a form popup or redirect and have a form where you will collect the user data, once the data is collected you will redirect the user to access/download the asset. Here is a sample implementation with the code - https://www.linkedin.com/pulse/creating-custom-authentication-handler-aem-cq5-navin-kaushal

 

some more useful links:

http://www.aemcq5tutorials.com/tutorials/implement-cug-aem/

https://www.albinsblog.com/2021/12/enable-user-authentication-for-aem-websites-azureadb2c-oauth.html...

3 replies

Anish-Sinha
Anish-SinhaAccepted solution
Employee
April 28, 2022

Hi @sai_rama_krishn ,

You can utilize CUG concept in order to achieve this. see this example - https://experienceleague.adobe.com/docs/experience-manager-learn/assets/advanced/closed-user-groups....

Just this configuration will not help you to achieve this, you will have to write a custom authentication handler. As soon as the user tries to access the restricted asset,  you can show a form popup or redirect and have a form where you will collect the user data, once the data is collected you will redirect the user to access/download the asset. Here is a sample implementation with the code - https://www.linkedin.com/pulse/creating-custom-authentication-handler-aem-cq5-navin-kaushal

 

some more useful links:

http://www.aemcq5tutorials.com/tutorials/implement-cug-aem/

https://www.albinsblog.com/2021/12/enable-user-authentication-for-aem-websites-azureadb2c-oauth.html...

SRK_1D
SRK_1DAuthor
New Participant
April 29, 2022

Thanks, @anish-sinha . This helps. 

anish1991
Employee
April 28, 2022

ignore response from this id. check below

Ravi_Pampana
New Participant
April 28, 2022

Hi,

 

Restricting download needs to be handled by javascript and depends on the browser, it is not something AEM can handle. You can create a form to enter user name and email id before allowing user to download.