TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Core\Authentication\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
|
||||
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
|
||||
|
||||
/**
|
||||
* Class to be extended by events, fired after authentication has failed
|
||||
*/
|
||||
abstract class AbstractAuthenticationFailedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServerRequestInterface $request
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Returns the user, who failed to authenticate successfully
|
||||
*/
|
||||
abstract public function getUser(): AbstractUserAuthentication;
|
||||
|
||||
public function isFrontendAttempt(): bool
|
||||
{
|
||||
return !$this->isBackendAttempt();
|
||||
}
|
||||
|
||||
public function isBackendAttempt(): bool
|
||||
{
|
||||
return $this->getUser() instanceof BackendUserAuthentication;
|
||||
}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Core\Authentication\Event;
|
||||
|
||||
/**
|
||||
* Event fired after user groups have been resolved for a specific user
|
||||
*/
|
||||
final class AfterGroupsResolvedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $sourceDatabaseTable,
|
||||
private array $groups,
|
||||
private readonly array $originalGroupIds,
|
||||
private readonly array $userData
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return string 'be_groups' or 'fe_groups' depending on context.
|
||||
*/
|
||||
public function getSourceDatabaseTable(): string
|
||||
{
|
||||
return $this->sourceDatabaseTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of group records including sub groups as resolved by core.
|
||||
*
|
||||
* Note order is important: A user with main groups "1,2", where 1 has sub group 3,
|
||||
* results in "3,1,2" as record list array - sub groups are listed before the group
|
||||
* that includes the sub group.
|
||||
*/
|
||||
public function getGroups(): array
|
||||
{
|
||||
return $this->groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of group records as manipulated by the event.
|
||||
*/
|
||||
public function setGroups(array $groups): void
|
||||
{
|
||||
$this->groups = $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of group uids directly attached to the user
|
||||
*/
|
||||
public function getOriginalGroupIds(): array
|
||||
{
|
||||
return $this->originalGroupIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Full user record with all fields
|
||||
*/
|
||||
public function getUserData(): array
|
||||
{
|
||||
return $this->userData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Core\Authentication\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
|
||||
|
||||
/**
|
||||
* Event fired after a user has been actively logged in to backend (incl. possible MFA) or frontend.
|
||||
*/
|
||||
final readonly class AfterUserLoggedInEvent
|
||||
{
|
||||
public function __construct(
|
||||
private AbstractUserAuthentication $user,
|
||||
private ?ServerRequestInterface $request = null
|
||||
) {}
|
||||
|
||||
public function getUser(): AbstractUserAuthentication
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function getRequest(): ?ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Core\Authentication\Event;
|
||||
|
||||
use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
|
||||
|
||||
/**
|
||||
* Event fired after a user has been actively logged out.
|
||||
*/
|
||||
final readonly class AfterUserLoggedOutEvent
|
||||
{
|
||||
public function __construct(
|
||||
private AbstractUserAuthentication $user
|
||||
) {}
|
||||
|
||||
public function getUser(): AbstractUserAuthentication
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Core\Authentication\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
|
||||
use TYPO3\CMS\Core\Security\RequestToken;
|
||||
|
||||
/**
|
||||
* Event fired before request-token is processed.
|
||||
*/
|
||||
final class BeforeRequestTokenProcessedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly AbstractUserAuthentication $user,
|
||||
private readonly ServerRequestInterface $request,
|
||||
private RequestToken|false|null $requestToken
|
||||
) {}
|
||||
|
||||
public function getUser(): AbstractUserAuthentication
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getRequestToken(): RequestToken|false|null
|
||||
{
|
||||
return $this->requestToken;
|
||||
}
|
||||
|
||||
public function setRequestToken(RequestToken|false|null $requestToken): void
|
||||
{
|
||||
$this->requestToken = $requestToken;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Core\Authentication\Event;
|
||||
|
||||
use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
|
||||
use TYPO3\CMS\Core\Session\UserSession;
|
||||
|
||||
/**
|
||||
* Event fired before a user is going to be actively logged out.
|
||||
* An option to interrupt the regular logout flow from TYPO3 Core (so you can do this yourself)
|
||||
* is also available.
|
||||
*/
|
||||
final class BeforeUserLogoutEvent
|
||||
{
|
||||
private bool $shouldLogout = true;
|
||||
|
||||
public function __construct(
|
||||
private readonly AbstractUserAuthentication $user,
|
||||
private readonly ?UserSession $userSession
|
||||
) {}
|
||||
|
||||
public function getUser(): AbstractUserAuthentication
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function disableRegularLogoutProcess(): void
|
||||
{
|
||||
$this->shouldLogout = false;
|
||||
}
|
||||
|
||||
public function enableRegularLogoutProcess(): void
|
||||
{
|
||||
$this->shouldLogout = true;
|
||||
}
|
||||
|
||||
public function shouldLogout(): bool
|
||||
{
|
||||
return $this->shouldLogout;
|
||||
}
|
||||
|
||||
public function getUserSession(): ?UserSession
|
||||
{
|
||||
return $this->userSession;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Core\Authentication\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
|
||||
|
||||
/**
|
||||
* Event fired after a login attempt failed.
|
||||
*/
|
||||
final class LoginAttemptFailedEvent extends AbstractAuthenticationFailedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly AbstractUserAuthentication $user,
|
||||
private readonly ServerRequestInterface $request,
|
||||
private readonly array $loginData,
|
||||
) {
|
||||
parent::__construct($this->request);
|
||||
}
|
||||
|
||||
public function getUser(): AbstractUserAuthentication
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function getLoginData(): array
|
||||
{
|
||||
return $this->loginData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Core\Authentication\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
|
||||
use TYPO3\CMS\Core\Authentication\Mfa\MfaProviderManifestInterface;
|
||||
use TYPO3\CMS\Core\Authentication\Mfa\MfaProviderPropertyManager;
|
||||
|
||||
/**
|
||||
* Event fired after MFA verification failed.
|
||||
*/
|
||||
final class MfaVerificationFailedEvent extends AbstractAuthenticationFailedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServerRequestInterface $request,
|
||||
private readonly MfaProviderPropertyManager $propertyManager,
|
||||
private readonly MfaProviderManifestInterface $mfaProvider,
|
||||
) {
|
||||
parent::__construct($this->request);
|
||||
}
|
||||
|
||||
public function getUser(): AbstractUserAuthentication
|
||||
{
|
||||
return $this->propertyManager->getUser();
|
||||
}
|
||||
|
||||
public function getProvider(): MfaProviderManifestInterface
|
||||
{
|
||||
return $this->mfaProvider;
|
||||
}
|
||||
|
||||
public function getProviderIdentifier(): string
|
||||
{
|
||||
return $this->mfaProvider->getIdentifier();
|
||||
}
|
||||
|
||||
public function getProviderProperties(): array
|
||||
{
|
||||
return $this->propertyManager->getProperties();
|
||||
}
|
||||
|
||||
public function isProviderLocked(): bool
|
||||
{
|
||||
return $this->mfaProvider->isLocked($this->propertyManager);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user