ILIAS  release_8 Revision v8.24
class.ilAuthFrontendHTTP.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
27
29 {
31
32 global $DIC;
33 $this->logger = $DIC->logger()->auth();
34 }
35
36 public function authenticate(): bool
37 {
38 foreach ($this->getProviders() as $provider) {
39 $this->resetStatus();
40
41 $this->logger->debug('Trying authentication against: ' . get_class($provider));
42
43 $provider->doAuthentication($this->getStatus());
44
45 $this->logger->debug('Authentication user id: ' . $this->getStatus()
46 ->getAuthenticatedUserId());
47
48 switch ($this->getStatus()->getStatus()) {
50 return $this->handleAuthenticationSuccess($provider);
51
53 $this->logger->notice("Account migration required.");
54 break;
55
57 default:
58 $this->logger->debug('Authentication failed against: ' . get_class($provider));
59 break;
60 }
61 }
62 return $this->handleAuthenticationFail();
63 }
64
68 protected function handleAuthenticationFail(): bool
69 {
70 header("WWW-Authenticate: Basic realm=\"" . CLIENT_ID . "\"");
71 header('HTTP/1.0 401 Unauthorized');
72 return false;
73 }
74}
__construct(ilAuthSession $session, ilAuthStatus $status, ilAuthCredentials $credentials, array $providers)
authenticate()
Try to authenticate user.
handleAuthenticationFail()
Draw basic auth.
resetStatus()
Reset status.
ilAuthCredentials $credentials
getProviders()
Get providers.
handleAuthenticationSuccess(ilAuthProviderInterface $provider)
Handle successful authentication.
Auth status implementation.
const STATUS_AUTHENTICATION_FAILED
const STATUS_ACCOUNT_MIGRATION_REQUIRED
Component logger with individual log levels by component id.
const CLIENT_ID
Definition: constants.php:41
global $DIC
Definition: feed.php:28
Interface of auth credentials.
Interface for auth methods (web form, http, ...)
$provider
Definition: ltitoken.php:83
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$session