google reCaptcha configuration for multiple website pattern | Community
Skip to main content
April 24, 2020
Solved

google reCaptcha configuration for multiple website pattern

  • April 24, 2020
  • 2 replies
  • 6089 views

Hello, 

I have 3 Websites hosted on my AEM platform, each using Google reCaptcha.  Each website are completely different, but they use the similar service Google reCaptcha service. Each website has their own separate "public key".

 

What is the best way to configure each website, so that the keys are only expose to specific websites? OSGI configurations, configuration on the recaptcha component, configuration in page properties, etc?

 

Whats the best practice, please help?

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 AndySh4

A basic approach that I've seen used successfully is to put a site-specific property at the root page of the site, like at /content/site1/en_us, and then adjust the component to inherit that property using InheritanceValueMap like this:

InheritanceValueMap ivmap = new ComponentInheritanceValueMap(resource); String captchakey = ivmap.getInherited("captchakey", String.class);

 

2 replies

AndySh4Accepted solution
Level 3
April 24, 2020

A basic approach that I've seen used successfully is to put a site-specific property at the root page of the site, like at /content/site1/en_us, and then adjust the component to inherit that property using InheritanceValueMap like this:

InheritanceValueMap ivmap = new ComponentInheritanceValueMap(resource); String captchakey = ivmap.getInherited("captchakey", String.class);

 

arunpatidar
Community Advisor
Community Advisor
April 25, 2020

you can go for context-aware config as well or stores as OSGi factory config and read factory config based on site.

 

CAC

https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration.html

 

Arun Patidar
April 26, 2020
Thank you, but what is the best practice? context-aware config or page property?