Make sure Piwik session is started in Auth::authenticate
[piwik-CASLogin.git] / CASLogin.php
1 <?php
2 /**
3  * Piwik - Open source web analytics
4  * 
5  * @link http://piwik.org
6  * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
7  * @version $Id: ExamplePlugin.php 838 2008-12-17 17:26:15Z matt $
8  * 
9  * @package Piwik_CASLogin
10  */
11
12 namespace Piwik\Plugins\CASLogin;
13
14 use Piwik\Piwik;
15
16 require PIWIK_INCLUDE_PATH . '/plugins/CASLogin/Auth.php';
17
18 class CASLogin extends \Piwik\Plugin
19 {
20         public function getInformation()
21         {
22                 return array(
23                         'name' => 'CAS Login',
24                         'description' => 'CAS Login plugin. It uses JA-SIG Central Authentication Services to authenticate users and grant them access to piwik.',
25                         'author' => 'OW',
26                         'homepage' => 'http://dev.piwik.org/trac/ticket/598/',
27                         'version' => '0.7.1',
28                 );
29         }
30
31         function getListHooksRegistered()
32         {
33                 $hooks = array(
34                         'Request.initAuthenticationObject'      => 'initAuthenticationObject',
35                         );
36                 return $hooks;
37         }
38
39         function initAuthenticationObject()
40         {
41         set_include_path(get_include_path() . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/plugins/CASLogin/CAS');
42         require_once('CAS/CAS.php');
43                 $auth = new Auth();
44                 \Piwik\Registry::set('auth', $auth);
45         }
46 }