ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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{
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
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()) {
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(
80 $status,
82 $providers
83 );
84 return $frontend;
85
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(
91 $status,
93 $providers
94 );
95 return $frontend;
96
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,
104 $providers
105 );
106 return $frontend;
107
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,
115 $providers
116 );
117 return $frontend;
118
120 $this->getLogger()->error('Trying to init auth with empty context');
121 break;
122 }
123 }
124}
An exception for terminatinating execution or to throw for unit testing.
Description of class class.
Factory for auth frontend classes.
getFrontend(ilAuthSession $session, ilAuthStatus $status, ilAuthCredentials $credentials, array $providers)
setContext($a_context)
Set context for following authentication requests.
Description of class class.
Description of class class.
Auth class for form based authentication.
Auth status implementation.
static getLogger($a_component_id)
Get component logger.
Interface of auth credentials.
$session