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{
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())
75 {
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,
83 $providers
84 );
85 return $frontend;
86
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,
94 $providers
95 );
96 return $frontend;
97
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,
105 $providers
106 );
107 return $frontend;
108
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,
116 $providers
117 );
118 return $frontend;
119
121 $this->getLogger()->error('Trying to init auth with empty context');
122 break;
123 }
124 }
125
126}
127?>
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.