ILIAS  release_4-4 Revision
class.ilAuthContainerDecorator.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
35 {
36  private $container = null;
37  protected $parameter = array();
38 
43  public function __construct()
44  {
45 
46  }
47 
48 
49 
55  public final function __call($name,$arguments)
56  {
57  return call_user_func_array(array($this->container,$name),$arguments);
58  }
59 
63  abstract protected function initContainer();
64 
68  public function getContainer()
69  {
70  return $this->container;
71  }
72 
76  public function setContainer($a_container)
77  {
78  $this->container = $a_container;
79  }
80 
81 
82  public function getAuthObject()
83  {
84  return $this->getContainer()->_auth_obj;
85  }
86 
90  public function appendParameter($a_key,$a_value)
91  {
92  $this->parameter[$a_key] = $a_value;
93  }
94 
95  public function appendParameters($a_params)
96  {
97  $this->parameter = array_merge($this->parameter,$a_params);
98  }
99 
103  public function getParameters()
104  {
105  return $this->parameter ? $this->parameter : array();
106  }
107 
114  public function loginObserver($a_username,$a_auth)
115  {
116  global $ilLog;
117 
118  $ilLog->write(__METHOD__.': logged in as '.$a_username.
119  ', remote:'.$_SERVER['REMOTE_ADDR'].':'.$_SERVER['REMOTE_PORT'].
120  ', server:'.$_SERVER['SERVER_ADDR'].':'.$_SERVER['SERVER_PORT']
121  );
122  }
123 
130  public function failedLoginObserver($a_username,$a_auth)
131  {
132  global $ilLog;
133 
134  $ilLog->write(__METHOD__.': login failed for user '.$a_username.
135  ', remote:'.$_SERVER['REMOTE_ADDR'].':'.$_SERVER['REMOTE_PORT'].
136  ', server:'.$_SERVER['SERVER_ADDR'].':'.$_SERVER['SERVER_PORT']
137  );
138  return false;
139  }
140 
147  public function checkAuthObserver($a_username,$a_auth)
148  {
149  global $ilLog;
150 
151  //$ilLog->write(__METHOD__.': checkAuth called');
152 
153  return true;
154  }
155 
162  public function logoutObserver($a_username,$a_auth)
163  {
164  global $ilLog;
165 
166  $ilLog->write(__METHOD__.': User logged out: '.$a_username.
167  ', remote:'.$_SERVER['REMOTE_ADDR'].':'.$_SERVER['REMOTE_PORT'].
168  ', server:'.$_SERVER['SERVER_ADDR'].':'.$_SERVER['SERVER_PORT']
169  );
170  }
171 
172 
173 }
174 ?>
__call($name, $arguments)
Wrapper for all PEAR_Auth_Container methods.
Abstract decorator for PEAR::Auth Base class for all Ilias Authentication classes.
initContainer()
Init the PEAR container.
checkAuthObserver($a_username, $a_auth)
Called from base class after call of checkAuth.
failedLoginObserver($a_username, $a_auth)
Called from base class after failed login.
getParameters()
get auth container parameters
setContainer($a_container)
set pear container
logoutObserver($a_username, $a_auth)
Called from base class after logout.
appendParameter($a_key, $a_value)
Add a parameter.