ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAuthFrontendCredentialsSoap.php
Go to the documentation of this file.
1 <?php
3 
5 {
7  private $httpRequest;
8 
10  private $ctrl;
11 
13  private $settings;
14 
22  {
23  $this->httpRequest = $httpRequest;
24  $this->ctrl = $ctrl;
25  $this->settings = $settings;
26  parent::__construct();
27  }
28 
32  public function tryAuthenticationOnLoginPage()
33  {
34  $cmd = '';
35  if (isset($this->httpRequest->getQueryParams()['cmd']) && is_string($this->httpRequest->getQueryParams()['cmd'])) {
36  $cmd = $this->httpRequest->getQueryParams()['cmd'];
37  }
38  if ('' === $cmd) {
39  if (isset($this->httpRequest->getParsedBody()['cmd']) && is_string($this->httpRequest->getParsedBody()['cmd'])) {
40  $cmd = $this->httpRequest->getParsedBody()['cmd'];
41  }
42  }
43 
44  $passedSso = '';
45  if (isset($this->httpRequest->getQueryParams()['passed_sso']) && is_string($this->httpRequest->getQueryParams()['passed_sso'])) {
46  $passedSso = $this->httpRequest->getParsedBody()['passed_sso'];
47  }
48 
49  if ('force_login' === $cmd || !empty($passedSso)) {
50  return false;
51  }
52 
53  if (!$this->settings->get('soap_auth_active', false)) {
54  return false;
55  }
56 
57  if (empty($this->getUsername()) || empty($this->getPassword())) {
58  return false;
59  }
60 
61  $this->getLogger()->debug('Using SOAP authentication.');
62 
63  $status = ilAuthStatus::getInstance();
64 
65  require_once 'Services/SOAPAuth/classes/class.ilAuthProviderSoap.php';
66  $provider = new ilAuthProviderSoap($this);
67 
68  $frontend_factory = new ilAuthFrontendFactory();
69  $frontend_factory->setContext(ilAuthFrontendFactory::CONTEXT_STANDARD_FORM);
70  $frontend = $frontend_factory->getFrontend(
71  $GLOBALS['DIC']['ilAuthSession'],
72  $status,
73  $this,
74  [$provider]
75  );
76 
77  $frontend->authenticate();
78 
79  switch ($status->getStatus()) {
81  ilLoggerFactory::getLogger('auth')->debug(
82  'Redirecting to default starting page.'
83  );
84  ilInitialisation::redirectToStartingPage();
85  break;
86 
88  ilUtil::sendFailure($status->getTranslatedReason(), true);
89  $this->ctrl->redirectToURL(ilUtil::appendUrlParameterString(
90  $this->ctrl->getLinkTargetByClass('ilStartupGUI', 'showLoginPage', '', false, false),
91  'passed_sso=1'
92  ));
93  break;
94  }
95  }
96 }
This class provides processing control methods.
Representation of an incoming, server-side HTTP request.
settings()
Definition: settings.php:2
tryAuthenticationOnLoginPage()
Check if an authentication attempt should be done when login page has been called.
const STATUS_AUTHENTICATION_FAILED
Factory for auth frontend classes.
Class ilAuthProviderSoap.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
__construct(ServerRequestInterface $httpRequest, ilCtrl $ctrl, ilSetting $settings)
ilAuthFrontendCredentialsApache constructor.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getInstance()
Get status instance.
static getLogger($a_component_id)
Get component logger.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.