ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 $DIC;
116
117 $ilLog = $DIC['ilLog'];
118
119 $ilLog->write(
120 __METHOD__ . ': logged in as ' . $a_username .
121 ', remote:' . $_SERVER['REMOTE_ADDR'] . ':' . $_SERVER['REMOTE_PORT'] .
122 ', server:' . $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT']
123 );
124 }
125
132 public function failedLoginObserver($a_username, $a_auth)
133 {
134 global $DIC;
135
136 $ilLog = $DIC['ilLog'];
137
138 $ilLog->write(
139 __METHOD__ . ': login failed for user ' . $a_username .
140 ', remote:' . $_SERVER['REMOTE_ADDR'] . ':' . $_SERVER['REMOTE_PORT'] .
141 ', server:' . $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT']
142 );
143 return false;
144 }
145
152 public function checkAuthObserver($a_username, $a_auth)
153 {
154 global $DIC;
155
156 $ilLog = $DIC['ilLog'];
157
158 //$ilLog->write(__METHOD__.': checkAuth called');
159
160 return true;
161 }
162
169 public function logoutObserver($a_username, $a_auth)
170 {
171 global $DIC;
172
173 $ilLog = $DIC['ilLog'];
174
175 $ilLog->write(
176 __METHOD__ . ': User logged out: ' . $a_username .
177 ', remote:' . $_SERVER['REMOTE_ADDR'] . ':' . $_SERVER['REMOTE_PORT'] .
178 ', server:' . $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT']
179 );
180 }
181}
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.
global $DIC
Definition: saml.php:7
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']