ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
73  {
74  switch ($this->getContext()) {
75  case self::CONTEXT_CLI:
76  $this->getLogger()->debug('Init auth frontend with standard auth context');
77  include_once './Services/Authentication/classes/Frontend/class.ilAuthFrontendCLI.php';
78  $frontend = new ilAuthFrontendCLI(
79  $session,
80  $status,
81  $credentials,
82  $providers
83  );
84  return $frontend;
85 
86  case self::CONTEXT_WS:
87  $this->getLogger()->debug('Init auth frontend with webservice auth context');
88  include_once './Services/Authentication/classes/Frontend/class.ilAuthFrontendWS.php';
89  $frontend = new ilAuthFrontendWS(
90  $session,
91  $status,
92  $credentials,
93  $providers
94  );
95  return $frontend;
96 
97  case self::CONTEXT_STANDARD_FORM:
98  $this->getLogger()->debug('Init auth frontend with standard auth context');
99  include_once './Services/Authentication/classes/Frontend/class.ilAuthStandardFormFrontend.php';
100  $frontend = new ilAuthStandardFormFrontend(
101  $session,
102  $status,
103  $credentials,
104  $providers
105  );
106  return $frontend;
107 
108  case self::CONTEXT_HTTP:
109  $this->getLogger()->debug('Init auth frontend with http basic auth context');
110  include_once './Services/Authentication/classes/Frontend/class.ilAuthFrontendHTTP.php';
111  $frontend = new ilAuthFrontendHTTP(
112  $session,
113  $status,
114  $credentials,
115  $providers
116  );
117  return $frontend;
118 
119  case self::CONTEXT_UNDEFINED:
120  $this->getLogger()->error('Trying to init auth with empty context');
121  break;
122  }
123  }
124 }
Description of class class.
Description of class class.
Interface of auth credentials.
Factory for auth frontend classes.
$session
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.