Expand my Community achievements bar.

SOLVED

PDF Viewer Component ClientID different domains

Avatar

Level 2

Hi

 

I'm playing around with the PDF viewer component on AEM.
For testing purpose I created the context aware configuration and added a clientID (mapped on my localhost domain) and that works fine (PDF viewer is showing and is functional).

Now I want to roll it out on all our domains (talking about an AEM setup with 20+ different PRD domains no subdomains) hosted on Adobe cloun.
How do I need to do this?

Do we need to create for every domain a separated context aware configuration and create different keys for it, mapped to the right /content path?
Or is their an easier approach (a general client ID that can be used for this)?

 

Thanks 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 2

I went with the following solution:
I extended the PDF viewer component with my own Sling model, with a getClientId function.
I added on the page template a new field in the page properties where a clientId can be filled in.

The following logic is applied in the function:
if it is an author environment take the OSGi config, if it is on the publish environment use the id that is configured on the page properties (with inheritance valuemap).
With this setup it is very easy to create an clientId and use it on the right domain..

 

View solution in original post

8 Replies

Avatar

Community Advisor

Hi,

If you have same value for all the domains, then you have to create only one at root level(/content or /content/mytenant)

  1. clientId - Required - the client key obtained by registering for the view sdk api - https://www.adobe.com/go/dcsdks_credentials
  2. reportSuiteId - Adobe Analytics ID

 

https://github.com/adobe/aem-core-wcm-components/tree/main/content/src/content/jcr_root/apps/core/wc... 



Arun Patidar

Avatar

Level 2

Hi

We will have different values (due to different domains) if the explanation text on the creation screen.
Example domain structure we have: 

- site1.co.uk

- site1.com
- site.fr
- site.de
-....

So I don't think the single clientId will work

Avatar

Community Advisor

Certainly, you can also implement property inheritance using context-aware configurations.

For example, if the clientId is different but the reportSuiteId is the same, you can set the reportSuiteId in the context-aware configuration of the root node. Then, for domain-specific context-aware configurations, you can set the clientId accordingly.

More examples are in the below blogs

https://cqdump.joerghoh.de/2018/05/16/sling-context-aware-configuration-part-4-using-inheritance/ 



Arun Patidar

Avatar

Level 2

But you still need to create for every different domain a new credential pair to enable this functionality?
Or are their any "hack" if you use for example the .adobeaemcloud.com domain (what is used as your main domain)?

Avatar

Community Advisor

Yes, the configuration has to be created for every domain.

 

Not the hack but you can extend core component and create your own logic to read these configuration



Arun Patidar

Avatar

Community Advisor

Hello @JeffreyVSpringbok 

 

The issue can be divided into 2 categories:

1. When the sites are being authored/reviewed on the same server, then they all can share the same clientID.

 

2. When the domains differ like in your case, we cannot use the same client ID.

  • The client ID would be different for author and publish. 
  • The client ID would also be different for each domain

 

To deal with this we can create runmode specific OSGi config like: org.apache.sling.caconfig.impl.override.OsgiConfigurationOverrideProvider~pdfViewer.cfg

 

// Configuration created by Apache Sling JCR Installer
{
  "enabled":true,
  "description":"PDF Viewer CA Config Override",
  "overrides":[
    "[/content/techrevel]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"e063d102acba41b2aae331a32ebe2062\"",
    "[/content/techrevel/techreveltravel]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"33201404a331410cbcaae0c1ac130d03\"",
    "[/content/techrevel/dk]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"7010466cb7c14132b203bc6aa2a06a11\"",
    "[/content/techrevel/pl]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"1b46410df3b14aec31ed30c6c01dcecc\"",
    "[/content/techrevel/se]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"3b6d02d0ed3b443a02131a1134aae3d1\"",
    "[/content/techrevel/no]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"1f30433062474f31a6c40b1146361024\"",
    "[/content/techrevel/gb]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"00abe2111cbf4f0c3f11adbcef1e3f31\"",
    "[/content/techrevel/ie]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"e1203a1f10114de0a63e23d332c670fd\"",
    "[/content/techrevel/nl]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"b17eeadb3f704b02a4bbbca4303630a6\"",
    "[/content/techrevel/de]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"2bb2601d137e411bba1031baa32dd044\"",
    "[/content/techrevel/fi]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"637bcab03fb64ecd0131dc63162f11da\"",
    "[/content/techrevel/lt]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"71f00e7bfe1643b307ef40bb311d3774\"",
    "[/content/techrevel/cz]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"3d603f11f13a4ec00c3f0c0343c63ed1\"",
    "[/content/techrevel/lv]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"e10dadbee162403eb4f3710f340c3361\"",
    "[/content/techrevel/it]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"e11f10a364e142fda1b1f307d64a64de\"",
    "[/content/techrevel/fr]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"4ecca6c3d3334363b02e604fdeeb6600\"",
    "[/content/techrevel/es]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"70f3fce01c0444003c3ec60c0dc1df7a\"",
    "[/content/techrevel/ee]com.adobe.cq.wcm.core.components.internal.services.pdfviewer.PdfViewerCaConfig/clientId=\"1761b301411e41020c031c431ebfc7b0\""
  ]
}

 

With context-aware you can set value only on author and then replicate to publish. Thus, either author won't work or publish.


Aanchal Sikka

Avatar

Administrator

@JeffreyVSpringbok Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni

Avatar

Correct answer by
Level 2

I went with the following solution:
I extended the PDF viewer component with my own Sling model, with a getClientId function.
I added on the page template a new field in the page properties where a clientId can be filled in.

The following logic is applied in the function:
if it is an author environment take the OSGi config, if it is on the publish environment use the id that is configured on the page properties (with inheritance valuemap).
With this setup it is very easy to create an clientId and use it on the right domain..