Home Learn More Purchase Knowledge Base Support Contact

Search:     Advanced search

Using Auto Authentication

Article ID: 326
Last updated: 24 Mar, 2011

Auto authentication allows you to automatically authenticate users.

Steps to enable Auto Authentication

  • Set the constant  KB_AUTH_AUTO in the file admin/lib/custom/remote_auth.php to 1
  • Customize the _remoteAutoAuth function in the file admin/lib/custom/remote_auth.php to catch current user data and return it
  • Rename the function _remoteAutoAuth to remoteAutoAuth


Customizing the remoteAutoAuth function

In your installation there is a folder admin/lib/custom. Within that folder is a file called remote_auth.php. This file contains the _remoteAutoAuth function. Customize this function to get the current user's credentials.

On success, the function remoteAutoAuth should return an associative array with keys (username, password) for the user.  For example: array('username'=>'John', 'password'=>'Test').

Here is a simple example of the function customized using HTTP authentication:

function remoteAutoAuth() {
    
    $user = false;
    
    if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
         $user = array();
         $user['username'] = $_SERVER['PHP_AUTH_USER'];
         $user['password'] = $_SERVER['PHP_AUTH_PW'];
    } 		     

    return $user; 
}


Debugging auto-remote authentication

You can debug auto-authentication by setting KB_AUTH_AUTO = 2, which allows you to continually try relogging in so that you can fix any problems without having to start over every time. Important: Don't forget to reset this back to 1 (or 0) when you have finished debugging.

Article ID: 326
Last updated: 24 Mar, 2011
Views: 1420
Comments: 0
This article was:  
Attached files
file remote_auth_auto.php.txt (1 kb)

Also listed in
folder User Manual v4.0 -> Changes for release 4.0 -> Remote Authentication

Prev   Next
Different ways for Remote Authentication     Using Active Directory for Remote Authentication


© 2008 - 2012 Double Jade LLC | customer.service@kbpublisher.com