diff --git a/auth-cas/authentication.php b/auth-cas/authentication.php deleted file mode 100644 index fa8e76a..0000000 --- a/auth-cas/authentication.php +++ /dev/null @@ -1,31 +0,0 @@ -getConfig(); - - $enabled = $config->get('cas-enabled'); - if (in_array($enabled, array('all', 'staff'))) { - require_once('cas.php'); - StaffAuthenticationBackend::register( - new CasStaffAuthBackend($this->getConfig())); - } - if (in_array($enabled, array('all', 'client'))) { - require_once('cas.php'); - UserAuthenticationBackend::register( - new CasClientAuthBackend($this->getConfig())); - } - } -} - -require_once(INCLUDE_DIR.'UniversalClassLoader.php'); -use Symfony\Component\ClassLoader\UniversalClassLoader_osTicket; -$loader = new UniversalClassLoader_osTicket(); -$loader->registerNamespaceFallbacks(array( - dirname(__file__).'/lib')); -$loader->register(); diff --git a/auth-cas/cas.php b/auth-cas/cas.php deleted file mode 100644 index 774f757..0000000 --- a/auth-cas/cas.php +++ /dev/null @@ -1,174 +0,0 @@ -config = $config; - } - - function triggerAuth() { - $self = $this; - phpCAS::client( - CAS_VERSION_2_0, - $this->config->get('cas-hostname'), - intval($this->config->get('cas-port')), - $this->config->get('cas-context') - ); - if($this->config->get('cas-ca-cert-path')) { - phpCAS::setCasServerCACert($this->config->get('cas-ca-cert-path')); - } else { - phpCAS::setNoCasServerValidation(); - } - if(!phpCAS::isAuthenticated()) { - phpCAS::forceAuthentication(); - } else { - $this->setUser(); - $this->setEmail(); - $this->setName(); - } - } - - function setUser() { - $_SESSION[':cas']['user'] = phpCAS::getUser(); - } - - function getUser() { - return $_SESSION[':cas']['user']; - } - - function setEmail() { - if($this->config->get('cas-email-attribute-key') !== null - && phpCAS::hasAttribute($this->config->get('cas-email-attribute-key'))) { - $_SESSION[':cas']['email'] = phpCAS::getAttribute( - $this->config->get('cas-email-attribute-key')); - } else { - $email = $this->getUser(); - if($this->config->get('cas-at-domain') !== null) { - $email .= $this->config->get('cas-at-domain'); - } - $_SESSION[':cas']['email'] = $email; - } - } - - function getEmail() { - return $_SESSION[':cas']['email']; - } - - function setName() { - if($this->config->get('cas-name-attribute-key') !== null - && phpCAS::hasAttribute($this->config->get('cas-name-attribute-key'))) { - $_SESSION[':cas']['name'] = phpCAS::getAttribute( - $this->config->get('cas-name-attribute-key')); - } else { - $_SESSION[':cas']['name'] = $this->getUser(); - } - } - - function getName() { - return $_SESSION[':cas']['name']; - } - - function getProfile() { - return array( - 'email' => $this->getEmail(), - 'name' => $this->getName() - ); - } -} - -class CasStaffAuthBackend extends ExternalStaffAuthenticationBackend { - static $id = "cas"; - static $name = /* trans */ "CAS"; - - static $service_name = "CAS"; - - var $config; - - function __construct($config) { - $this->config = $config; - $this->cas = new CasAuth($config); - } - - function getName() { - $config = $this->config; - list($__, $_N) = $config::translate(); - return $__(static::$name); - } - - function signOn() { - if (isset($_SESSION[':cas']['user'])) { - $staff = new StaffSession($this->cas->getEmail()); - if ($staff && $staff->getId()) { - return $staff; - } else { - $_SESSION['_staff']['auth']['msg'] = 'Have your administrator create a local account'; - } - } - } - - static function signOut($user) { - parent::signOut($user); - unset($_SESSION[':cas']); - } - - - function triggerAuth() { - parent::triggerAuth(); - $cas = $this->cas->triggerAuth(); - Http::redirect(ROOT_PATH . 'scp/'); - } -} - -class CasClientAuthBackend extends ExternalUserAuthenticationBackend { - static $id = "cas.client"; - static $name = /* trans */ "CAS"; - - static $service_name = "CAS"; - - function __construct($config) { - $this->config = $config; - $this->cas = new CasAuth($config); - } - - function getName() { - $config = $this->config; - list($__, $_N) = $config::translate(); - return $__(static::$name); - } - - function supportsInteractiveAuthentication() { - return false; - } - - function signOn() { - if (isset($_SESSION[':cas']['user'])) { - $acct = ClientAccount::lookupByUsername($this->cas->getEmail()); - $client = null; - if ($acct && $acct->getId()) { - $client = new ClientSession(new EndUser($acct->getUser())); - } - - if ($client) { - return $client; - } else { - return new ClientCreateRequest( - $this, $this->cas->getEmail(), $this->cas->getProfile()); - } - } - } - - static function signOut($user) { - parent::signOut($user); - unset($_SESSION[':cas']); - } - - function triggerAuth() { - parent::triggerAuth(); - $cas = $this->cas->triggerAuth(); - Http::redirect(ROOT_PATH . 'login.php'); - } -} diff --git a/auth-cas/config.php b/auth-cas/config.php deleted file mode 100644 index ec62545..0000000 --- a/auth-cas/config.php +++ /dev/null @@ -1,69 +0,0 @@ - $__('Authentication'), - 'default' => "disabled", - 'choices' => array( - 'disabled' => $__('Disabled'), - 'staff' => $__('Agents Only'), - 'client' => $__('Clients Only'), - 'all' => $__('Agents and Clients'), - ), - )); - return array( - 'cas' => new SectionBreakField(array( - 'label' => $__('CAS Authentication'), - )), - 'cas-hostname' => new TextboxField(array( - 'label' => $__('CAS Server Hostname'), - 'configuration' => array('size'=>60, 'length'=>100), - )), - 'cas-port' => new TextboxField(array( - 'label' => $__('CAS Server Port'), - 'configuration' => array('size'=>10, 'length'=>8), - )), - 'cas-context' => new TextboxField(array( - 'label' => $__('CAS Server Context'), - 'configuration' => array('size'=>60, 'length'=>100), - 'hint' => $__('This value is "/cas" for most installs.'), - )), - 'cas-ca-cert-path' => new TextboxField(array( - 'label' => $__('CAS CA Cert Path'), - 'configuration' => array('size'=>60, 'length'=>100), - )), - 'cas-at-domain' => new TextboxField(array( - 'label' => $__('CAS e-mail suffix'), - 'configuration' => array('size'=>60, 'length'=>100), - 'hint' => $__('Use this field if your CAS server does not - report an e-mail attribute. ex: "@domain.tld"'), - )), - 'cas-name-attribute-key' => new TextboxField(array( - 'label' => $__('CAS name attribute key'), - 'configuration' => array('size'=>60, 'length'=>100), - )), - 'cas-email-attribute-key' => new TextboxField(array( - 'label' => $__('CAS email attribute key'), - 'configuration' => array('size'=>60, 'length'=>100), - )), - 'cas-enabled' => clone $modes, - ); - } -} diff --git a/auth-cas/plugin.php b/auth-cas/plugin.php deleted file mode 100644 index a3294d1..0000000 --- a/auth-cas/plugin.php +++ /dev/null @@ -1,21 +0,0 @@ - 'auth:cas', # notrans - 'version' => '0.2', - 'name' => /* trans */ 'JASIG CAS Authentication', - 'author' => 'Kevin O\'Connor', - 'description' => /* trans */ 'Provides a configurable authentication - backend for authenticating staff and clients using CAS.', - 'url' => 'http://www.osticket.com/plugins/auth/cas', - 'plugin' => 'authentication.php:CasAuthPlugin', - 'requires' => array( - "jasig/phpcas" => array( - "version" => "1.3.3", - "map" => array( - "jasig/phpcas/source" => 'lib/jasig/phpcas', - ) - ), - ), -); - -?>