<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Security Archives - Sourced Code</title>
	<atom:link href="https://sourcedcode.com/blog/category/aem/security/feed" rel="self" type="application/rss+xml" />
	<link>https://sourcedcode.com</link>
	<description>AEM Blog Made Just for You.</description>
	<lastBuildDate>Sun, 29 Jan 2023 23:40:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.8</generator>

<image>
	<url>https://sourcedcode.com/wp-content/uploads/2019/09/cropped-favicon-32x32.png</url>
	<title>Security Archives - Sourced Code</title>
	<link>https://sourcedcode.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>resourceResolverFactory.getAdministrativeResourceResolver(null) WhiteList Bundle for Administrative Login</title>
		<link>https://sourcedcode.com/blog/aem/whitelist-bundle-for-administrative-login</link>
					<comments>https://sourcedcode.com/blog/aem/whitelist-bundle-for-administrative-login#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Thu, 17 Nov 2022 02:18:06 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=4076</guid>

					<description><![CDATA[<p>When working for organizations with the goal of migrating from AEM 6X to 6.5 or to AEM Cloud as a Service. It&#8217;s very common that the AEM backend code still utilizes the deprecated resourceResolverFactory.getAdministrativeResourceResolver(null) @depricated API. This method has been deprecated as of 2.4 (bundle version 2.5.0) because of inherent security issues. Services requiring specific [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/whitelist-bundle-for-administrative-login">resourceResolverFactory.getAdministrativeResourceResolver(null) WhiteList Bundle for Administrative Login</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>When working for organizations with the goal of migrating from AEM 6X to 6.5 or to AEM Cloud as a Service. It&#8217;s very common that the AEM backend code still utilizes the deprecated resourceResolverFactory.getAdministrativeResourceResolver(null) <a href="https://sling.apache.org/apidocs/sling12/org/apache/sling/api/resource/ResourceResolverFactory.html#getAdministrativeResourceResolver-java.util.Map-" rel="noopener" target="_blank">@depricated API</a>. This method has been deprecated as of 2.4 (bundle version 2.5.0) because of inherent security issues. Services requiring specific permissions should use the getServiceResourceResolver(), AEM service users <a href="https://experienceleague.adobe.com/docs/experience-manager-64/administering/security/security-service-users.html?lang=en" rel="noopener" target="_blank">instead</a>.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#40;</span>ResourceResolver resolver <span style="color: #339933;">=</span> resourceResolverFactory.<span style="color: #006633;">getAdministrativeResourceResolver</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// do something</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>LoginException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>In the later versions of AEM, from the default AEM environment configurations, it has disabled the use of resourceResolverFactory.getAdministrativeResourceResolver(null) because of inherent security issues and has disabled the API. Without any configurations made on AEM, the AEM environment will causes the API call to not work as expected, and the resourceResolverFactory.getAdministrativeResourceResolver(null) returns as a null object. </p>
<hr class="spacer-large"/>
<h2>Solving the Issue</h2>
<p>During times of rapid development, developers are not positions to refactor the deprecated API. That&#8217;s okay. AEM provides configuration to re-enable this disabled feature as a temporary solution for the environment to allow the deprecated API. You have two options.</p>
<div class="mention-block">
<strong>Quick Links</strong></p>
<ol>
<li><a href="#apache-sling-login-admin-whitelist">Apache Sling Login Admin Whitelist</a></li>
<li><a href="#apache-sling-login-admin-whitelist-configuration-fragment">Apache Sling Login Admin Whitelist Configuration Fragment</a></li>
</ol>
</div>
<hr class="spacer-large"/>
<h3 id="apache-sling-login-admin-whitelist">1. Apache Sling Login Admin Whitelist</h3>
<p><a href="http://localhost:4502/system/console/configMgr/org.apache.sling.jcr.base.internal.LoginAdminWhitelist" rel="noopener" target="_blank">Visit http://localhost:4502/system/console/configMgr/org.apache.sling.jcr.base.internal.LoginAdminWhitelist</a><br />
<a href="https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist.png"><img decoding="async" src="https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist.png" alt="" width="300px" class="alignnone size-full wp-image-4078" srcset="https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist.png 1925w, https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-300x218.png 300w, https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-1024x746.png 1024w, https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-768x559.png 768w, https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-1536x1119.png 1536w, https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-600x437.png 600w" sizes="(max-width: 1925px) 100vw, 1925px" /></a><br />
<strong>whitelist.bypass</strong>: {Boolean} if true, by default all the bundles will be allowed to use getAdministrativeResourceResolver() deprecated API.<br />
<strong>whitelist.bundles.regexp</strong>: Regular expression for bundle symbolic names for which loginAdministrative() is allowed. NOT recommended for production use, but useful for testing with generated bundles.</p>
<hr class="spacer-large"/>
<h3 id="apache-sling-login-admin-whitelist-configuration-fragment">2. Apache Sling Login Admin Whitelist Configuration Fragment</h3>
<p><a href="http://localhost:4502/system/console/configMgr/org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment" rel="noopener" target="_blank">http://localhost:4502/system/console/configMgr/org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment</a><br />
<a href="https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-configuration-fragment.png"><img decoding="async" src="https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-configuration-fragment.png" alt="" width="300px" class="alignnone size-full wp-image-4077" srcset="https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-configuration-fragment.png 1901w, https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-configuration-fragment-300x221.png 300w, https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-configuration-fragment-1024x755.png 1024w, https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-configuration-fragment-768x566.png 768w, https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-configuration-fragment-1536x1133.png 1536w, https://sourcedcode.com/wp-content/uploads/2022/11/apache-sling-login-admin-whitelist-configuration-fragment-600x443.png 600w" sizes="(max-width: 1901px) 100vw, 1901px" /></a><br />
<strong>whitelist.name</strong>: Optional name to disambiguate configurations.<br />
<strong>whitelist.bundles</strong>: A list of bundle symbolic names allowed to use loginAdministrative().</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/whitelist-bundle-for-administrative-login">resourceResolverFactory.getAdministrativeResourceResolver(null) WhiteList Bundle for Administrative Login</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/whitelist-bundle-for-administrative-login/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to get Authorization: Basic Auth Header from AEM Author</title>
		<link>https://sourcedcode.com/blog/aem/how-to-get-authorization-basic-auth-header-from-aem-author</link>
					<comments>https://sourcedcode.com/blog/aem/how-to-get-authorization-basic-auth-header-from-aem-author#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Tue, 29 Jun 2021 23:35:03 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=2905</guid>

					<description><![CDATA[<p>Getting the Authorization (Basic access authentication) Basic Auth Header from AEM Author is simple. If you have curl installed on your machine, simply run the command below, and you should be able to get the Authorization header from a successful AEM login. What we are doing here is logging into the AEM author with curl [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-get-authorization-basic-auth-header-from-aem-author">How to get Authorization: Basic Auth Header from AEM Author</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Getting the Authorization (Basic access authentication) Basic Auth Header from AEM Author is simple. If you have <a href="https://curl.se" title="curl website" rel="nofollow noopener" target="_blank">curl</a> installed on your machine, simply run the command below, and you should be able to get the Authorization header from a successful AEM login.</p>
<p>What we are doing here is logging into the AEM author with curl using -v (verbose) &#038; -u (user:pass).</p>
<p><b>curl request:</b></p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">curl <span style="color: #339933;">-</span>v <span style="color: #339933;">-</span>u admin<span style="color: #339933;">:</span>admin http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//localhost:4502</span></div></td></tr></tbody></table></div>
<p><b>curl response (line::8):</b></p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #339933;">*</span> Rebuilt <span style="color: #003399;">URL</span> to<span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//localhost:4502/</span><br />
<span style="color: #339933;">*</span> &nbsp; Trying <span style="color: #339933;">::</span><span style="color: #cc66cc;">1</span>...<br />
<span style="color: #339933;">*</span> TCP_NODELAY set<br />
<span style="color: #339933;">*</span> Connected to localhost <span style="color: #009900;">&#40;</span><span style="color: #339933;">::</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> port <span style="color: #cc66cc;">4502</span> <span style="color: #009900;">&#40;</span>#<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #339933;">*</span> Server auth using Basic with user <span style="color: #0000ff;">'admin'</span><br />
<span style="color: #339933;">&gt;</span> GET <span style="color: #339933;">/</span> HTTP<span style="color: #339933;">/</span><span style="color: #cc66cc;">1.1</span><br />
<span style="color: #339933;">&gt;</span> Host<span style="color: #339933;">:</span> localhost<span style="color: #339933;">:</span><span style="color: #cc66cc;">4502</span><br />
<span style="color: #339933;">&gt;</span> Authorization<span style="color: #339933;">:</span> Basic YWRtaW46YWRtaW4<span style="color: #339933;">=</span><br />
<span style="color: #339933;">&gt;</span> User<span style="color: #339933;">-</span>Agent<span style="color: #339933;">:</span> curl<span style="color: #339933;">/</span>7.54.0<br />
<span style="color: #339933;">&gt;</span> Accept<span style="color: #339933;">:</span> <span style="color: #339933;">*</span><span style="color: #666666; font-style: italic;">/*<br />
&gt; <br />
&lt; HTTP/1.1 302 Found<br />
&lt; Location: /index.html<br />
&lt; Transfer-Encoding: chunked<br />
&lt; <br />
* Connection #0 to host localhost left intact</span></div></td></tr></tbody></table></div>
<p><b>Authorization Basic:</b></p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">Authorization<span style="color: #339933;">:</span> Basic YWRtaW46YWRtaW4<span style="color: #339933;">=</span></div></td></tr></tbody></table></div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-get-authorization-basic-auth-header-from-aem-author">How to get Authorization: Basic Auth Header from AEM Author</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/how-to-get-authorization-basic-auth-header-from-aem-author/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sugar Coat Registered AEM Servlet Scripts and Paths Endpoint</title>
		<link>https://sourcedcode.com/blog/aem/sugar-coating-servlet-scripts-and-paths</link>
					<comments>https://sourcedcode.com/blog/aem/sugar-coating-servlet-scripts-and-paths#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Mon, 02 Dec 2019 21:08:21 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=1037</guid>

					<description><![CDATA[<p>In AEM we tend to write Sling Servlet OSGI Services to expose JSON data using the various service reference properties such as &#8220;sling.servlet.paths&#8221;, &#8220;sling.servlet.resourceTypes&#8221;, &#8220;sling.servlet.selectors&#8221;, and &#8220;sling.servlet.extensions&#8221;. Example 1: DirectoriesServlet.Java doGet Servlet Implementation (html extension): This is an example how a servlet in AEM to retrieve the directories JSON data. 1234567891011121314151617// example for /content/mysite.directories.html @SlingServlet&#40; [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/sugar-coating-servlet-scripts-and-paths">Sugar Coat Registered AEM Servlet Scripts and Paths Endpoint</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In AEM we tend to write Sling Servlet OSGI Services to expose JSON data using the various service reference properties such as &#8220;sling.servlet.paths&#8221;, &#8220;sling.servlet.resourceTypes&#8221;, &#8220;sling.servlet.selectors&#8221;, and &#8220;sling.servlet.extensions&#8221;. </p>
<p><strong>Example 1: DirectoriesServlet.Java doGet Servlet Implementation (html extension):</strong><br />
This is an example how a servlet in AEM to retrieve the directories JSON data.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #666666; font-style: italic;">// example for /content/mysite.directories.html</span><br />
@SlingServlet<span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; resourceTypes <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/apps/mysite/components/page/basepage&quot;</span>,<br />
&nbsp; &nbsp; selectors <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;directory&quot;</span>,<br />
&nbsp; &nbsp; extensions <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;html&quot;</span>,<br />
&nbsp; &nbsp; methods <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;GET&quot;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyServlet <span style="color: #000000; font-weight: bold;">extends</span> SlingSafeMethodsServlet <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>SlingHttpServletRequest request, SlingHttpServletResponse response<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ServletException, <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setStatus</span><span style="color: #009900;">&#40;</span>HttpStatus.<span style="color: #006633;">OK_200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setContentType</span><span style="color: #009900;">&#40;</span>APPLICATION_JSON_UTF8<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setHeader</span><span style="color: #009900;">&#40;</span>HttpHeaders.<span style="color: #006633;">EXPIRES</span>, EXPIRE_IN_SECONDS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setHeader</span><span style="color: #009900;">&#40;</span>HttpHeaders.<span style="color: #006633;">CACHE_CONTROL</span>, <span style="color: #0000ff;">&quot;max-age=&quot;</span> <span style="color: #339933;">+</span> EXPIRE_IN_SECONDS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> json <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ObjectMapper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">writeValueAsString</span><span style="color: #009900;">&#40;</span>getDirectories<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>json<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p><strong>Example 2: StoresServlet.Java doGet Servlet Implementation (json extension):</strong><br />
This is an example how a servlet in AEM to retrieve the stores JSON data.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #666666; font-style: italic;">// example for /content/mysite.stores.json</span><br />
@SlingServlet<span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; resourceTypes <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/apps/mysite/components/page/basepage&quot;</span>,<br />
&nbsp; &nbsp; selectors <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;stores&quot;</span>,<br />
&nbsp; &nbsp; extensions <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;json&quot;</span>,<br />
&nbsp; &nbsp; methods <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;GET&quot;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyServlet <span style="color: #000000; font-weight: bold;">extends</span> SlingSafeMethodsServlet <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>SlingHttpServletRequest request, SlingHttpServletResponse response<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ServletException, <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setStatus</span><span style="color: #009900;">&#40;</span>HttpStatus.<span style="color: #006633;">OK_200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setContentType</span><span style="color: #009900;">&#40;</span>APPLICATION_JSON_UTF8<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setHeader</span><span style="color: #009900;">&#40;</span>HttpHeaders.<span style="color: #006633;">EXPIRES</span>, EXPIRE_IN_SECONDS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setHeader</span><span style="color: #009900;">&#40;</span>HttpHeaders.<span style="color: #006633;">CACHE_CONTROL</span>, <span style="color: #0000ff;">&quot;max-age=&quot;</span> <span style="color: #339933;">+</span> EXPIRE_IN_SECONDS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> json <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ObjectMapper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">writeValueAsString</span><span style="color: #009900;">&#40;</span>getStores<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>json<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p><strong>JSON Request:</strong><br />
Typically, multi-channel implementations such as mobile, smartwatches, kiosks, 3rd party websites, etc&#8230; will be requesting for JSON data with the path of:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">/content/mysite.directories.html<br />
/content/mysite.stores.json</div></td></tr></tbody></table></div>
<p>As you can tell, the path stated above looks unfinished. In such, Sling Servlet Resolver scripts/paths may not be acceptable to present to the end-users. Revealing custom selectors or custom extensions are not suitable for security reasons and detailed information exposure; this can be easily resolved. We can add a layer of security, and also sugar-coat the revealed scripts/paths by utilising the Apache Web Server&#8217;s Rewrite Flag, PT, as one of the many good practises to follow.</p>
<h3>What is the Apache Web Server&#8217;s Rewrite Flag, PT</h3>
<p>The [PT] flag causes the result of the RewriteRule to be passed back through URL mapping as an Alias. Simply the end-users will only see an alias of the JSON file while the request is internally mapped to the correct path to the AEM publisher.</p>
<h4>Examples of PT:</h4>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">RewriteRule ^<span style="color: #66cc66;">/</span>api<span style="color: #66cc66;">/</span>directories.json$ <span style="color: #66cc66;">/</span><span style="color: #000066;">content</span><span style="color: #66cc66;">/</span>mysite.directories.html <span style="color: #66cc66;">&#91;</span>PT,L<span style="color: #66cc66;">&#93;</span><br />
RewriteRule ^<span style="color: #66cc66;">/</span>api<span style="color: #66cc66;">/</span>stores.json$ <span style="color: #66cc66;">/</span><span style="color: #000066;">content</span><span style="color: #66cc66;">/</span>mysite.stores.json <span style="color: #66cc66;">&#91;</span>PT,L<span style="color: #66cc66;">&#93;</span></div></td></tr></tbody></table></div>
<p>Finally, after the Rewrite rule has been set up, multi-channel implementations can request for the JSON with this path:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #66cc66;">/</span>api<span style="color: #66cc66;">/</span>directories.json<br />
<span style="color: #66cc66;">/</span>api<span style="color: #66cc66;">/</span>stores.json</div></td></tr></tbody></table></div>
<div class="mention-block">
In summary, this is a standard way to secure your Servlets in AEM, and also to sugar-coat an AEM site&#8217;s Sling Servlet Resolver scripts/paths.</p>
<p><strong>Also, do remember to add caching strategies for optimize the load against your AEM production publish instances.</strong>
</div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/sugar-coating-servlet-scripts-and-paths">Sugar Coat Registered AEM Servlet Scripts and Paths Endpoint</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/sugar-coating-servlet-scripts-and-paths/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>What is the AEM Apache Sling Referrer Filter OSGI configuration?</title>
		<link>https://sourcedcode.com/blog/aem/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration</link>
					<comments>https://sourcedcode.com/blog/aem/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sun, 01 Apr 2018 14:09:51 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">http://sourcedcode.com/?p=53</guid>

					<description><![CDATA[<p>AEM &#8220;referrer not allowed&#8221; Out of the box, AEM denies all server names or hosts to make HTTP request to the respective running AEM publish/author instance. During a HTTP request made to the AEM publish/author, AEM checks the Referrer header configuration. If the referrer configured to allow the host(s), then AEM will full-fill the request, [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration">What is the AEM Apache Sling Referrer Filter OSGI configuration?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p style="color:red; text-align:center;">AEM &#8220;referrer not allowed&#8221;</p>
<p>Out of the box, AEM denies all server names or hosts to make HTTP request to the respective running AEM publish/author instance. During a HTTP request made to the AEM publish/author, AEM checks the Referrer header configuration. If the referrer configured to allow the host(s), then AEM will full-fill the request, and if not, the AEM &#8220;referrer not allowed&#8221; error message will be shown.</p>
<p>Take an example of an AEM application exposes an servlet that exposes the endpoint of &#8220;/bin/stores.js&#8221;. This endpoint will return an array of store detail JSON objects. This feature will be reusable, so throughout the AEM application, on many occasions, the endpoint is being used to render HTML elements to the page using javascript. Now take an example of a microsite within the same organisation of <u>m.site.com</u> (mobile site) where it would like to consume &#8220;/bin/stores.js&#8221;. When the micro-site make a HTTP GET request on &#8220;/bin/stores.js&#8221;, you will get the AEM &#8220;referrer not allowed&#8221; error because the host (or m.site.com) referrer is not allowed; we must allow m.site.com in the Apache Sling Referrer Filter settings.</p>
<hr class="spacer-large"/>
<div class="mention-block"><b>What is an &#8220;HTTP Referrer header&#8221;?</b> The HTTP Referrer header identifies the address of the webpage who&#8217;s making a request. We can use this information to allow specific hosts to fulfill the HTTP request.<br />
    <br />Read More: <a href="https://en.wikipedia.org/wiki/HTTP_referer" rel="noopener noreferrer" target="_blank">https://en.wikipedia.org/wiki/HTTP_referer</a></div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="8658919803"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>In OSGI Configurations in AEM (<a href="http://localhost:4502/system/console/configMgr" target="_blank" rel="noopener noreferrer">http://localhost:4502/system/console/configMgr</a>) use the browser finder (CTRL + F) and find &#8220;Apache Sling Referrer Filter&#8221;. Click on the configuration, and let&#8217;s break it down to see what fields control what.</p>
<h3>Breaking things down</h3>
<p><img fetchpriority="high" decoding="async" class="alignnone size-large wp-image-55" src="http://sourcedcode.com/wp-content/uploads/2018/04/apache-sling-referrer-osgi-setttings-default-1024x654.png" alt="" width="1024" height="654" srcset="https://sourcedcode.com/wp-content/uploads/2018/04/apache-sling-referrer-osgi-setttings-default-1024x654.png 1024w, https://sourcedcode.com/wp-content/uploads/2018/04/apache-sling-referrer-osgi-setttings-default-300x191.png 300w, https://sourcedcode.com/wp-content/uploads/2018/04/apache-sling-referrer-osgi-setttings-default-768x490.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<ul>
<li><b>Allow Empty (Boolean)</b>: only enable this if you are testing (using a REST Client). Enabling this will allow any hosts to make requests to your AEM application (remember to turn this off in your production environment).</li>
<li><b>Allow Hosts (String[])</b>: allows specific hosts to make requests to your AEM instance; use string characters only.</li>
<li><b>Allow Regexp Host (String[])</b>: allows specific hosts to make requests your AEM instance; use regex only.</li>
<li><b>Filter Methods (String[])</b>: defines which HTTP method(s) will be checked with the values in the allowed hosts before accepting incoming HTTP requests.</li>
</ul>
<div class="mention-block">
<strong>Quick Note:</strong><br />
If you are learn by doing, you can follow the &#8220;How to make a simple HTTP post request in AEM&#8221; tutorial blog, where this tutorial will put the AEM Apache Sling Referrer Filter OSGI configuration in practice. <a href="https://sourcedcode.com/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client">https://sourcedcode.com/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client</a>.
</div>
<p><!-- Horizontal Preview Ad #2 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="2263738126"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration">What is the AEM Apache Sling Referrer Filter OSGI configuration?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to make a simple HTTP POST request to AEM with a HTTP Rest Client, Postman</title>
		<link>https://sourcedcode.com/blog/video-tutorial/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client</link>
					<comments>https://sourcedcode.com/blog/video-tutorial/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sat, 31 Mar 2018 14:27:04 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Video Tutorial]]></category>
		<guid isPermaLink="false">http://sourcedcode.com/?p=6</guid>

					<description><![CDATA[<p>This method should be used for DEVELOPMENT PURPOSES ONLY! During development in the AEM author instance, you would like to test your servlet using an HTTP Rest Client such as Postman. When making a POST request on the Rest Client, you will experience 2 errors. An authentication error, and a 403 forbidden error. What&#8217;s Happening? [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/video-tutorial/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client">How to make a simple HTTP POST request to AEM with a HTTP Rest Client, Postman</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="mention-block">This method should be used for DEVELOPMENT PURPOSES ONLY!</div>
<p><strong>During development</strong> in the AEM author instance, you would like to test your servlet using an HTTP Rest Client such as Postman. When making a POST request on the Rest Client, you will experience 2 errors. An authentication error, and a 403 forbidden error.</p>
<hr class="spacer-large" />
<h2>What&#8217;s Happening?</h2>
<p>Firstly, a typical development approach, you will be working on your author developers instance. Your Rest Client is making a POST request on the author instance, http://localhost:4502. You will get an authentication error.</p>
<p>Secondly, your POST request is being filtered and restricted by the &#8220;Apache Sling Referrer Filter&#8221; and &#8220;Adobe Granite CSRF Filter&#8221;. By default, the Apache Sling Referrer Filter blocks any incoming POST requests, and the Adobe Granite CSRF Filter blocks any incoming POST requests without the CSRF-Token token in the header.</p>
<hr class="spacer-large" />
<h2>How to solve this?</h2>
<p>We can solve this issue by including basic auth type in Postman, then allowing incoming POST request in the Apache Sling Referrer Filter OSGI configurations, and remove the requirement of the CSRF-Token in the Adobe Granite CSRF Filter OSGI configurations.</p>
<p><iframe width="560" height="315" src="https://www.youtube.com/embed/9uHMXY_QWog" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe><br />
Resource &#8211; Simple Servlet &#8211; <a href="https://gist.github.com/sourcedcode/bd1a2c150fabfc4b37857be0f389ac8a#file-simplepostservlet-java" rel="noopener noreferrer" target="_blank">https://gist.github.com/sourcedcode/bd1a2c150fabfc4b37857be0f389ac8a#file-simplepostservlet-java</a></p>
<hr class="spacer-large" />
<h3>Step 1 : Configure Basic Auth in Postman</h3>
<p>Launch Postman, then navigate to the Authentication tab. Ensure type is set to &#8220;Basic Auth&#8221;, and username and password are set to &#8220;admin&#8221;; this is the default username and password for the administrator user while developing on the author instance.</p>
<p><img decoding="async" src="http://sourcedcode.com/wp-content/uploads/2018/03/post-man-basic-auth-1024x767.png" alt="" width="1024" height="767" class="alignnone size-large wp-image-40" srcset="https://sourcedcode.com/wp-content/uploads/2018/03/post-man-basic-auth-1024x767.png 1024w, https://sourcedcode.com/wp-content/uploads/2018/03/post-man-basic-auth-300x225.png 300w, https://sourcedcode.com/wp-content/uploads/2018/03/post-man-basic-auth-768x575.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<hr class="spacer-large" />
<h3>Step 2 : Configure Apache Sling Referrer Filter</h3>
<ol>
<li>Enable allow empty</li>
<li>Remove the POST method from filters</li>
</ol>
<p>In OSGI configurations (<a href="http://localhost:4502/system/console/configMgr" target="_blank" rel="noopener noreferrer">http://localhost:4502/system/console/configMgr</a>), locate &#8220;Apache Sling Referrer Filter&#8221;. Enable the allow empty property, and remove the post method from filters property.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-large wp-image-12" src="http://sourcedcode.com/wp-content/uploads/2018/03/apache-sling-referrer-filter-before-1024x801.png" alt="" width="1024" height="801" srcset="https://sourcedcode.com/wp-content/uploads/2018/03/apache-sling-referrer-filter-before-1024x801.png 1024w, https://sourcedcode.com/wp-content/uploads/2018/03/apache-sling-referrer-filter-before-300x235.png 300w, https://sourcedcode.com/wp-content/uploads/2018/03/apache-sling-referrer-filter-before-768x600.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="8658919803"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><img loading="lazy" decoding="async" class="alignnone size-large wp-image-11" src="http://sourcedcode.com/wp-content/uploads/2018/03/apache-sling-referrer-filter-after-1024x801.png" alt="" width="1024" height="801" srcset="https://sourcedcode.com/wp-content/uploads/2018/03/apache-sling-referrer-filter-after-1024x801.png 1024w, https://sourcedcode.com/wp-content/uploads/2018/03/apache-sling-referrer-filter-after-300x235.png 300w, https://sourcedcode.com/wp-content/uploads/2018/03/apache-sling-referrer-filter-after-768x600.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<hr class="spacer-large" />
<h3>Step 3 : Configure Adobe Granite CSRF Filter</h3>
<ol>
<li>Remove the POST method from filters</li>
</ol>
<p>In OSGI configurations (<a href="http://localhost:4502/system/console/configMgr" target="_blank" rel="noopener noreferrer">http://localhost:4502/system/console/configMgr</a>), locate &#8220;Adobe Granite CSRF Filter&#8221;. Remove the post method from filters property.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-large wp-image-18" src="http://sourcedcode.com/wp-content/uploads/2018/03/adobe-granite-csrf-filter-before-1024x844.png" alt="" width="1024" height="844" srcset="https://sourcedcode.com/wp-content/uploads/2018/03/adobe-granite-csrf-filter-before-1024x844.png 1024w, https://sourcedcode.com/wp-content/uploads/2018/03/adobe-granite-csrf-filter-before-300x247.png 300w, https://sourcedcode.com/wp-content/uploads/2018/03/adobe-granite-csrf-filter-before-768x633.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #2 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="2263738126"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><img loading="lazy" decoding="async" class="alignnone size-large wp-image-17" src="http://sourcedcode.com/wp-content/uploads/2018/03/adobe-granite-csrf-filter-after-1024x844.png" alt="" width="1024" height="844" srcset="https://sourcedcode.com/wp-content/uploads/2018/03/adobe-granite-csrf-filter-after-1024x844.png 1024w, https://sourcedcode.com/wp-content/uploads/2018/03/adobe-granite-csrf-filter-after-300x247.png 300w, https://sourcedcode.com/wp-content/uploads/2018/03/adobe-granite-csrf-filter-after-768x633.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<hr class="spacer-large" />
<div class="mention-block">
<h4>Final Notes</h4>
<p>After making configurations to the two OSGI configurations, you should be able to make a POST request from your HTTP REST Client to your AEM instance.</p>
<p>For production, set Apache Sling Referrer Filter and Adobe Granite CSRF Filter settings back to default. Unless if you are giving access to other servers to make POST requests to your AEM application.</p>
<p><a href="http://sourcedcode.com/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration/" rel="noopener noreferrer" target="_self">Read more about Apache Sling Referrer Filter.</a>
</div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #3 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="3385248102"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/video-tutorial/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client">How to make a simple HTTP POST request to AEM with a HTTP Rest Client, Postman</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/video-tutorial/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client/feed</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
	</channel>
</rss>
