diff --git a/core/src/main/java/com/adobe/aem/commons/assetshare/components/assetkit/AssetKit.java b/core/src/main/java/com/adobe/aem/commons/assetshare/components/assetkit/AssetKit.java index 1caf3559c3..e03d4a80b9 100644 --- a/core/src/main/java/com/adobe/aem/commons/assetshare/components/assetkit/AssetKit.java +++ b/core/src/main/java/com/adobe/aem/commons/assetshare/components/assetkit/AssetKit.java @@ -26,10 +26,26 @@ import java.util.Collection; @ProviderType public interface AssetKit extends Component { + /** + * Returns the assets that are part of this Asset Kit. + * The assets are returned as as AssetModels, so ComputedProperties can used to display relevant data. + * @return a Collection of AssetModels + */ Collection getAssets(); + + /** + * Returns true is the component is ready to display. This is used to determine if the component's Page Editor edit box should display or not. + */ boolean isReady(); @ConsumerType + /** + * A Filter is used to filter the assets that are part of the Asset Kit. + * + * This acts as an OSGi service interface that can be implemented with a service.ranking > 10000 to override default filtering behavior. + * The Asset Share Commons provided filter removed the "banner image asset" from the asset kit listing (AssetKitFilterImpl.java). + * If the logic for defining the banner image changes a custom Filter would need to be developed. + */ interface Filter { Collection filter(Collection assets); } diff --git a/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/AssetKitHelper.java b/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/AssetKitHelper.java index 9a8aeb2f94..c9147bcd72 100644 --- a/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/AssetKitHelper.java +++ b/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/AssetKitHelper.java @@ -27,7 +27,11 @@ import javax.jcr.RepositoryException; import java.util.Collection; + @ProviderType +/** + * A helper class for working with the Asset Kit. Typically use in custom ComponentUpdater implementations or custom AssetKit component Sling Models. + */ public interface AssetKitHelper { /** * Gets a collection of assets that at or exist under the paths provided. diff --git a/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/ComponentUpdater.java b/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/ComponentUpdater.java index 99e64d1810..f18cad4fbc 100644 --- a/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/ComponentUpdater.java +++ b/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/ComponentUpdater.java @@ -26,11 +26,33 @@ import javax.jcr.RepositoryException; @ConsumerType +/** + * A component updater is used to update the components on an asset kit page based on the asset kit's payload. + */ public interface ComponentUpdater { - + /** + * The name of the component updater. Displays in the Asset kit creator workflow dialog's dropdown. + * @return the name of the component updater. Ideally is unique across all component updaters, so you can tell which is which. + */ String getName(); + /** + * The id of the component updater. Used to identify the component updater in the workflow dialog. + * Must be unique across all component updaters. + * Defaults to the component's full class name. No need to change the default implementation. + * @return + */ default String getId() { return this.getClass().getName(); } + /** + * Entry point for updating the @{code assetKitPage} based on the @{code assetKit} payload resource. + * + * This can do anything, it can find and updated existing components created by the template's initial content, or it can create new resources under the page (or anywhere it has write access). + * + * @param assetKitPage the asset kit page being updated. + * @param assetKit the resource (folder, collection) that represents the asset kit's contents. + * @throws PersistenceException + * @throws RepositoryException + */ void updateComponent(Page assetKitPage, Resource assetKit) throws PersistenceException, RepositoryException; } diff --git a/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/PagePathGenerator.java b/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/PagePathGenerator.java index fe61b1cd27..ffdaa09473 100644 --- a/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/PagePathGenerator.java +++ b/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/PagePathGenerator.java @@ -5,8 +5,25 @@ @ConsumerType public interface PagePathGenerator { + /** + * The name of the page path generator. Displays in the Asset kit creator workflow dialog's dropdown. + * @return the name of the page path generator. Ideally is unique across all page path generator, so you can tell which is which. + */ String getName(); + /** + * The id of the component updater. Used to identify the component updater in the workflow dialog. + * Must be unique across all component updaters. + * Defaults to the component's full class name. No need to change the default implementation. + * @return the unique id of the page path generator. + */ default String getId() { return this.getClass().getName(); } + + /** + * Generates a page path based on the @{code prefix} and @{code assetKit} resource. + * @param prefix the JCR path prefix all asset kit pages will be created under. This is defined in the Asset Kit creator workflow dialog. + * @param assetKit the resource (folder, collection) that represents the asset kit's contents. + * @return the full JCR path of the asset kit page. + */ String generatePagePath(String prefix, Resource assetKit); } diff --git a/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/impl/componentupdaters/AssetKitComponentUpdaterImpl.java b/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/impl/componentupdaters/AssetKitComponentUpdaterImpl.java index 8bb7f5835a..80e30a78ff 100644 --- a/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/impl/componentupdaters/AssetKitComponentUpdaterImpl.java +++ b/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/impl/componentupdaters/AssetKitComponentUpdaterImpl.java @@ -24,17 +24,23 @@ import com.day.cq.wcm.api.Page; import org.apache.sling.api.resource.PersistenceException; import org.apache.sling.api.resource.Resource; +import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Modified; import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; import javax.jcr.RepositoryException; @Component +@Designate(ocd = AssetKitComponentUpdaterImpl.Config.class) public class AssetKitComponentUpdaterImpl implements ComponentUpdater { - private static String RESOURCE_TYPE = AssetKitImpl.RESOURCE_TYPE; private static String PROPERTY_NAME = "paths"; @Reference private transient AssetKitHelper assetKitHelper; + private Config config; @Override public String getName() { @@ -43,6 +49,24 @@ public String getName() { @Override public void updateComponent(Page assetKitPage, Resource assetKit) throws PersistenceException, RepositoryException { - assetKitHelper.updateComponentOnPage(assetKitPage, RESOURCE_TYPE, PROPERTY_NAME, assetKit.getPath()); + assetKitHelper.updateComponentOnPage(assetKitPage, config.resource_type(), PROPERTY_NAME, assetKit.getPath()); + } + + @Activate + @Modified + protected void activate(Config config) { + this.config = config; + } + + @ObjectClassDefinition( + name = "Asset Share Commons - Asset Kit Component Updater", + description = "Component updater that updates an Asset Kit component" + ) + @interface Config { + @AttributeDefinition( + name = "Resource Type", + description = "The resource type of the component to update." + ) + String resource_type() default AssetKitImpl.RESOURCE_TYPE; } } diff --git a/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/impl/componentupdaters/BannerComponentUpdaterImpl.java b/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/impl/componentupdaters/BannerComponentUpdaterImpl.java index a34e74eab9..27b7bf3455 100644 --- a/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/impl/componentupdaters/BannerComponentUpdaterImpl.java +++ b/core/src/main/java/com/adobe/aem/commons/assetshare/util/assetkit/impl/componentupdaters/BannerComponentUpdaterImpl.java @@ -18,6 +18,7 @@ */ package com.adobe.aem.commons.assetshare.util.assetkit.impl.componentupdaters; +import com.adobe.aem.commons.assetshare.components.assetkit.impl.AssetKitImpl; import com.adobe.aem.commons.assetshare.content.AssetModel; import com.adobe.aem.commons.assetshare.util.assetkit.AssetKitHelper; import com.adobe.aem.commons.assetshare.util.assetkit.ComponentUpdater; @@ -25,23 +26,29 @@ import org.apache.commons.lang3.StringUtils; import org.apache.sling.api.resource.PersistenceException; import org.apache.sling.api.resource.Resource; +import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Modified; import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; import java.util.Collection; + @Component +@Designate(ocd = BannerComponentUpdaterImpl.Config.class) public class BannerComponentUpdaterImpl implements ComponentUpdater { private static final Logger log = LoggerFactory.getLogger(BannerComponentUpdaterImpl.class); - private static String RESOURCE_TYPE = "asset-share-commons/components/content/image"; - private static String PROPERTY_NAME = "fileReference"; - @Reference private transient AssetKitHelper assetKitHelper; + private Config config; + @Override public String getName() { return "Banner component (Asset Share Commons)"; @@ -54,10 +61,34 @@ public void updateComponent(Page assetKitPage, Resource assetKit) { assets.stream().filter(asset -> StringUtils.equals("banner", StringUtils.lowerCase(asset.getTitle()))).findFirst().ifPresent(asset -> { try { - assetKitHelper.updateComponentOnPage(assetKitPage, RESOURCE_TYPE, PROPERTY_NAME, asset.getPath()); + assetKitHelper.updateComponentOnPage(assetKitPage, config.resource_type(), config.banner_asset_path_property(), asset.getPath()); } catch (PersistenceException | RepositoryException e) { log.error(String.format("Failed to update banner component on page [ %s ]", assetKitPage.getPath()), e); } }); } + + @Activate + @Modified + protected void activate(Config config) { + this.config = config; + } + + @ObjectClassDefinition( + name = "Asset Share Commons - Banner Component Updater", + description = "Component updater that updates an Banner component" + ) + @interface Config { + @AttributeDefinition( + name = "Resource Type", + description = "The resource type of the component to update." + ) + String resource_type() default "asset-share-commons/components/content/image"; + + @AttributeDefinition( + name = "Banner asset property", + description = "The property name that holds the banner asset's path." + ) + String banner_asset_path_property() default "fileReference"; + } } diff --git a/dispatcher/pom.xml b/dispatcher/pom.xml index cb85a975b0..8177f90c16 100644 --- a/dispatcher/pom.xml +++ b/dispatcher/pom.xml @@ -69,25 +69,31 @@ src/conf.d/available_vhosts/default.vhost - 208d20fa45923276fec7794ce866e2bb + d4bc425c3f0ce825450019ce2501e14e md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.d/available_vhosts/default.vhost src/conf.d/dispatcher_vhost.conf - a1ca2281699bde15b5c03bf2c43e365f + 8ee9d3fadcfc0dfb572e62f7579c81dc md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.d/dispatcher_vhost.conf + + src/conf.d/enabled_vhosts/vhosts.conf + 8e9af819b868d93df01b16d3487f3401 + md5 + There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.d/enabled_vhosts/vhosts.conf + src/conf.d/rewrites/default_rewrite.rules - 7d3286b974503e047564069c7f2cfa02 + 1571c99af0456da2186442a5a6a072f1 md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.d/rewrites/default_rewrite.rules src/conf.dispatcher.d/available_farms/default.farm - 12b0159b77ee31d505e5bf0f0425520d + 3d8a01ff3465ac69b229bff6e90ecdeb md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/available_farms/default.farm @@ -99,13 +105,13 @@ src/conf.dispatcher.d/cache/default_rules.any - 106dcd1798262d526f0e209069716c95 + bc9135f627dd2c813373950d7cb71af4 md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/cache/default_rules.any src/conf.dispatcher.d/clientheaders/default_clientheaders.any - 2cd1ad9223489f53783cf24f69b07839 + f7c32e02723296939090f89b36b8e1dd md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/clientheaders/default_clientheaders.any @@ -115,9 +121,15 @@ md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/dispatcher.any + + src/conf.dispatcher.d/enabled_farms/farms.any + 64d45e6fa1c7525a9a34aa4a7ccf0852 + md5 + There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/enabled_farms/farms.any + src/conf.dispatcher.d/filters/default_filters.any - 3add0f3199a0f921d8a066bc82523fab + 8a99566bdabbc11061a6cbaf0f14cecc md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/filters/default_filters.any @@ -133,7 +145,6 @@ md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/virtualhosts/default_virtualhosts.any - @@ -166,67 +177,79 @@ src/conf.d/available_vhosts/default.vhost - 55a5d20e1f6287a0a0a9f09fa4a7b3a8 + d4bc425c3f0ce825450019ce2501e14e md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.d/available_vhosts/default.vhost src/conf.d/dispatcher_vhost.conf - 622f335888f6dd8e17526926adee3f86 + 8ee9d3fadcfc0dfb572e62f7579c81dc md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.d/dispatcher_vhost.conf + + src/conf.d/enabled_vhosts/vhosts.conf + 8e9af819b868d93df01b16d3487f3401 + md5 + There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.d/enabled_vhosts/vhosts.conf + src/conf.d/rewrites/default_rewrite.rules - 09b2ed8cdaa0c73c6ed5b28bc798f899 + 1571c99af0456da2186442a5a6a072f1 md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.d/rewrites/default_rewrite.rules src/conf.dispatcher.d/available_farms/default.farm - 51d036eb1b1c7468af0fb8d62e994ca3 + 3d8a01ff3465ac69b229bff6e90ecdeb md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/available_farms/default.farm src/conf.dispatcher.d/cache/default_invalidate.any - b70b37e34985ad67b07f8b41652c0d57 + 1335157699f9ea9b51f72ab868c7e885 md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/cache/default_invalidate.any src/conf.dispatcher.d/cache/default_rules.any - 21016fc2d528c1ab704174c517d527bd + bc9135f627dd2c813373950d7cb71af4 md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/cache/default_rules.any src/conf.dispatcher.d/clientheaders/default_clientheaders.any - 9eb7325494cdd86941c60c4f06150500 + f7c32e02723296939090f89b36b8e1dd md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/clientheaders/default_clientheaders.any src/conf.dispatcher.d/dispatcher.any - c66f76e1138b98527d9904f23202b3b0 + f452e3f790c96de440dca7d2ae3630a6 md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/dispatcher.any + + src/conf.dispatcher.d/enabled_farms/farms.any + 64d45e6fa1c7525a9a34aa4a7ccf0852 + md5 + There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/enabled_farms/farms.any + src/conf.dispatcher.d/filters/default_filters.any - 9438be649bfa1347e4264d5244b04c7c + 8a99566bdabbc11061a6cbaf0f14cecc md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/filters/default_filters.any src/conf.dispatcher.d/renders/default_renders.any - 3e86b6fc52209d66692667eae51caaa6 + 3c7472f635d35795ec270e7b0b40a07a md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/renders/default_renders.any src/conf.dispatcher.d/virtualhosts/default_virtualhosts.any - 39d92a0a0b11a1a69fe33a791626c7d0 + dd1caafd65a7f5e249fbcdaa0e88ed9e md5 There have been changes detected in a file which is supposed to be immutable according to https://docs.adobe.com/content/help/en/experience-manager-cloud-service/implementing/content-delivery/disp-overview.html#file-structure: src/conf.dispatcher.d/virtualhosts/default_virtualhosts.any diff --git a/dispatcher/src/conf.d/available_vhosts/default.vhost b/dispatcher/src/conf.d/available_vhosts/default.vhost index bcd3c0b5ad..e284b20551 100644 --- a/dispatcher/src/conf.d/available_vhosts/default.vhost +++ b/dispatcher/src/conf.d/available_vhosts/default.vhost @@ -17,6 +17,8 @@ Include conf.d/variables/custom.vars ServerAlias "*" # Use a document root that matches the one in conf.dispatcher.d/default.farm DocumentRoot "${DOCROOT}" + # URI dereferencing algorithm is applied at Sling's level, do not decode parameters here + AllowEncodedSlashes NoDecode # Add header breadcrumbs for help in troubleshooting Header add X-Vhost "publish" @@ -39,8 +41,6 @@ Include conf.d/variables/custom.vars SetOutputFilter DEFLATE # Don't compress images SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary - # Make sure proxies don't deliver the wrong content - Header append Vary User-Agent env=!dont-vary # Prevent clickjacking Header always append X-Frame-Options SAMEORIGIN diff --git a/dispatcher/src/conf.d/dispatcher_vhost.conf b/dispatcher/src/conf.d/dispatcher_vhost.conf index 548daa6f40..7bcd17fad6 100644 --- a/dispatcher/src/conf.d/dispatcher_vhost.conf +++ b/dispatcher/src/conf.d/dispatcher_vhost.conf @@ -10,6 +10,50 @@ ServerName dispatcher Include conf.d/variables/default.vars Include conf.d/variables/global.vars + +# WARNING!!! The probe paths below are INTERNAL and RESERVED - please DO NOT USE them in your virtual host configurations! + +# Liveness probe URL +Alias "/system/probes/live" probes/live-status.json +# Readiness probe URL +Alias "/system/probes/ready" probes/ready-status.json +# Startup probe URL +Alias "/system/probes/start" probes/startup-status.json + +# internal probes endpoint + + RewriteEngine Off + + + + SetHandler default-handler + AllowOverride None + Require all granted + + + +#SKYOPS-13837: Proxy static frontend code requests through dispatcher + + SSLProxyEngine on + + RewriteRule "^/mnt/var/www/html/libs/cq/frontend-static(/[^\.].*)$" "%{env:FRONTEND_URI_PREFIX}$1?%{env:FRONTEND_URI_SUFFIX}" [P,L] + + + +# CQ-4315090: Allow the functional replication to access publish instance directly for dev and stage environments + + + ProxyPassMatch http://${AEM_HOST}:${AEM_PORT} + RewriteEngine Off + + + + + ProxyPassMatch http://${AEM_HOST}:${AEM_PORT} + RewriteEngine Off + + + # If the module loads correctly then apply base settings for the module # location of the configuration file. eg: 'conf/dispatcher.any' @@ -34,15 +78,143 @@ Include conf.d/variables/global.vars # If set to a string of error numbers it will only hand off those errors to apache to handle # DispatcherPassError 403,404 # DispatcherPassError 1 - - - # Expire text/html after this many seconds - ExpiresActive On - ExpiresByType text/html A${EXPIRATION_TIME} + # Setting to replace the Host header with the value of X-Forwarded-Host + # + # Possible values are: Off, On or a file name, containing the edge key to expect + # Default: Off + DispatcherUseForwardedHost ${FORWARDED_HOST_SETTING} + + # When enabled it removes Cache-Control headers set by mod_expires to unchacheable content + DispatcherRestrictUncacheableContent On -# Include all *.vhost files in enabled_vhosts + + + # Expire text/html after this many seconds + ExpiresActive On + ExpiresByType text/html A${EXPIRATION_TIME} + + Header unset Age + + +# Legacy /systemready mapped to new Health probe URL /system/probes/health in AEM + + ProxyPass http://${AEM_HOST}:${AEM_PORT}/system/probes/health + RewriteEngine Off + + +# Allow ingressroute checks through on /system/probes/health (regardless of dispatcher filters) + + ProxyPass http://${AEM_HOST}:${AEM_PORT}/system/probes/health + RewriteEngine Off + + +# Allow access to CRXDE on dev environment + + + ProxyPassMatch http://${AEM_HOST}:${AEM_PORT} + RewriteEngine Off + + + +# CQ-4287185: Allow access to magento reverse-proxy endpoint + + SSLProxyEngine on + # CIF-2557 add ProxyRemote to tunnel reverse-proxy traffic through egress proxy if available + + ProxyRemote ${COMMERCE_ENDPOINT} "http://${AEM_HTTP_PROXY_HOST}:${AEM_HTTP_PROXY_PORT}" + + + # Use an empty back reference from ProxyPassMatch to the LocationMatch regex to prevent the + # original URL being appended to the proxy request + ProxyPassMatch ${COMMERCE_ENDPOINT}$2 + ProxyPassReverse ${COMMERCE_ENDPOINT} + RewriteEngine Off + # CIF-2971: Experience Platform Connector cookie to header forwarding + SetEnvIfNoCase Cookie "(^| )aep-segments-membership=([^;]*)" AEP_SEGMENTS_MEMBERSHIP=$2 + RequestHeader set aep-segments-membership "%{AEP_SEGMENTS_MEMBERSHIP}e" env=AEP_SEGMENTS_MEMBERSHIP + + + + SSLProxyEngine on + + ProxyRemote ${AEM_COMMERCE_ENDPOINT_2} "http://${AEM_HTTP_PROXY_HOST}:${AEM_HTTP_PROXY_PORT}" + + + ProxyPassMatch ${AEM_COMMERCE_ENDPOINT_2}$2 + ProxyPassReverse ${AEM_COMMERCE_ENDPOINT_2} + RewriteEngine Off + SetEnvIfNoCase Cookie "(^| )aep-segments-membership=([^;]*)" AEP_SEGMENTS_MEMBERSHIP=$2 + RequestHeader set aep-segments-membership "%{AEP_SEGMENTS_MEMBERSHIP}e" env=AEP_SEGMENTS_MEMBERSHIP + + + + SSLProxyEngine on + + ProxyRemote ${AEM_COMMERCE_ENDPOINT_3} "http://${AEM_HTTP_PROXY_HOST}:${AEM_HTTP_PROXY_PORT}" + + + ProxyPassMatch ${AEM_COMMERCE_ENDPOINT_3}$2 + ProxyPassReverse ${AEM_COMMERCE_ENDPOINT_3} + RewriteEngine Off + SetEnvIfNoCase Cookie "(^| )aep-segments-membership=([^;]*)" AEP_SEGMENTS_MEMBERSHIP=$2 + RequestHeader set aep-segments-membership "%{AEP_SEGMENTS_MEMBERSHIP}e" env=AEP_SEGMENTS_MEMBERSHIP + + + + SSLProxyEngine on + + ProxyRemote ${AEM_COMMERCE_ENDPOINT_4} "http://${AEM_HTTP_PROXY_HOST}:${AEM_HTTP_PROXY_PORT}" + + + ProxyPassMatch ${AEM_COMMERCE_ENDPOINT_4}$2 + ProxyPassReverse ${AEM_COMMERCE_ENDPOINT_4} + RewriteEngine Off + SetEnvIfNoCase Cookie "(^| )aep-segments-membership=([^;]*)" AEP_SEGMENTS_MEMBERSHIP=$2 + RequestHeader set aep-segments-membership "%{AEP_SEGMENTS_MEMBERSHIP}e" env=AEP_SEGMENTS_MEMBERSHIP + + + + SSLProxyEngine on + + ProxyRemote ${AEM_COMMERCE_ENDPOINT_5} "http://${AEM_HTTP_PROXY_HOST}:${AEM_HTTP_PROXY_PORT}" + + + ProxyPassMatch ${AEM_COMMERCE_ENDPOINT_5}$2 + ProxyPassReverse ${AEM_COMMERCE_ENDPOINT_5} + RewriteEngine Off + SetEnvIfNoCase Cookie "(^| )aep-segments-membership=([^;]*)" AEP_SEGMENTS_MEMBERSHIP=$2 + RequestHeader set aep-segments-membership "%{AEP_SEGMENTS_MEMBERSHIP}e" env=AEP_SEGMENTS_MEMBERSHIP + + + +# ASSETS-10359 Prevent rewrites and filtering of Delivery API URLs + + ProxyPassMatch http://${AEM_HOST}:${AEM_PORT} + RewriteEngine Off + + +# Disable access to default CGI scripts + + AllowOverride None + Options None + Require all denied + + +# internal metadata endpoint +Alias "/gitinit-status" metadata/gitinit-status.json + + + RewriteEngine Off + + + + SetHandler default-handler + AllowOverride None + Require expr "%{HTTP_HOST} == '${POD_NAME}'" + + Include conf.d/enabled_vhosts/*.vhost # Create a catch-all vhost diff --git a/dispatcher/src/conf.d/enabled_vhosts/vhosts.conf b/dispatcher/src/conf.d/enabled_vhosts/vhosts.conf new file mode 100644 index 0000000000..0b2fdb47d5 --- /dev/null +++ b/dispatcher/src/conf.d/enabled_vhosts/vhosts.conf @@ -0,0 +1,2 @@ +## Include all of the customers *.vhost files +Include conf.d/enabled_vhosts/*.vhost diff --git a/dispatcher/src/conf.d/rewrites/default_rewrite.rules b/dispatcher/src/conf.d/rewrites/default_rewrite.rules index c300b52a38..f62be1bb42 100644 --- a/dispatcher/src/conf.d/rewrites/default_rewrite.rules +++ b/dispatcher/src/conf.d/rewrites/default_rewrite.rules @@ -24,6 +24,7 @@ # Prevent X-FORWARDED-FOR spoofing RewriteCond %{HTTP:X-Forwarded-For} !^$ RewriteCond %{HTTP:X-Forwarded-For} !^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} +RewriteCond %{HTTP:X-Forwarded-For} !^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])) RewriteRule .* - [F] # Uncomment to force HSTS protection @@ -36,3 +37,7 @@ RewriteRule .* - [F] # Block wp-login RewriteRule ^.*wp-login - [F,NC,L] + +# Allow the dispatcher to be able to cache persisted queries - they need an extension for the cache file +RewriteCond %{REQUEST_URI} ^/graphql/execute.json +RewriteRule ^/(.*)$ /$1;.json [PT] \ No newline at end of file diff --git a/dispatcher/src/conf.dispatcher.d/available_farms/default.farm b/dispatcher/src/conf.dispatcher.d/available_farms/default.farm index 46d91a4ef0..a6bfbeeaf4 100644 --- a/dispatcher/src/conf.dispatcher.d/available_farms/default.farm +++ b/dispatcher/src/conf.dispatcher.d/available_farms/default.farm @@ -74,6 +74,12 @@ /glob "*.html" /type "allow" } + # to ensure that AEM forms HTMLs are not auto-invalidated due to invalidation of any other resource. It is supposed to be deleted only after its own activation. + /0002 + { + /glob "/content/forms/**/*.html" + /type "deny" + } } /allowedClients { $include "../cache/default_invalidate.any" @@ -81,10 +87,14 @@ # The ignoreUrlParams section contains query string parameter names that # should be ignored when determining whether some request's output can be # cached or delivered from cache. - # In this example configuration, the "q" parameter will be ignored. + # In this example configuration, the "q" parameter will be ignored as + # well as general marketing related parameters such as e.g. utm_campaign. + # Marketing parameters can normally be ignored on most websites as they are tracked + # through different means. # /ignoreUrlParams { - # /0001 { /glob "*" /type "deny" } - # /0002 { /glob "q" /type "allow" } + # /0001 { /glob "*" /type "deny" } + # /0002 { /glob "q" /type "allow" } + # $include "../cache/marketing_query_parameters.any" # } # Cache response headers next to a cached file. On the first request to diff --git a/dispatcher/src/conf.dispatcher.d/cache/default_rules.any b/dispatcher/src/conf.dispatcher.d/cache/default_rules.any index cda3557e59..f51d675722 100644 --- a/dispatcher/src/conf.dispatcher.d/cache/default_rules.any +++ b/dispatcher/src/conf.dispatcher.d/cache/default_rules.any @@ -18,3 +18,23 @@ /glob "*" /type "allow" } +# Don't cache csrf login tokens +/0001 { + /glob "/libs/granite/csrf/token.json" + /type "deny" +} + +# AEM Screens cache rules +# Do not cache Screens channels json +/0010 { + /glob "/content/screens/svc.channels.json" + /type "deny" +} +/0011 { + /glob "/content/screens/svc/channels.channels.json" + /type "deny" +} +/0012 { + /glob "/screens/channels.json" + /type "deny" +} diff --git a/dispatcher/src/conf.dispatcher.d/clientheaders/default_clientheaders.any b/dispatcher/src/conf.dispatcher.d/clientheaders/default_clientheaders.any index a7b8cf5382..077a43f81b 100644 --- a/dispatcher/src/conf.dispatcher.d/clientheaders/default_clientheaders.any +++ b/dispatcher/src/conf.dispatcher.d/clientheaders/default_clientheaders.any @@ -39,3 +39,6 @@ "destination" "Sling-uploadmode" "x-requested-with" +"If-Modified-Since" +"Authorization" +"x-request-id" diff --git a/dispatcher/src/conf.dispatcher.d/enabled_farms/z_asset-share-commons.farm b/dispatcher/src/conf.dispatcher.d/enabled_farms/asset-share-commons.farm similarity index 100% rename from dispatcher/src/conf.dispatcher.d/enabled_farms/z_asset-share-commons.farm rename to dispatcher/src/conf.dispatcher.d/enabled_farms/asset-share-commons.farm diff --git a/dispatcher/src/conf.dispatcher.d/enabled_farms/farms.any b/dispatcher/src/conf.dispatcher.d/enabled_farms/farms.any new file mode 100644 index 0000000000..8daf6344be --- /dev/null +++ b/dispatcher/src/conf.dispatcher.d/enabled_farms/farms.any @@ -0,0 +1,2 @@ +## Include all of the customers *.farm files +$include "./*.farm" diff --git a/dispatcher/src/conf.dispatcher.d/filters/default_filters.any b/dispatcher/src/conf.dispatcher.d/filters/default_filters.any index 0fbf1c251a..825ca64717 100644 --- a/dispatcher/src/conf.dispatcher.d/filters/default_filters.any +++ b/dispatcher/src/conf.dispatcher.d/filters/default_filters.any @@ -19,7 +19,7 @@ # /005 { /type "allow" /url "/bin/*" } # allow bin path access # This rule allows content to be access -/0010 { /type "allow" /extension '(css|eot|gif|ico|jpeg|jpg|js|gif|pdf|png|svg|swf|ttf|woff|woff2|html)' /path "/content/*" } # disable this rule to allow mapped content only +/0010 { /type "allow" /extension '(css|eot|gif|ico|jpeg|jpg|js|gif|pdf|png|svg|swf|ttf|woff|woff2|html|mp4|mov|m4v)' /path "/content/*" } # disable this rule to allow mapped content only # Enable specific mime types in non-public content directories /0011 { /type "allow" /method "GET" /extension '(css|eot|gif|ico|jpeg|jpg|js|gif|png|svg|swf|ttf|woff|woff2)' } @@ -46,3 +46,55 @@ # Allow index page /0030 { /type "allow" /url "/index.html" } + +# Allow IMS Authentication +/0031 { /type "allow" /method "GET" /url "/callback/j_security_check" } + +# AEM Forms specific filters +# to allow AF specific endpoints for prefill, submit and sign +/0032 { /type "allow" /path "/content/forms/af/*" /method "POST" /selectors '(submit|internalsubmit|agreement|signSubmit|prefilldata|save|analyticsconfigparser)' /extension '(jsp|json)' } + +# to allow AF specific endpoints for thank you page +/0033 { /type "allow" /path "/content/forms/af/*" /method "GET" /selectors '(guideThankYouPage|guideAsyncThankYouPage)' /extension '(html)'} + +# to allow AF specific endpoints for lazy loading +/0034 { /type "allow" /path "/content/forms/af/*" /method "GET" /extension '(jsonhtmlemitter)'} + +# to allow fp related functionalities +/0035 { /type "allow" /path "/content/forms/*" /selectors '(fp|attach|draft|dor|api)' /extension '(html|jsp|json|pdf)' } + +# to allow forms access via dam path +/0036 { /type "allow" /path "/content/dam/formsanddocuments/**/jcr:content" /method "GET"} + +# to allow invoke service functionality (FDM) +/0037 { /type "allow" /path "/content/forms/*" /selectors '(af)' /extension '(dermis)' } + +# to allow forms portal draft and submissions component operation servlet +/0038 { /type "allow" /path "/content/*" /method "GET" /selectors '(fp)' /extension '(operation)' } + +# AEM Screens Filters +# to allow AEM Screens channels selectors +/0050 { /type "allow" /method "GET" /url "/screens/channels.json" } + +# to allow AEM Screens Content and selectors +/0051 { /type "allow" /method '(GET|HEAD)' /url "/content/screens/*" } + +# AEM Sites Filters +# to allow site30 theme servlet +/0052 { /type "allow" /extension "theme" /path "/content/*" } + +# Allow manifest.webmanifest files located in the content +/0053 { /type "allow" /extension "webmanifest" /path "/content/*/manifest" } + +# Allow Apache Sling Sitemap selectors: sitemap, sitemap-index, sitemap.any-nested-or-named-sitemap +/0054 { /type "allow" /method "GET" /path "/content/*" /selectors 'sitemap(-index)?' /extension "xml" } + +# Allow GraphQL & preflight requests +# GraphQL also supports "GET" requests, if you intend to use "GET" add a rule in filters.any +/0060 { /type "allow" /method '(POST|OPTIONS)' /url "/content/_cq_graphql/*/endpoint.json" } + +# GraphQL Persisted Queries & preflight requests +/0061 { /type "allow" /method '(GET|POST|OPTIONS)' /url "/graphql/execute.json*" } + +# Allow Forms Document Services requests +/0062 { /type "allow" /method '(GET|POST)' /url "/adobe/forms/*" } diff --git a/pom.xml b/pom.xml index 5136b0eec3..bdbd0ecac8 100644 --- a/pom.xml +++ b/pom.xml @@ -192,7 +192,8 @@ org.apache.maven.plugins maven-assembly-plugin - 3.4.1 + + 3.1.1 diff --git a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/asset-kit.html b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/asset-kit.html index 4e20d1e452..a591786af0 100644 --- a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/asset-kit.html +++ b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/asset-kit.html @@ -30,8 +30,6 @@
${asset.properties['type']}
${asset.name}

${asset.title}

- - @@ -45,25 +43,22 @@ - - - - + diff --git a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/.content.xml b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/.content.xml index 770f4b3db9..27afb1b1cc 100644 --- a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/.content.xml +++ b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/.content.xml @@ -21,5 +21,5 @@ jcr:primaryType="cq:ClientLibraryFolder" allowProxy="{Boolean}true" jsProcessor="[min:gcc,default:none]" - categories="[asset-share-commons.site.components.asset-kit]" + categories="[asset-share-commons.semantic-ui-light,asset-share-commons.site.components.asset-kit]" dependencies="[]"/> diff --git a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/js/asset-kit.js b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/js/asset-kit.js new file mode 100644 index 0000000000..26b6b9129f --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/js/asset-kit.js @@ -0,0 +1,17 @@ +/* + * Asset Share Commons + * + * Copyright [2017] Adobe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/less/asset-kit.less b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/less/asset-kit.less index 3dde37fa4a..dd106b9e67 100644 --- a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/less/asset-kit.less +++ b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/components/asset-kit/clientlibs/site/less/asset-kit.less @@ -1,7 +1,7 @@ /* * Asset Share Commons * - * Copyright [2017] Adobe + * Copyright [2023] Adobe * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,18 @@ * limitations under the License. */ + /* + + This CSS is largely for demonstration purposes. + Typically custom CSS that aligns with brand would be used. + + */ + .basicpage { max-width: 1200px; margin: 0 auto; } - .cmp-asset-kit { .cmp-asset-kit__assets-kit-size { diff --git a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/workflow/asset-kit/asset-kit-creator/.content.xml b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/workflow/asset-kit/asset-kit-creator/.content.xml index 62921d57f4..6fbbc546ad 100644 --- a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/workflow/asset-kit/asset-kit-creator/.content.xml +++ b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/workflow/asset-kit/asset-kit-creator/.content.xml @@ -20,7 +20,7 @@ diff --git a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/workflow/asset-kit/asset-kit-replicator/_cq_editConfig.xml b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/workflow/asset-kit/asset-kit-replicator/_cq_editConfig.xml index 2590853984..7f0997386f 100644 --- a/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/workflow/asset-kit/asset-kit-replicator/_cq_editConfig.xml +++ b/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/workflow/asset-kit/asset-kit-replicator/_cq_editConfig.xml @@ -24,7 +24,7 @@