ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAuthBase.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 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 
33 abstract class ilAuthBase
34 {
35  // Used for SOAP Auth
36  // TODO: Find another solution
37  protected $sub_status = null;
38 
44  public function supportRedirects()
45  {
46  return true;
47  }
48 
53  public final function getContainer()
54  {
55  return $this->storage;
56  }
57 
63  protected final function initAuth()
64  {
65  $GLOBALS['ilLog']->write(__METHOD__.': Init callbacks');
66  $this->setLoginCallback(array($this,'loginObserver'));
67  $this->setFailedLoginCallback(array($this,'failedLoginObserver'));
68  $this->setCheckAuthCallback(array($this,'checkAuthObserver'));
69  $this->setLogoutCallback(array($this,'logoutObserver'));
70 
71  include_once('Services/Authentication/classes/class.ilAuthLogObserver.php');
72  $this->attachLogObserver(new ilAuthLogObserver(AUTH_LOG_INFO));
73  $this->enableLogging = true;
74 
75  }
76 
83  protected function loginObserver($a_username,$a_auth)
84  {
85  global $ilLog, $ilAppEventHandler;
86 
87  if($this->getContainer()->loginObserver($a_username,$a_auth))
88  {
89  $ilAppEventHandler->raise("Services/Authentication", "afterLogin",
90  array("user_name" => $a_username));
91 
92  $ilLog->write(__METHOD__.': logged in as '.$a_username.
93  ', remote:'.$_SERVER['REMOTE_ADDR'].':'.$_SERVER['REMOTE_PORT'].
94  ', server:'.$_SERVER['SERVER_ADDR'].':'.$_SERVER['SERVER_PORT']
95  );
96  }
97 
98  }
99 
100 
107  protected function failedLoginObserver($a_username,$a_auth)
108  {
109  global $ilLog;
110 
111  $this->getContainer()->failedLoginObserver($a_username,$a_auth);
112  $ilLog->write(__METHOD__.': login failed for user '.$a_username.
113  ', remote:'.$_SERVER['REMOTE_ADDR'].':'.$_SERVER['REMOTE_PORT'].
114  ', server:'.$_SERVER['SERVER_ADDR'].':'.$_SERVER['SERVER_PORT']
115  );
116  }
117 
124  protected function checkAuthObserver($a_username,$a_auth)
125  {
126  #$GLOBALS['ilLog']->write(__METHOD__.': Check auth observer called');
127  return $this->getContainer()->checkAuthObserver($a_username,$a_auth);
128  }
129 
136  protected function logoutObserver($a_username,$a_auth)
137  {
138  $GLOBALS['ilLog']->write(__METHOD__.': Logout observer called');
139  $this->getContainer()->logoutObserver($a_username,$a_auth);
140  }
141 
142 }
143 ?>