[horde] Horde4 how to get apache basic auth to provide username and password to Horde
Ralf Lang
lang at b1-systems.de
Tue Feb 21 15:41:20 UTC 2012
Am 21.02.2012 15:54, schrieb Paul Harmsworth:
> Hi,
>
> I am trying to solve the following:
> Apache requires a password for authenticaion for my website. Is it possible for
> Horde to reuse the username and password already provided? I expect that it is
> but I cannot find out how. I would like to avoid users having to logon once for
> Apache an then again for Horde.
>
>
> Any ideas please?
>
> Regards
>
> Paul
>
Yes.
testing:~ # cat /usr/share/php5/PEAR/www/horde/quick.php
<?php
require_once dirname(__FILE__) . '/lib/Application.php';
try {
Horde_Registry::appInit('horde', array('authentication' => 'none',
'nologintasks' => true));
} catch (Horde_Exception $e) {}
$vars = Horde_Variables::getDefaultVariables();
$auth = $injector->getInstance('Horde_Core_Factory_Auth')->create();
// Check for HTTP auth.
if (empty($_SERVER['PHP_AUTH_USER']) ||
empty($_SERVER['PHP_AUTH_PW']) ||
!$auth->authenticate($_SERVER['PHP_AUTH_USER'],
array('password' => $_SERVER['PHP_AUTH_PW']))) {
header('WWW-Authenticate: Basic realm="' . $auth->getParam('realm')
. '"');
header('HTTP/1.0 401 Unauthorized');
exit('Forbidden');
}
if ($url = Horde_Util::getFormData('url')) {
$url = new Horde_Url($url);
} else {
$url = Horde::url('login.php');
}
$url->redirect();
--
Ralf Lang
Linux Consultant / Developer
Tel.: +49-170-6381563
Mail: lang at b1-systems.de
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
More information about the horde
mailing list