Creating custom authentication or one time access page in ActiveCollab

Creating a one time authentication in ActiveCollab. The example was taken from the developer’s guide at ActiveCollab website. When i checked this one first time the file structure mentioned in the guide and the actual file structure in AC 3.1.16 looked different, and it was further changed in current 3.3, hence posting it for reference here. I am not sure whether the path mentioned in the guide was still valid in reference to new version and i hope it is updated soon in the guide.

Updated April 26 2013

Create CustomAuthenticationProvider.class.php under in activecollab/x.x.x/angie/frameworks/authentication/models/providers or rather at custom/auth_providers with the following code

[php]require_once AUTHENTICATION_FRAMEWORK_PATH . ‘/models/providers/BasicAuthenticationProvider.class.php’;
class PaypalAuthenticationProvider extends BasicAuthenticationProvider {
function initialize() {
$settings = array(
‘new_visit’ => true,
);
$identifyUser = $_REQUEST[‘user_id’];
//put more strong identification process here.
//………………….
$user = Users::findById($_REQUEST[$identifyUser]);
//pr($user);
if($user instanceof User) {
return $this->logUserIn($user, $settings);
} else {
return new Error(‘User not recognized’);
} // if
} // initialize
}[/php]

Now time to tell the AC about our custom authentication provider. Add a line in the config/config.php file, as this one:

[php]define(‘AUTH_PROVIDER’, ‘PaypalAuthenticationProvider’);[/php]

To access a page just include user_id in the url. Remeber this will be a once time access. To make access permanent you can set session or cookie on your server. Althouh this kind of authentication is useful in one time authentication such as in paypal recurring ipn handler calls. Also custom authentication can be used to integrated other authentication systems like WordPress, joomla etc to intereact with AC

Leave a Reply