Actually use new calculated per principal auth_realm.

Signed-off-by: Andrew McMillan <andrew@morphoss.com>
This commit is contained in:
Andrew McMillan 2010-12-30 18:59:19 +13:00
parent cf771d1eb3
commit 9f8d4b4346

View File

@ -67,13 +67,14 @@ class HTTPAuthSession {
global $c;
if ( $auth_header == "" ) {
$auth_realm = $c->system_name;
if ( isset($c->per_principal_realm) ) {
if ( isset($c->per_principal_realm) && $c->per_principal_realm ) {
$principal_name = preg_replace( '{^/(.*?)/.*$}', '$1', $_SERVER["PATH_INFO"]);
if ( $principal_name != $_SERVER["PATH_INFO"] ) {
$auth_realm .= ' - ' . $principal_name;
}
}
$auth_header = sprintf( 'WWW-Authenticate: Basic realm="%s"', $c->system_name);
dbg_error_log( "HTTPAuth", ":AuthFailedResponse Requesting authentictaion in the '%s' realm", $auth_realm );
$auth_header = sprintf( 'WWW-Authenticate: Basic realm="%s"', $auth_realm );
}
header('HTTP/1.1 401 Unauthorized', true, 401 );