ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
54 final public function __call($name, $arguments)
55 {
56 return call_user_func_array(array($this->container,$name), $arguments);
57 }
58
62 abstract protected function initContainer();
63
67 public function getContainer()
68 {
69 return $this->container;
70 }
71
75 public function setContainer($a_container)
76 {
77 $this->container = $a_container;
78 }
79
80
81 public function getAuthObject()
82 {
83 return $this->getContainer()->_auth_obj;
84 }
85
89 public function appendParameter($a_key, $a_value)
90 {
91 $this->parameter[$a_key] = $a_value;
92 }
93
94 public function appendParameters($a_params)
95 {
96 $this->parameter = array_merge($this->parameter, $a_params);
97 }
98
102 public function getParameters()
103 {
104 return $this->parameter ? $this->parameter : array();
105 }
106
113 public function loginObserver($a_username, $a_auth)
114 {
115 global $ilLog;
116
117 $ilLog->write(
118 __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(
135 __METHOD__ . ': login failed for user ' . $a_username .
136 ', remote:' . $_SERVER['REMOTE_ADDR'] . ':' . $_SERVER['REMOTE_PORT'] .
137 ', server:' . $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT']
138 );
139 return false;
140 }
141
148 public function checkAuthObserver($a_username, $a_auth)
149 {
150 global $ilLog;
151
152 //$ilLog->write(__METHOD__.': checkAuth called');
153
154 return true;
155 }
156
163 public function logoutObserver($a_username, $a_auth)
164 {
165 global $ilLog;
166
167 $ilLog->write(
168 __METHOD__ . ': User logged out: ' . $a_username .
169 ', remote:' . $_SERVER['REMOTE_ADDR'] . ':' . $_SERVER['REMOTE_PORT'] .
170 ', server:' . $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT']
171 );
172 }
173}
An exception for terminatinating execution or to throw for unit testing.
Abstract decorator for PEAR::Auth Base class for all Ilias Authentication classes.
appendParameter($a_key, $a_value)
Add a parameter.
initContainer()
Init the PEAR container.
checkAuthObserver($a_username, $a_auth)
Called from base class after call of checkAuth.
logoutObserver($a_username, $a_auth)
Called from base class after logout.
__call($name, $arguments)
Wrapper for all PEAR_Auth_Container methods.
setContainer($a_container)
set pear container
getParameters()
get auth container parameters
failedLoginObserver($a_username, $a_auth)
Called from base class after failed login.
if($format !==null) $name
Definition: metadata.php:146
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']