ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAuthFrontendFactory.php
Go to the documentation of this file.
1<?php
2
19declare(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
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()) {
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
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
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
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
104 $this->logger->error('Trying to init auth with empty context');
105 break;
106 }
107
108 return null;
109 }
110}
getFrontend(ilAuthSession $session, ilAuthStatus $status, ilAuthCredentials $credentials, array $providers)
const int CONTEXT_STANDARD_FORM
Authentication with id and password.
Component logger with individual log levels by component id.
global $DIC
Definition: shib_login.php:26