TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AjaxRequestHandler Class Reference
Inheritance diagram for AjaxRequestHandler:
RequestHandlerInterface

Public Member Functions

 __construct (Bootstrap $bootstrap)
 
 handleRequest (ServerRequestInterface $request)
 
 canHandleRequest (ServerRequestInterface $request)
 
 getPriority ()
 
- Public Member Functions inherited from RequestHandlerInterface
 handleRequest (\Psr\Http\Message\ServerRequestInterface $request)
 
 canHandleRequest (\Psr\Http\Message\ServerRequestInterface $request)
 

Protected Member Functions

 isLoggedInBackendUserRequired ($ajaxId)
 
 boot ($proceedIfNoUserIsLoggedIn)
 
 getFormProtection ()
 
 isValidRequest (ServerRequestInterface $request)
 

Protected Attributes

 $bootstrap
 
 $publicAjaxIds
 

Detailed Description

AJAX dispatcher

Main entry point for AJAX calls in the TYPO3 Backend. Based on ?ajaxId of the outside application. Before doing the basic BE-related set up of this request (see the additional calls on $this->bootstrap inside handleRequest()), some AJAX-calls can be made without a valid user, which is determined here. See $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX'] and the Core APIs on how to register an AJAX call in the TYPO3 Backend.

Due to legacy reasons, the actual logic is in EXT:core/Http/AjaxRequestHandler which will eventually be moved into this class. In the future, the logic for "TYPO3_PROCEED_IF_NO_USER" will be moved in here as well.

Definition at line 40 of file backend/Classes/Http/AjaxRequestHandler.php.

Constructor & Destructor Documentation

__construct ( Bootstrap  $bootstrap)

Constructor handing over the bootstrap and the original request

Parameters
Bootstrap$bootstrap

Definition at line 65 of file backend/Classes/Http/AjaxRequestHandler.php.

References AjaxRequestHandler\$bootstrap.

Member Function Documentation

boot (   $proceedIfNoUserIsLoggedIn)
protected

Start the Backend bootstrap part

Parameters
bool$proceedIfNoUserIsLoggedIna flag if a backend user is required

Definition at line 135 of file backend/Classes/Http/AjaxRequestHandler.php.

Referenced by AjaxRequestHandler\handleRequest().

canHandleRequest ( ServerRequestInterface  $request)

This request handler can handle any backend request having an ajaxID as parameter (see Application.php in EXT:backend)

Parameters
ServerRequestInterface$request
Returns
bool If the request is an AJAX backend request, TRUE otherwise FALSE

Definition at line 103 of file backend/Classes/Http/AjaxRequestHandler.php.

References ServerRequestInterface\getAttribute().

getFormProtection ( )
protected

Wrapper method for static form protection utility

Returns

Definition at line 220 of file backend/Classes/Http/AjaxRequestHandler.php.

References FormProtectionFactory\get().

Referenced by AjaxRequestHandler\isValidRequest().

getPriority ( )

Returns the priority - how eager the handler is to actually handle the request.

Returns
int The priority of the request handler.

Implements RequestHandlerInterface.

Definition at line 113 of file backend/Classes/Http/AjaxRequestHandler.php.

handleRequest ( ServerRequestInterface  $request)
isLoggedInBackendUserRequired (   $ajaxId)
protected

Check if the user is required for the request If we're trying to do an ajax login, don't require a user

Parameters
string$ajaxIdthe Ajax ID to check against
Returns
bool whether the request can proceed without a login required

Definition at line 125 of file backend/Classes/Http/AjaxRequestHandler.php.

Referenced by AjaxRequestHandler\handleRequest().

isValidRequest ( ServerRequestInterface  $request)
protected

Checks if the request token is valid. This is checked to see if the route is really created by the same instance. Should be called for all routes in the backend except for the ones that don't require a login.

Parameters
ServerRequestInterface$request
Returns
bool
See Also
where the token is generated.

Definition at line 234 of file backend/Classes/Http/AjaxRequestHandler.php.

References ServerRequestInterface\getAttribute(), AjaxRequestHandler\getFormProtection(), ServerRequestInterface\getParsedBody(), and ServerRequestInterface\getQueryParams().

Member Data Documentation

$bootstrap
protected
$publicAjaxIds
protected
Initial value:
= array(
'/ajax/login',
'/ajax/logout',
'/ajax/login/refresh',
'/ajax/login/timedout',
'/ajax/rsa/publickey'
)

Definition at line 52 of file backend/Classes/Http/AjaxRequestHandler.php.