6.0.0-git
2024-04-20

Diff for AuthCompositeHowTo between 4 and 5

----
+ Composite Authentication How To (Horde 4)4/5)

**##red|Composite Authentication documentation for Horde 3 can be found at AuthCompositeHowToH3.##**

The composite authentication driver allows to use different authentication and user management schemes for different purposes or circumstances.

For example, you can choose different drivers for authentication and user management:

* For instance you want to let IMP authenticate users against several possible email servers
* But you want to be able to manage users globally from a central user repository (such as a corporate SQL database)

++ Defining the sub-drivers

First you need to define all the drivers in {{config/conf.php}} that should be part of the composite driver. Each driver is configured like a "normal" authentication driver and associated with its role (admin or authentication).

Let's say you would configure an FTP authentication backend like this:

<code type="php">
$conf['auth']['driver'] = 'ftp';
$conf['auth']['params'] = array(
    'hostspec' => '192.168.0.21',
    'port' => 21
);
</code>

And let's say you would configure an IMAP authentication backend like this (note that these authentication backends don't make a bunch of sense for combining via the composite driver, but they both have minimal configuration so it makes things easy to follow):

<code type="php">
$conf['auth']['driver'] = 'imap';
$conf['auth']['params'] = array(
    'hostspec' => '192.168.0.42',
    'port' => 143,
    'secure' => 'none'
);
</code>

To finish the example, let's pretend that we want to use the **ftp** driver for admin and the **imap** driver for authentication.  The final composite driver configuration to be placed in horde/config/conf.php would be as follows:

<code type="php">
$conf['auth']['driver'] = 'composite';
$conf['auth']['params']['admin_driver']['driver'] = 'ftp';
$conf['auth']['params']['admin_driver']['params'] = array(
    'hostspec' => '192.168.0.21',
    'port' => 21
);
$conf['auth']['params']['auth_driver']['driver'] = 'imap';
$conf['auth']['params']['auth_driver']['params'] = array(
    'hostspec' => '192.168.0.42',
    'port' => 143,
    'secure' => 'none'
);
</code>