Novell is now a part of Micro Focus

Accessing iChain OLAC Parameters Passed in the HTTP Header Using PHP

Novell Cool Solutions: Feature

Digg This - Slashdot This

Posted: 24 Nov 2004

TID10095583: How to access iChain OLAC parameters passed in the HTTP header using PHP

iChain has the ability to pass supplemental user information to the back end web or application server. This feature is called Object Level Access Control (OLAC). This document will provide some examples of how information can be passed in the HTTP header, and how that information can be accessed via PHP. (For complete details regarding OLAC, please consult the iChain documentation.)

PHP makes information from the HTTP header available in a variety of ways, depending on server configuration and platform. The following examples assume that Apache is the web server and PHP 4.3.0 or higher is being used. Older versions of PHP may have different methods or functions to obtain the required information. Please consult the PHP documentation online at for the most current information.

The following information will be used for the examples:

User Information:
Name: John Doe
DN: CN=johndoe,OU=users,O=org
Username: johndoe
Password: mypassword
Title: mytitle

The first thing to do is make sure that iChain is configured properly.  Following is a sample configuration to be used in these examples.  Individual configurations may vary.

iChain Server Configuration:

  1. LDAP Profile
    1. Profile Name: myldap
    2. Type: LDAP Authentication
    3. LDAP Login Method: Build distinguished name
    4. LDAP context list: ou=users,o=org
    5. Naming attribute: cn
  2. Web Server Accelerator
    1. Accelerator Name: myws
    2. DNS Name:
    3. Cookie Domain:
    4. Forward host name sent by browser to the web server
    5. Enable authentication
    6. Authentication options
      • Forward authentication information to web server
      • Service profiles: myldap
  3. Access Control
    1. Enable Object Level Access Control (OLAC)

ISO Object Configuration:

  1. Protected Resource
    1. Resource Name: MyWebSite
    2. URL Prefix:*
    3. Access: Restricted
    4. OLAC Parameters:
      1. Pass Parameters In: HTTP Header
      2. Username
        • Name: Username
        • Data Source: LDAP
        • Value: cn
      3. Title
        • Name: Title
        • Data Source: LDAP
        • Value: title

With the above configuration, the following pieces of information will be in the HTTP header for all requests sent from the iChain box to the origin server:

  • Authorization: Basic Y249am9obmRvZSxvdT11c2VycyxvPW9yZzpteXBhc3N3b3Jk
    • The above string is Base64 encoded.  The decoded value is:
  • X-Username: johndoe
  • X-Title: mytitle

When the PHP script receives the HTTP request with the above header information, PHP creates and makes available the following global variable/vaule pairs:

    • cn=johndoe,ou=users,o=org
    • mypassword
    • johndoe
    • mytitle
    • johndoe
    • mytitle

These global variables may be used as any other variable for evaluation or assignment.  For example, the following script would print the value of each of these variables:

        echo "$_SERVER[PHP_AUTH_USER] <br />";
        echo "$_SERVER[PHP_AUTH_PW] <br />";
        echo "$_SERVER[HTTP_X_USERNAME] <br />";
        echo "$_SERVER[HTTP_X_TITLE] <br />";
        echo "$HTTP_X_USERNAME <br />";
        echo "$HTTP_X_TITLE <br />";

Additionally, it is possible to create a variable containing an array of all the raw Apache headers.  For example:

  • $headers = apache_request_headers();

This new $headers variable will have the following pertinent values:

  • headers["Authorization"]
    • Basic Y249am9obmRvZSxvdT11c2VycyxvPW9yZzpteXBhc3N3b3Jk
  • headers["X-Username"]
    • johndoe
  • headers["X-Title"]
    • mytitle

The above mentioned _SERVER["PHP_AUTH_USER"] and _SERVER["PHP_AUTH_PW"] variables represent the same data as the $headers["Authorization"] value created above, with the exception that the data has already been decoded.

The following script would create this $headers variable, then print out each of the header elements individually.  It will also assign two new variables $username and $title, then print the values of both $username and $title.

        $headers = apache_request_headers();

        foreach ($headers as $header => $value) {
           echo "$header: $value <br />\n";
        echo "End of headers<p>";

        $username = $headers["X-Username"];
        $title = $headers["X-Title"];

        echo "<p>";
        echo "username is $username <br />";
        echo "title is $title <br />";


If no additional information is required other than username and password, simply use the _SERVER["PHP_AUTH_USER"] and _SERVER["PHP_AUTH_PW"] variables which are sent in the HTTP Authorization header.  Remove all other OLAC parameters from the Protected Resource to prevent them from being passed in the HTTP header.

As previously noted, the default configuration of iChain sends the user's full DN for the username.  If only the CN value is required ("johndoe" in the examples above), it is possible to configure iChain to reflect this attribute instead of the DN using the special ICHAIN_UID OLAC parameter.  To modify this behavior, use the following configuration:

ISO Object Configuration:

  1. Protected Resource
    1. Resource Name: MyWebSite
    2. URL Prefix:*
    3. Access: Restricted
    4. OLAC Parameters:
      1. Pass Parameters In: HTTP Header
      2. ICHAIN_UID
        • Name: ICHAIN_UID
        • Data Source: LDAP
        • Value: cn

The resultant HTTP Authorization header value would be:

  • Authorization: Basic am9obmRvZTpteXBhc3N3b3Jk
    • This vaule decodes to:

And the corresponding PHP variables would be:

    • johndoe
    • mypassword

For additional troubleshooting purposes, it is possible to create a simple script which will display all available PHP information.


Complete documentation on PHP is available at the PHP website:

additional information:

Novell iChain 2.3 Documentation

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates