ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilAuthFrontendFactory.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  private const int CONTEXT_UNDEFINED = 0;
28  public const int CONTEXT_STANDARD_FORM = 2;
29  public const int CONTEXT_CLI = 3;
31  public const int CONTEXT_WS = 4;
32  public const int CONTEXT_HTTP = 5;
33 
34  private int $context = self::CONTEXT_UNDEFINED;
35  private ilLogger $logger;
36 
37  public function __construct()
38  {
39  global $DIC;
40  $this->logger = $DIC->logger()->auth();
41  }
42 
43  public function setContext(int $a_context): void
44  {
45  $this->context = $a_context;
46  }
47 
48  public function getContext(): int
49  {
50  return $this->context;
51  }
52 
56  public function getFrontend(
57  ilAuthSession $session,
58  ilAuthStatus $status,
59  ilAuthCredentials $credentials,
60  array $providers
62  switch ($this->getContext()) {
63  case self::CONTEXT_CLI:
64  $this->logger->debug('Init auth frontend with standard auth context');
65  $frontend = new ilAuthFrontendCLI(
66  $session,
67  $status,
68  $credentials,
69  $providers
70  );
71  return $frontend;
72 
73  case self::CONTEXT_WS:
74  $this->logger->debug('Init auth frontend with webservice auth context');
75  $frontend = new ilAuthFrontendWS(
76  $session,
77  $status,
78  $credentials,
79  $providers
80  );
81  return $frontend;
82 
83  case self::CONTEXT_STANDARD_FORM:
84  $this->logger->debug('Init auth frontend with standard auth context');
85  $frontend = new ilAuthStandardFormFrontend(
86  $session,
87  $status,
88  $credentials,
89  $providers
90  );
91  return $frontend;
92 
93  case self::CONTEXT_HTTP:
94  $this->logger->debug('Init auth frontend with http basic auth context');
95  $frontend = new ilAuthFrontendHTTP(
96  $session,
97  $status,
98  $credentials,
99  $providers
100  );
101  return $frontend;
102 
103  case self::CONTEXT_UNDEFINED:
104  $this->logger->error('Trying to init auth with empty context');
105  break;
106  }
107 
108  return null;
109  }
110 }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getFrontend(ilAuthSession $session, ilAuthStatus $status, ilAuthCredentials $credentials, array $providers)
global $DIC
Definition: shib_login.php:26
const int CONTEXT_STANDARD_FORM
Authentication with id and password.