Article ID: 379
Last updated: 24 Aug, 2022
Remote authentication allows you to integrate your organization's authentication system with KBPublisher. Before you start:
Steps to enable Remote Authentication​
Quick summary of the process
Customizing the remoteDoAuth functionIn 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.
function remoteDoAuth($username, $password) {
$user = false;
$db = &DBUtil::connect($conf);
$sql = "SELECT
id AS 'remote_user_id',
email, username, first_name, last_name
FROM your_remote_users_table
WHERE username = '%s' AND password = '%s'";
$sql = sprintf($sql, $username, $password);
$result = $db->Execute($sql) or die(DBUtil::error($sql, true, $db));
// if found
if($result->RecordCount() == 1) {
$user = $result->FetchRow();
$user['password'] = $password; // here you should provide not md5ing password
// assign a priv to user (optional)
// it is fully up to you how to determine who is authenticated and what priv to assign
// set to off to not rewrite on login
$user['priv_id'] = 'off';
// assign a role to user (optional)
// it is fully up to you how to determine who is authenticated and what role to assign
// set to off to not rewrite on login
$user['role_id'] = 1;
}
return $user;
}
Also see examples in attached files. Tracking loginsYou 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 ).
Article ID: 379
Last updated: 24 Aug, 2022
Revision: 7
Access:
Public
Views: 6607
Comments: 0
|