Created

Jun 13, 2012

HTTP Header Base Authentication in CQ5.5

Posted by Ankit Agarwal

HTTP header based authentication is used when an organization is authenticating the user from third party security solution, for example, SiteMinder.

file

In Figure1, when a user gets successfully authenticated, it sends a user-id to CQ via HTTP header. [The syntax of this header can either be in the syntax defined for HTTP Basic Authentication, plain, or extractable by a Regular Expression]. Since the valid user has already been authenticated by the security solution, CQ is receiving the validated request as shown in figure. CQ assumes that the user has already been authenticated. CQ never sees the password or other credentials and would have no way of authenticating the user independently.

It is almost always ALSO necessary for a CRX user with the same ID to exist in the repository. If you are using LDAP, then the LDAP LoginModule can create users (and groups) on demand. The way this works is that, after receiving the validated request from Security Solution, CQ checks the existence of the user-id in the repository. If user doesn’t exist in the repository, then LDAP LoginModule gets the login request, and it populates the CRX user in the repository with information extracted from the LDAP server.

 If LDAP is not available, but some other user account storage system is, you can create a custom LoginModule to interface with that system to do the same thing.


Note: Access to CRX from any other means other than SecuritySolution should be blocked in HTTP Header Base Authentication. If not, then anyone can spoof the header and this would lead to security breach.

Configure Header Base Authentication in three steps:

Step 1:  Modify repository.xml file

  • Open file repository.xml  under /crx-quickstart/repository/
  • In LoginModule section , uncomment underline config :

<param name="trust_credentials_attribute" value="d5b9167e95dad6e7d3b5d6fa8df48af8"/ >

  • Delete the old value of trust_credentials_attribute & provide a new value, for example, TrustedInfo.
  • Save the repository.xml file and restart the CQ instance to pick the changes.

Step 2: Configure Adobe Granite SSO Authentication Handler:

  • Log inside http://<CQ_instance>:<port_no.>/system/console/configMgr, and go to Adobe Granite SSO Authentication Handler & provide the different entries as shown below:-

file

a) Path: Path that this authentication handler will be used on. If this parameter is left empty the authentication handler is disabled.

b) Service Ranking: OSGi Framework Service Ranking value to indicate the order in which to call this service. This is an integer value where higher values designate higher precedence. Default value is 0.

c) Header Names: The name(s) of headers that might contain a user ID. In above example it is “uid”.

d) Format:

         1. Use Basic if the user ID is encoded with Base64 encoding.

         2. Use AsIs if the user ID is provided in plain text or any regular expression applied value should be used.

(i) Plain text example: If the user id is passed in header as a plain username, lets’ say John, then CRX will accept the user id John and authenticate the user. 

(ii) Regular expression example:  if you specify ^<DOMAIN>\\(.+)$ this will match against a header starting with <DOMAIN>\ and followed by the user ID (where <DOMAIN> is replaced by your own domain name). The user ID is then used as the value for SSO. If you need to use groups in your regular expression, you can specify the group by appending |<group-index> to the regular expression (the group index starts with 1). So the above example can be written as ^<DOMAIN>\\(.+)$|1.

  • Trusted Credential Attribute: The name of the attribute (in the trusted credentials) that is set with the user information. In above config, its value is TrustedInfo.

Note: The value of Trusted Credential Attribute must be equal to the attribute you configure in repository.xml (<param name="trust_credentials_attribute" value="TrustedInfo"/>). This is the name of the Attribute used in the SimpleCredentials object to provide the userid from the SSOAuthenticationHandler to the authenticator CRXLoginModule. Therefore this has to be the same in the two configurations.

Step 3: Entry in Dispatcher.any file:

If organization is using Dispatcher to forward the requests to CQ instance, then do the following steps:

A.      Open Dispatcher.any file, & locate clientheaders section.

B.      Add HTTP header in the clientheaders list. In above example, it would be uid.

--------------------------------------------"Header Base Authentcation" configuration completes------------------------------------

To test the HTTP Header Base Authentication:

A. Configure an Apache instance in front of CQ to forward all request to the CQ instance.

B. Put a config line in “httpd.conf” of Apache :

RequestHeader set uid admin

Note: The above config will send header uid with value admin in every request. And admin is the default user available in CQ.

C. Restart the Apache Web Server to pick the changes.

D. Please make sure that Format in Adobe Granite SSO Authentication Handler should be AsIs.

E. Hit CQ via Apache, i.e.  http://<Apache>:80/libs/cq/core/content/welcome.html

F. As expected, user will log inside welcome page without providing credentials.

COMMENTS

  • By Ryan Lunka - 7:03 PM on Jun 13, 2012   Reply
    I'm a little bit confused about the first part (with the picture). With this architecture, is there some kind of intermediary platform that intercepts content requests to identify whether or not the requester is authenticated? So if I'm the requester, is it transparent to me that my request gets brokered to a system that handles authentication or do I have to manually go to that system, authenticate, and THEN I have access to the CQ instance?

    Could you clear up that part of the scenario a bit?
  • By Ankit Agarwal - 5:30 AM on Jun 14, 2012   Reply
    If you are a requester, then it is not transparent to you that your request is being intercepted by a third party Security Solution. [It is similar to how the load-balancer works]. If the user get successfully authenticated by the Security Solution, then the request goes to CQ [as configured], which contains the user-id in the HTTP header. Since the valid user has already been authenticated by the security solution, CQ is receiving the validated request as shown in figure.
  • By Kishore - 3:35 PM on Aug 07, 2012   Reply
    Hi Ankit,
    Many thanks for your post on SSO Integration. We have done all the steps and able to get the user logged in from Apache. Now the task is to integrate with Opensso and authenticate the user from there but we tried installing the agent in http server and authenticated the user using Open SSO but we are getting You don't have permission to access /system/sling/login.html on this server. error. Can you please help !!!
  • By Lori Carrig - 1:54 PM on Feb 26, 2013   Reply
    I have a working SSO, but when a user attempts to hit the Apache server then the CQ5 server via dispatcher and if they do not have an account the browser just flashes for ever until the user closes the browser. Is there a setting to stop the reattempting of autologin via SSO? I am using Apache and CQ5 version 5.5
  • By liquidy - 12:28 PM on Mar 30, 2013   Reply
    Regular expression example: if you specify ^<DOMAIN>\\(.+)$ this will match against a header starting with <DOMAIN>\ and followed by the user ID (where <DOMAIN> is replaced by your own domain name). The user ID is then used as the value for SSO. If you need to use groups in your regular expression, you can specify the group by appending |<group-index> to the regular expression (the group index starts with 1). So the above example can be written as ^<DOMAIN>\\(.+)$|1.
  • By diễn đàn seo - 4:04 AM on Apr 17, 2013   Reply
    With this architecture, is there some kind of intermediary platform that intercepts content requests to identify whether or not the requester is authenticated
  • By http://slashdotbookmarks.in - 2:36 PM on Apr 18, 2013   Reply
    Really impressed! Everything is very open and very clear reason of issues. It contains truly news. Your website is very valuable. Thanks for sharing.
  • By photo booth nj - 5:08 PM on Apr 27, 2013   Reply
    Thanks for keeping us informed
  • By best wedding photographer nj - 9:53 PM on Apr 27, 2013   Reply
    Its great to see you taking the time to share this information
  • By http://5starlimorental.com - 7:25 PM on Apr 28, 2013   Reply
    CQ5.5 has been the best introduction in the last few months. It is incredibly relevant to what I do. Thanks