ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilAuthFrontendFactory.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 
12 {
13  const CONTEXT_UNDEFINED = 0;
14 
15  // authentication with id and password. Used for standard form based authentication
16  // soap auth (login) but not for (CLI (cron)?) and HTTP basic authentication
18 
19  // CLI context for cron
20  const CONTEXT_CLI = 3;
21 
22  // Rest soap context
23  const CONTEXT_WS = 4;
24 
25  // http auth
26  const CONTEXT_HTTP = 5;
27 
28 
29  private $context = self::CONTEXT_UNDEFINED;
30  private $credentials = null;
31  private $logger = null;
32 
33 
37  public function __construct()
38  {
39  $this->logger = ilLoggerFactory::getLogger('auth');
40  }
41 
46  public function getLogger()
47  {
48  return $this->logger;
49  }
50 
55  public function setContext($a_context)
56  {
57  $this->context = $a_context;
58  }
59 
64  public function getContext()
65  {
66  return $this->context;
67  }
68 
72  public function getFrontend(ilAuthSession $session, ilAuthStatus $status, ilAuthCredentials $credentials, array $providers)
73  {
74  switch($this->getContext())
75  {
76  case self::CONTEXT_CLI:
77  $this->getLogger()->debug('Init auth frontend with standard auth context');
78  include_once './Services/Authentication/classes/Frontend/class.ilAuthFrontendCLI.php';
79  $frontend = new ilAuthFrontendCLI(
80  $session,
81  $status,
82  $credentials,
83  $providers
84  );
85  return $frontend;
86 
87  case self::CONTEXT_WS:
88  $this->getLogger()->debug('Init auth frontend with webservice auth context');
89  include_once './Services/Authentication/classes/Frontend/class.ilAuthFrontendWS.php';
90  $frontend = new ilAuthFrontendWS(
91  $session,
92  $status,
93  $credentials,
94  $providers
95  );
96  return $frontend;
97 
98  case self::CONTEXT_STANDARD_FORM:
99  $this->getLogger()->debug('Init auth frontend with standard auth context');
100  include_once './Services/Authentication/classes/Frontend/class.ilAuthStandardFormFrontend.php';
101  $frontend = new ilAuthStandardFormFrontend(
102  $session,
103  $status,
104  $credentials,
105  $providers
106  );
107  return $frontend;
108 
109  case self::CONTEXT_HTTP:
110  $this->getLogger()->debug('Init auth frontend with http basic auth context');
111  include_once './Services/Authentication/classes/Frontend/class.ilAuthFrontendHTTP.php';
112  $frontend = new ilAuthFrontendHTTP(
113  $session,
114  $status,
115  $credentials,
116  $providers
117  );
118  return $frontend;
119 
120  case self::CONTEXT_UNDEFINED:
121  $this->getLogger()->error('Trying to init auth with empty context');
122  break;
123  }
124  }
125 
126 }
127 ?>
Description of class class.
Description of class class.
Interface of auth credentials.
Factory for auth frontend classes.
getFrontend(ilAuthSession $session, ilAuthStatus $status, ilAuthCredentials $credentials, array $providers)
setContext($a_context)
Set context for following authentication requests.
Create styles array
The data for the language used.
Auth class for form based authentication.
static getLogger($a_component_id)
Get component logger.
Auth status implementation.
Description of class class.