ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LoginPerformer.php
Go to the documentation of this file.
1<?php
2
20
21use ilLogger;
24use ilLanguage;
28use ilAuthUtils;
29use ilAuthStatus;
31use ilException;
33use ilStartUpGUI;
34
39{
40 public function __construct(
41 private ilLogger $logger,
42 private ilCtrlInterface $ctrl,
43 private ilGlobalTemplateInterface $template,
44 private ilLanguage $lng,
45 private ilAuthSession $auth_ession,
46 ) {
47 }
48
49 public function doShibbolethAuthentication(): void
50 {
51 $this->logger->debug('Trying shibboleth authentication');
52
53 $credentials = new ilAuthFrontendCredentialsShibboleth();
54 $credentials->initFromRequest();
55
56 $provider_factory = new ilAuthProviderFactory();
57 $provider = $provider_factory->getProviderByAuthMode($credentials, ilAuthUtils::AUTH_SHIBBOLETH);
58
59 $status = ilAuthStatus::getInstance();
60
61 $frontend_factory = new ilAuthFrontendFactory();
62 $frontend_factory->setContext(ilAuthFrontendFactory::CONTEXT_STANDARD_FORM);
63 $frontend = $frontend_factory->getFrontend(
64 $this->auth_ession,
65 $status,
66 $credentials,
67 [$provider]
68 ) ?? throw new ilException('No frontend found');
69 $frontend->authenticate();
70
71 switch ($status->getStatus()) {
73 $this->logger->debug('Authentication successful; Redirecting to starting page.');
75
76 // no break
78 $this->ctrl->redirect($this, 'showAccountMigration');
79
80 // no break
82 $this->template->setOnScreenMessage('failure', $status->getTranslatedReason(), true);
83 $this->ctrl->redirect($this, 'showLoginPage');
84 }
85
86 $this->template->setOnScreenMessage('failure', $this->lng->txt('err_wrong_login'), true);
87 $this->ctrl->setTargetScript('ilias.php');
88 $this->ctrl->redirectByClass(ilStartUpGUI::class, 'showLoginPage');
89 }
90}
__construct(private ilLogger $logger, private ilCtrlInterface $ctrl, private ilGlobalTemplateInterface $template, private ilLanguage $lng, private ilAuthSession $auth_ession,)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const int CONTEXT_STANDARD_FORM
Authentication with id and password.
const int STATUS_AUTHENTICATION_FAILED
const int STATUS_ACCOUNT_MIGRATION_REQUIRED
const int STATUS_AUTHENTICATED
static getInstance()
Get status instance.
const int AUTH_SHIBBOLETH
Base class for ILIAS Exception handling.
ILIAS Initialisation Utility Class perform basic setup: init database handler, load configuration fil...
static redirectToStartingPage(string $target='')
language handling
Component logger with individual log levels by component id.
@ilCtrl_Calls ilStartUpGUI: ilAccountRegistrationGUI, ilPasswordAssistanceGUI, ilLoginPageGUI,...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$provider
Definition: ltitoken.php:80
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $lng
Definition: privfeed.php:31