make API realm configurable

This commit is contained in:
Evan Prodromou 2010-03-08 12:36:03 -05:00
parent e5541d09d0
commit 5f7aa6f2e3
2 changed files with 7 additions and 1 deletions

View File

@ -235,7 +235,11 @@ class ApiAuthAction extends ApiAction
{ {
$this->basicAuthProcessHeader(); $this->basicAuthProcessHeader();
$realm = common_config('api', 'realm');
if (empty($realm)) {
$realm = common_config('site', 'name') . ' API'; $realm = common_config('site', 'name') . ' API';
}
if (!isset($this->auth_user_nickname) && $required) { if (!isset($this->auth_user_nickname) && $required) {
header('WWW-Authenticate: Basic realm="' . $realm . '"'); header('WWW-Authenticate: Basic realm="' . $realm . '"');

View File

@ -293,4 +293,6 @@ $default =
array('crawldelay' => 0, array('crawldelay' => 0,
'disallow' => array('main', 'settings', 'admin', 'search', 'message') 'disallow' => array('main', 'settings', 'admin', 'search', 'message')
), ),
'api' =>
array('realm' => null),
); );