[horde] Horde 4 and custom passwd driver
Vilius Šumskas
vilius at lnk.lt
Mon Mar 19 14:19:25 UTC 2012
> >> to treat my driver the same way as the Sql driver.
> >>>
> >>> To me this seems to be a clumsy and I wondered how custom drivers
> >>> should be implemented correctly in Horde 4, without having to
> >>> touch passwd core code?
> >>>
> >>
> >> Are you talking about a custom passwd backend or a custom auth driver?
> >> How would you indicate to the factory that your 3rd party driver needs
> >> an sql instance?
> >
> > I guess this is exactly his question. And the answer is: you can't.
> > You have to pull in the dependencies manually, e.g. $db =
> > $GLOBALS['injector']->getInstance('Horde_Db_Adapter'), inside the
> > custom driver.
>
> Thanks for your answer. With that hint, I was able to understand more
> how things work together and I'm able to use my custom driver without
> any modification in the core.
>
> Currently I do the following in backends.local.php:
>
> ---
> $backends['sql'] = array (
> 'disabled' => false,
> 'name' => 'mail',
> 'preferred' => '',
> 'password policy' => array(
> 'minLength' => 8,
> 'maxLength' => 128,
> 'maxSpace' => 10,
> 'minUpper' => 1,
> 'minLower' => 1,
> 'minNumeric' => 1,
> 'minSymbols' => 1
> ),
> 'driver' => 'Sqlbcrypt',
> 'params' => array(
> 'phptype' => 'pgsql',
> 'hostspec' => 'somehost',
> 'username' => 'horde_pw_change',
> 'password' => 'somepass',
> 'database' => 'mail',
> 'table' => 'email_users',
> 'user_col' => '"alias"||\'@\'||"domain"',
> 'pass_col' => 'password_crypt',
> 'show_encryption' => true
> )
> );
>
> $params = $backends['sql']['params'];
> unset($params['table'], $params['user_col'], $params['pass_col'],
> $params['encryption'], $params['show_encryption']);
> $backends['sql']['params']['db'] =
> $GLOBALS['injector']->getInstance('Horde_Core_Factory_Db')-
> >create('passwd',
> $params);
> ---
>
> Actually I could probably do the 'db' setup already in the sql-backend
> configuration itself, by passing the necessary params already there.
> But I'm going to test that later.
Just curious why don't you use ordinary Sql driver for this? It already can do custom queries. Or do you use any encryption algorith which is not implemented?
--
Vilius
More information about the horde
mailing list