MfaSetupController extends AbstractMfaController uses PageRendererBackendSetupTrait
Controller to provide the standalone setup endpoint for multi-factor authentication.
This is used when MFA is enforced and a backend user logs in the first time to then set up MFA.
This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API.
Attributes
- #[AsController]
Table of Contents
Constants
- ACTION_METHOD_MAP = ['setup' => 'GET', 'activate' => 'POST', 'cancel' => 'GET']
Properties
- $allowedActions : array<string|int, mixed>
- $allowedProviders : array<string|int, mixed>
- $authenticationStyleInformation : AuthenticationStyleInformation
- $backendViewFactory : BackendViewFactory
- $extensionConfiguration : ExtensionConfiguration
- $logger : LoggerInterface
- $mfaProviderRegistry : MfaProviderRegistry
- $mfaRequired : bool
- $mfaTsConfig : array<string|int, mixed>
- $pageRenderer : PageRenderer
- $uriBuilder : UriBuilder
Methods
- __construct() : mixed
- handleRequest() : ResponseInterface
- Main action for handling the request and returning the response
- injectMfaProviderRegistry() : void
- activateAction() : ResponseInterface
- Handle activate request, receiving from the setup view by forwarding the request to the appropriate provider.
- addCustomAuthenticationFormStyles() : void
- addSuccessMessage() : void
- Add a flash message to inform the user about the successful activation of MFA and store this in the session, so it will be shown in the backend after the redirect.
- cancelAction() : ResponseInterface
- Allow the user to cancel the multi-factor authentication setup process 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.
- getBackendFavicon() : string
- Retrieves configured favicon for backend with fallback.
- getBackendUser() : BackendUserAuthentication
- getLanguageService() : LanguageService
- 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
- initializeView() : ViewInterface
- Initialize the standalone view by setting the paths and assigning view variables
- isActionAllowed() : bool
- isProviderAllowed() : bool
- isValidIdentifier() : bool
- Extend base identifier check to further evaluate whether the provider is allowed to be a default provider.
- loadStylesheets() : void
- Load all registered stylesheets from $GLOBALS['TYPO3_CONF_VARS']['BE']['stylesheets']
- log() : void
- Log debug information for MFA setup events
- renderSelectionView() : ResponseInterface
- Allow the user - required to set up MFA - to select between all available providers
- renderSetupView() : ResponseInterface
- Render form to setup a provider by using provider specific content
- setupAction() : ResponseInterface
- Render form to setup a provider by using provider specific content. Fall back to provider selection view, in case no valid provider was yet selected.
- setUpBasicPageRendererForBackend() : void
- Sets mandatory parameters for the PageRenderer.
Constants
ACTION_METHOD_MAP
protected
mixed
ACTION_METHOD_MAP
= ['setup' => 'GET', 'activate' => 'POST', 'cancel' => 'GET']
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
$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) : mixed
Parameters
- $uriBuilder : UriBuilder
- $authenticationStyleInformation : AuthenticationStyleInformation
- $pageRenderer : PageRenderer
- $extensionConfiguration : ExtensionConfiguration
- $logger : LoggerInterface
- $backendViewFactory : BackendViewFactory
handleRequest()
Main action for handling the request and returning the response
public
handleRequest(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfaceinjectMfaProviderRegistry()
public
injectMfaProviderRegistry(MfaProviderRegistry $mfaProviderRegistry) : void
Parameters
- $mfaProviderRegistry : MfaProviderRegistry
activateAction()
Handle activate request, receiving from the setup view by forwarding the request to the appropriate provider.
protected
activateAction(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfaceaddCustomAuthenticationFormStyles()
protected
addCustomAuthenticationFormStyles() : void
addSuccessMessage()
Add a flash message to inform the user about the successful activation of MFA and store this in the session, so it will be shown in the backend after the redirect.
protected
addSuccessMessage(string $mfaProviderTitle) : void
Parameters
- $mfaProviderTitle : string
cancelAction()
Allow the user to cancel the multi-factor authentication setup process 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
ResponseInterfacegetBackendFavicon()
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
LanguageServicegetNormalizedParams()
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
initializeView()
Initialize the standalone view by setting the paths and assigning view variables
protected
initializeView(ServerRequestInterface $request) : ViewInterface
Parameters
- $request : ServerRequestInterface
Return values
ViewInterfaceisActionAllowed()
protected
isActionAllowed(string $action) : bool
Parameters
- $action : string
Return values
boolisProviderAllowed()
protected
isProviderAllowed(string $identifier) : bool
Parameters
- $identifier : string
Return values
boolisValidIdentifier()
Extend base identifier check to further evaluate whether the provider is allowed to be a default provider.
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 setup events
protected
log(string $message[, MfaProviderManifestInterface|null $mfaProvider = null ]) : void
Parameters
- $message : string
- $mfaProvider : MfaProviderManifestInterface|null = null
renderSelectionView()
Allow the user - required to set up MFA - to select between all available providers
protected
renderSelectionView(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfacerenderSetupView()
Render form to setup a provider by using provider specific content
protected
renderSetupView(ServerRequestInterface $request, MfaProviderManifestInterface $mfaProvider) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $mfaProvider : MfaProviderManifestInterface
Return values
ResponseInterfacesetupAction()
Render form to setup a provider by using provider specific content. Fall back to provider selection view, in case no valid provider was yet selected.
protected
setupAction(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfacesetUpBasicPageRendererForBackend()
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