Home Learn More Purchase Knowledge Base Support Contact

Search:     Advanced search

Using Remote Authentication

Article ID: 181
Last updated: 06 Mar, 2011

Remote authentication allows you to integrate your organization's authentication system with KBPublisher. Configuration requires only a few simple steps.

Before you start:

  • We assume that you have some experience with PHP and with the system you are connecting to.

Steps to enable Remote Authentication

  • Set the config variable $conf['auth_remote'] in the file admin/config.inc.php to 1
  • Set required values for constants in file admin/lib/custom/remote_auth.php
  • Customize the _remoteDoAuth function in the file admin/lib/custom/remote_auth.php to authenticate the username and password passed to it against your own authentication system
  • Rename the function _remoteDoAuth to remoteDoAuth

Quick summary of the process

  • End user goes to site
  • Remote Authentication checks for valid user credentials
    • If auto-authentication is set, does this automatically
    • If auto-authentication is not set, user logs in first
  • KBPublisher authenticates the user .

KBPublisher public view

Customizing the remoteDoAuth 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 _remoteDoAuth function. Customize this function to do authentication against your internal system by using the username and password provided.

Here is a simple example of the function customized to authenticate against a MySQL database:

function remoteDoAuth($username, $password) {

$user = false;
$db = &DBUtil::connect($conf);

$sql = "SELECT 1 FROM ss_user WHERE username = '%s' AND password = '%s'";
$sql = sprintf($sql, $username, $password);
$result = &$db->Execute($sql) or die(db_error($sql, false, $db));

// if found
if($result->RecordCount() == 1) {
$user = 1; // assign a user id, this user id should exists in kb user table
}

return $user;
}

 Also see examples in attached files.

Tracking logins

You can see how your remote authentication works in logs Logs/Logins

For debugging every last login is logged to a file called last_remote_login.log in the KBPublisher cache directory (APP_CACHE_DIR in admin/config.inc.php ).
For example: /home/username/ kb_cache/last_remote_login.log

Article ID: 181
Last updated: 06 Mar, 2011
Views: 6106
Comments: 0
This article was:  
Attached files
file remote_auth_db.php.txt (3 kb)
file remote_auth_ldap.php.txt (3 kb)

Prev   Next
Remote Authentication     Different ways for Remote Authentication


© 2011 Double Jade LLC | customer.service@kbpublisher.com