From 5c0dd64d681542c6956f32529c5fd3091a44656f Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 30 Dec 2010 12:41:49 +1300 Subject: [PATCH] Let auth realm be 'per Principal' to work around Mozilla #247486 Signed-off-by: Andrew McMillan --- inc/HTTPAuthSession.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inc/HTTPAuthSession.php b/inc/HTTPAuthSession.php index e0b3fcaf..b0514fa4 100644 --- a/inc/HTTPAuthSession.php +++ b/inc/HTTPAuthSession.php @@ -66,6 +66,13 @@ class HTTPAuthSession { function AuthFailedResponse( $auth_header = "" ) { global $c; if ( $auth_header == "" ) { + $auth_realm = $c->system_name; + if ( isset($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); }