ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Container.php
Go to the documentation of this file.
1<?php
2/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
3
4include_once './Services/Authentication/classes/class.ilAuthContainerBase.php';
5
40{
41
42 // {{{ properties
43
49 var $activeUser = "";
50
56 var $_auth_obj = null;
57
58 // }}}
59 // {{{ Auth_Container() [constructor]
60
68 function Auth_Container()
69 {
70 }
71
72 // }}}
73 // {{{ fetchData()
74
82 function fetchData($username, $password, $isChallengeResponse=false)
83 {
84 $this->log('Auth_Container::fetchData() called.', AUTH_LOG_DEBUG);
85 }
86
87 // }}}
88 // {{{ verifyPassword()
89
101 function verifyPassword($password1, $password2, $cryptType = "md5")
102 {
103 $this->log('Auth_Container::verifyPassword() called.', AUTH_LOG_DEBUG);
104 switch ($cryptType) {
105 case "crypt" :
106 return ((string)crypt($password1, $password2) === (string)$password2);
107 break;
108 case "none" :
109 case "" :
110 return ((string)$password1 === (string)$password2);
111 break;
112 case "md5" :
113 return ((string)md5($password1) === (string)$password2);
114 break;
115 default :
116 if (function_exists($cryptType)) {
117 return ((string)$cryptType($password1) === (string)$password2);
118 } elseif (method_exists($this,$cryptType)) {
119 return ((string)$this->$cryptType($password1) === (string)$password2);
120 } else {
121 return false;
122 }
123 break;
124 }
125 }
126
127 // }}}
128 // {{{ supportsChallengeResponse()
129
135 {
136 return(false);
137 }
138
139 // }}}
140 // {{{ getCryptType()
141
147 function getCryptType()
148 {
149 return('');
150 }
151
152 // }}}
153 // {{{ listUsers()
154
158 function listUsers()
159 {
160 $this->log('Auth_Container::listUsers() called.', AUTH_LOG_DEBUG);
162 }
163
164 // }}}
165 // {{{ getUser()
166
174 function getUser($username)
175 {
176 $this->log('Auth_Container::getUser() called.', AUTH_LOG_DEBUG);
177 $users = $this->listUsers();
178 if ($users === AUTH_METHOD_NOT_SUPPORTED) {
180 }
181 for ($i=0; $c = count($users), $i<$c; $i++) {
182 if ($users[$i]['username'] == $username) {
183 return $users[$i];
184 }
185 }
186 return false;
187 }
188
189 // }}}
190 // {{{ addUser()
191
201 function addUser($username, $password, $additional=null)
202 {
203 $this->log('Auth_Container::addUser() called.', AUTH_LOG_DEBUG);
205 }
206
207 // }}}
208 // {{{ removeUser()
209
215 function removeUser($username)
216 {
217 $this->log('Auth_Container::removeUser() called.', AUTH_LOG_DEBUG);
219 }
220
221 // }}}
222 // {{{ changePassword()
223
230 function changePassword($username, $password)
231 {
232 $this->log('Auth_Container::changePassword() called.', AUTH_LOG_DEBUG);
234 }
235
236 // }}}
237 // {{{ log()
238
246 function log($message, $level = AUTH_LOG_DEBUG) {
247
248 if (is_null($this->_auth_obj)) {
249
250 return false;
251
252 } else {
253
254 return $this->_auth_obj->log($message, $level);
255
256 }
257
258 }
259
260 // }}}
261
262}
263
264?>
const AUTH_LOG_DEBUG
Auth Log level - DEBUG.
Definition: Auth.php:59
const AUTH_METHOD_NOT_SUPPORTED
Returned if a container method is not supported.
Definition: Auth.php:42
$activeUser
User that is currently selected from the storage container.
Definition: Container.php:49
fetchData($username, $password, $isChallengeResponse=false)
Fetch data from storage container.
Definition: Container.php:82
getUser($username)
Returns a user assoc array.
Definition: Container.php:174
supportsChallengeResponse()
Returns true if the container supports Challenge Response password authentication.
Definition: Container.php:134
changePassword($username, $password)
Change password for user in the storage container.
Definition: Container.php:230
Auth_Container()
Constructor.
Definition: Container.php:68
addUser($username, $password, $additional=null)
Add a new user to the storage container.
Definition: Container.php:201
removeUser($username)
Remove user from the storage container.
Definition: Container.php:215
getCryptType()
Returns the crypt current crypt type of the container.
Definition: Container.php:147
listUsers()
List all users that are available from the storage container.
Definition: Container.php:158
verifyPassword($password1, $password2, $cryptType="md5")
Crypt and verfiy the entered password.
Definition: Container.php:101
$_auth_obj
The Auth object this container is attached to.
Definition: Container.php:56
log($message, $level=AUTH_LOG_DEBUG)
Log a message to the Auth log.
Definition: Container.php:246
@classDescription Base class for all ILIAS PEAR container classes
$additional
Definition: goto.php:89