MfaController extends AbstractMfaController uses PageRendererBackendSetupTrait
Controller to provide a multi-factor authentication endpoint.
This is the backend login related view to authenticate against chosen MFA provider.
This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API.
Attributes
- #[AsController]
Table of Contents
Properties
- $allowedActions : array<string|int, mixed>
- $allowedProviders : array<string|int, mixed>
- $authenticationStyleInformation : AuthenticationStyleInformation
- $backendViewFactory : BackendViewFactory
- $eventDispatcher : EventDispatcherInterface
- $extensionConfiguration : ExtensionConfiguration
- $logger : LoggerInterface
- $mfaProviderRegistry : MfaProviderRegistry
- $mfaRequired : bool
- $mfaTsConfig : array<string|int, mixed>
- $pageRenderer : PageRenderer
- $uriBuilder : UriBuilder
Methods
- __construct() : mixed
- handleRequest() : ResponseInterface
- Main entry point, checking prerequisite, initializing and setting up the view and finally dispatching to the requested action.
- injectMfaProviderRegistry() : void
- addCustomAuthenticationFormStyles() : void
- authAction() : ResponseInterface
- Set up the authentication view for the provider by using provider specific content.
- cancelAction() : ResponseInterface
- Allow the user to cancel the multi-factor authentication by calling logoff on the user object, to destroy the session and other already gathered information and finally initiate a redirect back to the login.
- getAlternativeProviders() : array<string|int, ProviderInterface>
- Fetch alternative (activated and allowed) providers for the user to chose from
- getBackendFavicon() : string
- Retrieves configured favicon for backend with fallback.
- getBackendUser() : BackendUserAuthentication
- getLanguageService() : LanguageService
- getMfaProviderFromRequest() : MfaProviderManifestInterface|null
- getNormalizedParams() : NormalizedParams
- getRecommendedProvider() : MfaProviderManifestInterface|null
- Get the recommended provider
- getUriForFileName() : string
- Returns the uri of a relative reference, resolves the "EXT:" prefix (way of referring to files inside extensions) and checks that the file is inside the project root of the TYPO3 installation
- initializeMfaConfiguration() : void
- Initialize MFA configuration based on TSconfig and global configuration
- isActionAllowed() : bool
- isProviderAllowed() : bool
- isValidIdentifier() : bool
- loadStylesheets() : void
- Load all registered stylesheets from $GLOBALS['TYPO3_CONF_VARS']['BE']['stylesheets']
- log() : void
- Log debug information for MFA events
- setUpBasicPageRendererForBackend() : void
- Sets mandatory parameters for the PageRenderer.
- verifyAction() : ResponseInterface
- Handle verification request, receiving from the auth view by forwarding the request to the appropriate provider.
Properties
$allowedActions
protected
array<string|int, mixed>
$allowedActions
= []
$allowedProviders
protected
array<string|int, mixed>
$allowedProviders
$authenticationStyleInformation read-only
protected
AuthenticationStyleInformation
$authenticationStyleInformation
$backendViewFactory read-only
protected
BackendViewFactory
$backendViewFactory
$eventDispatcher read-only
protected
EventDispatcherInterface
$eventDispatcher
$extensionConfiguration read-only
protected
ExtensionConfiguration
$extensionConfiguration
$logger read-only
protected
LoggerInterface
$logger
$mfaProviderRegistry
protected
MfaProviderRegistry
$mfaProviderRegistry
$mfaRequired
protected
bool
$mfaRequired
$mfaTsConfig
protected
array<string|int, mixed>
$mfaTsConfig
$pageRenderer read-only
protected
PageRenderer
$pageRenderer
$uriBuilder read-only
protected
UriBuilder
$uriBuilder
Methods
__construct()
public
__construct(UriBuilder $uriBuilder, AuthenticationStyleInformation $authenticationStyleInformation, PageRenderer $pageRenderer, ExtensionConfiguration $extensionConfiguration, LoggerInterface $logger, BackendViewFactory $backendViewFactory, EventDispatcherInterface $eventDispatcher) : mixed
Parameters
- $uriBuilder : UriBuilder
- $authenticationStyleInformation : AuthenticationStyleInformation
- $pageRenderer : PageRenderer
- $extensionConfiguration : ExtensionConfiguration
- $logger : LoggerInterface
- $backendViewFactory : BackendViewFactory
- $eventDispatcher : EventDispatcherInterface
handleRequest()
Main entry point, checking prerequisite, initializing and setting up the view and finally dispatching to the requested action.
public
handleRequest(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfaceinjectMfaProviderRegistry()
public
injectMfaProviderRegistry(MfaProviderRegistry $mfaProviderRegistry) : void
Parameters
- $mfaProviderRegistry : MfaProviderRegistry
addCustomAuthenticationFormStyles()
protected
addCustomAuthenticationFormStyles() : void
authAction()
Set up the authentication view for the provider by using provider specific content.
protected
authAction(ServerRequestInterface $request, MfaProviderManifestInterface $mfaProvider) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $mfaProvider : MfaProviderManifestInterface
Return values
ResponseInterfacecancelAction()
Allow the user to cancel the multi-factor authentication by calling logoff on the user object, to destroy the session and other already gathered information and finally initiate a redirect back to the login.
protected
cancelAction(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfacegetAlternativeProviders()
Fetch alternative (activated and allowed) providers for the user to chose from
protected
getAlternativeProviders(MfaProviderManifestInterface $mfaProvider) : array<string|int, ProviderInterface>
Parameters
- $mfaProvider : MfaProviderManifestInterface
Return values
array<string|int, ProviderInterface>getBackendFavicon()
Retrieves configured favicon for backend with fallback.
protected
getBackendFavicon(ExtensionConfiguration $extensionConfiguration, ServerRequestInterface $request) : string
Parameters
- $extensionConfiguration : ExtensionConfiguration
- $request : ServerRequestInterface
Return values
stringgetBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServicegetMfaProviderFromRequest()
protected
getMfaProviderFromRequest(ServerRequestInterface $request) : MfaProviderManifestInterface|null
Parameters
- $request : ServerRequestInterface
Return values
MfaProviderManifestInterface|nullgetNormalizedParams()
protected
getNormalizedParams(ServerRequestInterface $request) : NormalizedParams
Parameters
- $request : ServerRequestInterface
Return values
NormalizedParamsgetRecommendedProvider()
Get the recommended provider
protected
getRecommendedProvider() : MfaProviderManifestInterface|null
Return values
MfaProviderManifestInterface|nullgetUriForFileName()
Returns the uri of a relative reference, resolves the "EXT:" prefix (way of referring to files inside extensions) and checks that the file is inside the project root of the TYPO3 installation
protected
getUriForFileName(ServerRequestInterface $request, string $filename) : string
Parameters
- $request : ServerRequestInterface
- $filename : string
-
The input filename/filepath to evaluate
Return values
string —Returns the filename of $filename if valid, otherwise blank string.
initializeMfaConfiguration()
Initialize MFA configuration based on TSconfig and global configuration
protected
initializeMfaConfiguration() : void
isActionAllowed()
protected
isActionAllowed(string $action) : bool
Parameters
- $action : string
Return values
boolisProviderAllowed()
protected
isProviderAllowed(string $identifier) : bool
Parameters
- $identifier : string
Return values
boolisValidIdentifier()
protected
isValidIdentifier(string $identifier) : bool
Parameters
- $identifier : string
Return values
boolloadStylesheets()
Load all registered stylesheets from $GLOBALS['TYPO3_CONF_VARS']['BE']['stylesheets']
protected
loadStylesheets(PageRenderer $pageRenderer) : void
Parameters
- $pageRenderer : PageRenderer
log()
Log debug information for MFA events
protected
log(string $message[, array<string|int, mixed> $additionalData = [] ][, MfaProviderManifestInterface|null $mfaProvider = null ][, int $action = Login::LOGIN ][, int $error = SystemLogErrorClassification::MESSAGE ]) : void
Parameters
- $message : string
- $additionalData : array<string|int, mixed> = []
- $mfaProvider : MfaProviderManifestInterface|null = null
- $action : int = Login::LOGIN
- $error : int = SystemLogErrorClassification::MESSAGE
setUpBasicPageRendererForBackend()
Sets mandatory parameters for the PageRenderer.
protected
setUpBasicPageRendererForBackend(PageRenderer $pageRenderer, ExtensionConfiguration $extensionConfiguration, ServerRequestInterface $request, LanguageService $languageService) : void
Parameters
- $pageRenderer : PageRenderer
- $extensionConfiguration : ExtensionConfiguration
- $request : ServerRequestInterface
- $languageService : LanguageService
verifyAction()
Handle verification request, receiving from the auth view by forwarding the request to the appropriate provider.
protected
verifyAction(ServerRequestInterface $request, MfaProviderManifestInterface $mfaProvider) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $mfaProvider : MfaProviderManifestInterface