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.