ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAuthFrontendHTTP.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
24
28 public function __construct(
29 ilAuthSession $session,
32 array $providers
33 ) {
35
36 global $DIC;
37 $this->logger = $DIC->logger()->auth();
38 }
39
40 public function authenticate(): bool
41 {
42 foreach ($this->getProviders() as $provider) {
43 $this->resetStatus();
44
45 $this->logger->debug('Trying authentication against: ' . get_class($provider));
46
47 $provider->doAuthentication($this->getStatus());
48
49 $this->logger->debug('Authentication user id: ' . $this->getStatus()
50 ->getAuthenticatedUserId());
51
52 switch ($this->getStatus()->getStatus()) {
54 return $this->handleAuthenticationSuccess($provider);
55
57 $this->logger->notice('Account migration required.');
58 break;
59
61 default:
62 $this->logger->debug('Authentication failed against: ' . get_class($provider));
63 break;
64 }
65 }
66 return $this->handleAuthenticationFail();
67 }
68
69 protected function handleAuthenticationFail(): bool
70 {
71 parent::handleAuthenticationFail();
72
73 header('WWW-Authenticate: Basic realm="' . CLIENT_ID . '"');
74 header('HTTP/1.0 401 Unauthorized');
75 return false;
76 }
77}
__construct(ilAuthSession $session, ilAuthStatus $status, ilAuthCredentials $credentials, array $providers)
ilAuthCredentials $credentials
handleAuthenticationSuccess(ilAuthProviderInterface $provider)
const int STATUS_AUTHENTICATION_FAILED
const int STATUS_ACCOUNT_MIGRATION_REQUIRED
const int STATUS_AUTHENTICATED
Component logger with individual log levels by component id.
const CLIENT_ID
Definition: constants.php:41
$provider
Definition: ltitoken.php:80
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26