Horde_Core_Controller_RequestMapper
in package
The Horde_Core_Controller_RequestMapper class provides logic to identify which app is supposed to handle the request.
It loads the relevant routes file. The routes file may either demand a certain type of authentication or restrict access to certain HTTP verbs.
Supported auth types:
- default: The user is supposed to be already logged in and has a session
- basic: The request comes with HTTP BASIC AUTH credentials
- none: Unauthenticated access is permitted
Finding the right app is supposed to work even if the app does not live below the horde base URL or even on a separate domain as long as it is properly configured in the registry.
Copyright 2009-2020 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL-2). If you did not receive this file, see http://www.horde.org/licenses/lgpl.
Tags
Table of Contents
Properties
- $_mapper : Horde_Routes_Mapper
Methods
- __construct() : mixed
- getRequestConfiguration() : Horde_Controller_RequestConfiguration
- Build the request configuration
- _identifyApp() : mixed
- Identify the correct app to handle the request
- _normalize() : string
- Rebuild a path string to a common form
Properties
$_mapper
protected
Horde_Routes_Mapper
$_mapper
Methods
__construct()
public
__construct(Horde_Routes_Mapper $mapper) : mixed
Parameters
- $mapper : Horde_Routes_Mapper
getRequestConfiguration()
Build the request configuration
public
getRequestConfiguration(Horde_Injector $injector) : Horde_Controller_RequestConfiguration
If no found app fits, return the NotFound controller.
Initialize the found app. Load the route definition file for the found app.
Initialize the routes mapper with the app's base path and match
Finally check authentication if required
Parameters
- $injector : Horde_Injector
-
The Dependency Injector
Return values
Horde_Controller_RequestConfiguration —The found config
_identifyApp()
Identify the correct app to handle the request
protected
_identifyApp(string $scheme, mixed $request, string $host, Horde_Registry $registry) : mixed
This needs to cover a lot of cases
- app lives below horde (pear default)
- app lives besides or independent of horde (composer default)
- app is horde
- app lives in document root (https://webmail.foo.org is imp)
- app lives below horde but document root is another app eg https://webmail.foo.org where / is imp, /horde is horde, /horde/turba is turba
Parameters
- $scheme : string
-
Request URI scheme (https, http)
- $request : mixed
- $host : string
-
Request host part (www.foo.org)
- $registry : Horde_Registry
-
The Horde Registry
_normalize()
Rebuild a path string to a common form
protected
_normalize(string $path) : string
Remove any . and .. levels and parts made irrelevant by them
Parameters
- $path : string
-
The input path
Return values
string —The normalized path