ILIAS  release_8 Revision v8.24
class.ilAuthFrontendCredentialsSoap.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use Psr\Http\Message\ServerRequestInterface;
22
24{
25 private ServerRequestInterface $httpRequest;
26
27 private ilCtrl $ctrl;
28
30
32 private \ilGlobalTemplateInterface $main_tpl;
34
41 public function __construct(ServerRequestInterface $httpRequest, ilCtrl $ctrl, ilSetting $settings)
42 {
43 global $DIC;
44 $this->main_tpl = $DIC->ui()->mainTemplate();
45 $this->authSession = $DIC['ilAuthSession'];
46 $this->logger = $DIC->logger()->auth();
47 $this->httpRequest = $httpRequest;
48 $this->ctrl = $ctrl;
49 $this->settings = $settings;
51 }
52
56 public function tryAuthenticationOnLoginPage(): void
57 {
58 $cmd = '';
59 if (isset($this->httpRequest->getQueryParams()['cmd']) && is_string($this->httpRequest->getQueryParams()['cmd'])) {
60 $cmd = $this->httpRequest->getQueryParams()['cmd'];
61 }
62 if ('' === $cmd &&
63 isset($this->httpRequest->getParsedBody()['cmd']) && is_string($this->httpRequest->getParsedBody()['cmd'])) {
64 $cmd = $this->httpRequest->getParsedBody()['cmd'];
65 }
66
67 $passedSso = '';
68 if (isset($this->httpRequest->getQueryParams()['passed_sso']) && is_string($this->httpRequest->getQueryParams()['passed_sso'])) {
69 $passedSso = $this->httpRequest->getQueryParams()['passed_sso'];
70 }
71
72 if (!empty($passedSso)) {
73 return;
74 }
75
76 if (!(bool) $this->settings->get('soap_auth_active', "")) {
77 return;
78 }
79
80 if (empty($this->getUsername()) || empty($this->getPassword())) {
81 return;
82 }
83
84 $this->logger->debug('Using SOAP authentication.');
85
86 $status = ilAuthStatus::getInstance();
87
88 $provider = new ilAuthProviderSoap($this);
89
90 $frontend_factory = new ilAuthFrontendFactory();
91 $frontend_factory->setContext(ilAuthFrontendFactory::CONTEXT_STANDARD_FORM);
92 $frontend = $frontend_factory->getFrontend(
93 $this->authSession,
94 $status,
95 $this,
96 [$provider]
97 );
98
99 $frontend->authenticate();
100
101 switch ($status->getStatus()) {
103 ilLoggerFactory::getLogger('auth')->debug(
104 'Redirecting to default starting page.'
105 );
107 break;
108
110 $this->main_tpl->setOnScreenMessage('failure', $status->getTranslatedReason(), true);
111 $this->ctrl->redirectToURL(ilUtil::appendUrlParameterString(
112 $this->ctrl->getLinkTargetByClass('ilStartupGUI', 'showLoginPage', '', false, false),
113 'passed_sso=1'
114 ));
115 break;
116 }
117 }
118}
tryAuthenticationOnLoginPage()
Check if an authentication attempt should be done when login page has been called.
__construct(ServerRequestInterface $httpRequest, ilCtrl $ctrl, ilSetting $settings)
ilAuthFrontendCredentialsApache constructor.
Factory for auth frontend classes.
Class ilAuthProviderSoap.
static getInstance()
Get status instance.
const STATUS_AUTHENTICATION_FAILED
Class ilCtrl provides processing control methods.
static redirectToStartingPage(string $target='')
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc