Skip to main content
SRK_1D
Level 2
Apr 28, 2022 3:08 PM UTC
Solved

How to restrict asset downloads on the AEM publish side?

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.
Anish-Sinha
Anish-SinhaAccepted solution
Employee
Apr 28, 2022 11:05 PM UTC

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...

4 replies

Anish-Sinha
Anish-SinhaAccepted solution
Employee
Apr 28, 2022 11:05 PM UTC

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...

Translate
SRK_1D
SRK_1DAuthor
Level 2
Apr 29, 2022 3:02 AM UTC

Thanks, @anish-sinha . This helps. 

Translate
anish1991
Employee
Apr 28, 2022 11:04 PM UTC

ignore response from this id. check below

Translate
Ravi_Pampana
New Participant
Apr 28, 2022 8:24 PM UTC

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.

Translate