19declare(strict_types=1);
53 "Microsoft-WebDAV-MiniRedir",
72 return array_any($this->session_aware_webdav_clients, fn($webdav_client_name):
string|
false => stristr($user_agent, (
string) $webdav_client_name));
77 return $_SERVER[
"HTTP_USER_AGENT"] ??
'';
80 public function authenticate(
string $a_username,
string $a_password): bool
84 $cached = $this->file_cache->isAuthenticated($a_username, $a_password);
85 if ($cached !==
null) {
86 $this->
logger->info(
'WEBDAV: User authenticated through cache. UserID = ' . $cached);
87 $DIC->user()->setId($cached);
92 if ($this->session->isAuthenticated()
93 && $this->user->getId() !== 0
95 $this->
logger->debug(
'User authenticated through session. UserID = ' . $this->
user->getId());
103 $credentials->setUsername($a_username);
104 $credentials->setPassword($a_password);
107 $providers = $provider_factory->getProviders($credentials);
113 $frontend = $frontend_factory->getFrontend(
120 $frontend->authenticate();
122 switch ($status->getStatus()) {
125 'User authenticated through basic authentication. UserId = ' . $this->
user->getId()
128 $this->file_cache->setAuthenticated($a_username, $a_password, (
int)
$DIC->user()->getId());
132 $this->
logger->info(
'Basic authentication failed; Account migration required.');
136 $this->
logger->info(
'Basic authentication failed; Wrong login, password.');
Key rotation can provide an extra layer of mitigation against an attacker discovering a secret key.
authenticate(string $a_username, string $a_password)
array $session_aware_webdav_clients
__construct(protected ilObjUser $user, protected ilAuthSession $session, protected ilLogger $logger, Filesystem $filesystem, SecretKeyRotation $secret_key_rotation)
ILIASAuthenticationFileCache $file_cache
isUserAgentSessionAware(string $user_agent)
const int STATUS_AUTHENTICATION_FAILED
const int STATUS_ACCOUNT_MIGRATION_REQUIRED
const int STATUS_AUTHENTICATED
static getInstance()
Get status instance.
Component logger with individual log levels by component id.
static enableWebAccessWithoutSession(bool $enable_web_access_without_session)
The filesystem interface provides the public interface for the Filesystem service API consumer.