ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAuthFactory.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
15 {
20  const CONTEXT_WEB = 1;
21 
29  const CONTEXT_HTTP = 2;
30 
31 
36  const CONTEXT_SOAP = 3;
37 
42  const CONTEXT_CRON = 4;
43 
47  const CONTEXT_CAS = 5;
48 
53  const CONTEXT_CALENDAR = 6;
54 
55 
61 
62 
67  const CONTEXT_ECS = 8;
68 
73  const CONTEXT_OPENID = 9;
74 
75 
80  const CONTEXT_APACHE = 10;
81 
85  private static $context = self::CONTEXT_WEB;
86 
90  private static $context_options = array();
91 
96  public static function getContext()
97  {
98  return self::$context;
99  }
100 
106  public static function setContext($a_context)
107  {
108  self::$context = $a_context;
109  }
110 
118  public static function setContextOptions($a_context,$a_options)
119  {
120  self::$context_options[$a_context] = $a_options;
121  }
122 
127  public static function getContextOptions()
128  {
129  return self::$context_options[$a_context] ?
130  self::$context_options[$a_context] :
131  array();
132  }
133 
134 
141  public static function factory(ilAuthContainerBase $deco)
142  {
143  $options = self::getContextOptions(self::getContext());
144 
145  switch(self::$context)
146  {
147  case self::CONTEXT_WEB:
148  include_once './Services/Authentication/classes/class.ilAuthWeb.php';
149  return new ilAuthWeb($deco,$options);
150 
151  case self::CONTEXT_HTTP:
152  include_once './Services/Authentication/classes/class.ilAuthHTTP.php';
153  return new ilAuthHTTP($deco,$options);
154 
155  case self::CONTEXT_SOAP:
156  include_once './Services/WebServices/SOAP/classes/class.ilAuthSOAP.php';
157  return new ilAuthSOAP($deco,$options);
158 
159  case self::CONTEXT_CAS:
160  include_once './Services/CAS/classes/class.ilAuthCAS.php';
161  return new ilAuthCAS($deco,$options);
162 
163  case self::CONTEXT_CALENDAR:
164  include_once './Services/Calendar/classes/class.ilAuthCalendar.php';
165  return new ilAuthCalendar($deco,$options);
166 
167  case self::CONTEXT_CALENDAR_TOKEN:
168  include_once './Services/Calendar/classes/class.ilAuthCalendarToken.php';
169  include_once './Services/Calendar/classes/class.ilAuthContainerCalendarToken.php';
170  // Force token authentication
171  $GLOBALS['ilLog']->write('Calling calendar token');
172  return new ilAuthCalendarToken(new ilAuthContainerCalendarToken(),$options);
173 
174  case self::CONTEXT_CRON:
175  include_once './cron/classes/class.ilAuthCron.php';
176  return new ilAuthCron($deco,$options);
177 
178  case self::CONTEXT_ECS:
179  include_once './Services/WebServices/ECS/classes/class.ilAuthECS.php';
180  return new ilAuthECS($deco,$options);
181 
182  case self::CONTEXT_OPENID:
183  include_once './Services/OpenId/classes/class.ilAuthOpenId.php';
184  return new ilAuthOpenId($deco,$options);
185 
186  case self::CONTEXT_APACHE:
187  include_once './Services/AuthApache/classes/class.ilAuthApache.php';
188  return new ilAuthApache($deco,$options);
189  }
190  }
191 }
192 ?>