I'm developing a plugin to validate our users with our own authentication service.  I developed one that inherits from StaffAuthenticationBackend and it works fine, responds to configuration events, and the signOn() event.  The user authentication plugin inherits from UserAuthenticationBackend and it responds to configuration commands, but will not respond to the signOn() event.  I've attached the entire text of the plugin below.  Any ideas??<?phprequire_once(INCLUDE_DIR.'traceToFile.php');require_once(INCLUDE_DIR.'class.auth.php');/** * CAS Authentication plugin * * Allows users to validate using CAS */class CASUserAuthentication extends UserAuthenticationBackend {    static $name = "CAS User Authentication";    static $id = "casuser";    function signOn() {        // // we are going to use the email address returned from CAS // and either the ticket number provided or CAS_NO_TICKETS traceToFile(__FILE__,__LINE__,"signOn()!"); $emailaddress = 'jeff@hendricom.com'; $user = NULL; $enduser = NULL;        if ($emailaddress) {            // convert to lower case            $emailaddress = trim(strtolower($emailaddress)); traceToFile(__FILE__,__LINE__,"calling TicketUser:(".$emailaddress.")");            if ($user = TicketUser:($emailaddress)) { traceToFile(__FILE__,__LINE__,"calling new EndUser()"); if ($enduser = new EndUser($user)) { traceToFile(__FILE__,__LINE__,"gut 'im kiptin'");                return $enduser; } else { traceToFile(__FILE__,__LINE__,"cud nit create EndUser kiptin'"); } } else { traceToFile(__FILE__,__LINE__,"cud nit find 'im kiptin'"); }        }    }}class CASUserAuthenticationPluginConfig extends PluginConfig {    function getOptions() { traceToFile(__FILE__,__LINE__,"getOptions()!");        return array(            'authenticationserver' => new TextboxField(array(                'label'=>'CAS Authentication Server',                'hint'=>'The CAS authentication server to use with this plugin.',                'configuration'=>array('size'=>40),                'required'=>true,            )),        );    }    function pre_save($config, &$errors) { traceToFile(__FILE__,__LINE__,"pre_save()!");        $server = $config; if(!strlen($server)) $field->addError('Invalid server name!');        return true;    }}class CASUserAuthPlugin extends Plugin {    var $config_class = 'CASUserAuthenticationPluginConfig';    function bootstrap() {        UserAuthenticationBackend:('CASUserAuthentication');    }}return array(    'id' =>             'auth', # notrans    'version' =>        '0.1',    'name' =>           'CAS User Authentication',    'author' =>         'Jeff Hendrickson',    'description' =>    'Enables CAS validation for users',    'url' =>            'http://www.max.gov',    'plugin' =>         'CASUserAuthPlugin');?>

a year later

HiHave you managed to get this working and if so, is the final version something you would be willing to share?

Someone else build a plugin to authenticate users via CAS. You might want to take a look at it here:https://github.com/kevinoconnor7/osTicket-auth-cas

Thanks Chefkeks. I'll have a look through that.

Write a Reply...