Friday, June 5, 2015

Enabling basic authentication for specific website in dispatcher : Adobe CQ5/Adobe AEM

Enabling basic authentication for specific website in dispatcher : Adobe CQ5/Adobe AEM

Create a file dispatcher.htaccess in dispatcher.
Create the required users by using the following commands.

htpasswd -c /etc/httpd/conf/dispatcher.htaccess user1

Add the following configurations to the httpd.conf, change the site URL and AuthUserFile accordingly:

# unsets authorization header when sending request to AEM
RequestHeader unset Authorization
SetEnvIf Request_URI ^/content/en* auth=1
AuthName "Please login to access english part"
AuthType Basic
AuthUserFile /etc/httpd/conf/dispatcher.htaccess
# first, allow everybody
Order Allow,Deny
Satisfy any
Allow from all
Require valid-user
# then, deny only if required
Deny from env=auth

This will enable the the basic authentication for the website path starts with /content/en

If the site is enabled for https then add the following content to the ssl.conf file

<Location />
# unsets authorization header when sending request to AEM
RequestHeader unset Authorization
SetEnvIf Request_URI ^/content/en* auths=1
AuthName "Please login to access english part"
AuthType Basic
AuthUserFile /etc/httpd/conf/dispatcher.htaccess
# first, allow everybody
Order Allow,Deny
Satisfy any
Allow from all
Require valid-user
# then, deny only if required
Deny from env=auths
</Location>


No comments:

Post a Comment