ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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;
30
31 public function __construct(ServerRequestInterface $httpRequest, ilCtrlInterface $ctrl, ilSetting $settings)
32 {
33 global $DIC;
34 $this->main_tpl = $DIC->ui()->mainTemplate();
35 $this->authSession = $DIC['ilAuthSession'];
36 $this->httpRequest = $httpRequest;
37 $this->ctrl = $ctrl;
38 $this->settings = $settings;
40 }
41
45 public function tryAuthenticationOnLoginPage(): void
46 {
47 $passedSso = '';
48 if (isset($this->httpRequest->getQueryParams()['passed_sso']) && is_string($this->httpRequest->getQueryParams()['passed_sso'])) {
49 $passedSso = $this->httpRequest->getQueryParams()['passed_sso'];
50 }
51
52 if (!empty($passedSso)) {
53 return;
54 }
55
56 if (!$this->settings->get('soap_auth_active', '')) {
57 return;
58 }
59
60 if (empty($this->getUsername()) || empty($this->getPassword())) {
61 return;
62 }
63
64 $this->logger->debug('Using SOAP authentication.');
65
66 $status = ilAuthStatus::getInstance();
67
68 $provider = new ilAuthProviderSoap($this);
69
70 $frontend_factory = new ilAuthFrontendFactory();
71 $frontend_factory->setContext(ilAuthFrontendFactory::CONTEXT_STANDARD_FORM);
72 $frontend = $frontend_factory->getFrontend(
73 $this->authSession,
74 $status,
75 $this,
76 [$provider]
77 );
78 $frontend->authenticate();
79
80 switch ($status->getStatus()) {
82 ilLoggerFactory::getLogger('auth')->debug(
83 'Redirecting to default starting page.'
84 );
86 break;
87
89 $this->main_tpl->setOnScreenMessage('failure', $status->getTranslatedReason(), true);
90 $this->ctrl->redirectToURL(ilUtil::appendUrlParameterString(
91 $this->ctrl->getLinkTargetByClass('ilStartupGUI', 'showLoginPage', '', false, false),
92 'passed_sso=1'
93 ));
94 break;
95 }
96 }
97}
__construct(ServerRequestInterface $httpRequest, ilCtrlInterface $ctrl, ilSetting $settings)
tryAuthenticationOnLoginPage()
Check if an authentication attempt should be done when login page has been called.
const int CONTEXT_STANDARD_FORM
Authentication with id and password.
const int STATUS_AUTHENTICATION_FAILED
const int STATUS_AUTHENTICATED
static getInstance()
Get status instance.
static redirectToStartingPage(string $target='')
static getLogger(string $a_component_id)
Get component logger.
ILIAS Setting Class.
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$provider
Definition: ltitoken.php:80
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26