summaryrefslogtreecommitdiff
path: root/lib/apiauth.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2009-10-09 16:57:22 -0700
committerZach Copley <zach@status.net>2009-10-09 16:57:22 -0700
commit743c844084bae75db02570d76694f4e9b79a9aa9 (patch)
treeb1a4254c092a10777aec3688024dd2d48f9916b9 /lib/apiauth.php
parentf746993c2bfb674d397cf095a2ab2ff7e757818b (diff)
Move all basic auth output and processing to base classes
Diffstat (limited to 'lib/apiauth.php')
-rw-r--r--lib/apiauth.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/apiauth.php b/lib/apiauth.php
index d7f8017eb..9fc0e5712 100644
--- a/lib/apiauth.php
+++ b/lib/apiauth.php
@@ -49,6 +49,26 @@ class ApiAuthAction extends ApiAction
var $auth_user = null;
/**
+ * Take arguments for running, and output basic auth header if needed
+ *
+ * @param array $args $_REQUEST args
+ *
+ * @return boolean success flag
+ *
+ */
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+
+ if ($this->requiresAuth()) {
+ $this->checkBasicAuthUser();
+ }
+
+ return true;
+ }
+
+ /**
* Does this API resource require authentication?
*
* @return boolean true
@@ -76,7 +96,7 @@ class ApiAuthAction extends ApiAction
// show error if the user clicks 'cancel'
$this->showBasicAuthError();
- return false;
+ exit;
} else {
$nickname = $this->auth_user;
@@ -94,7 +114,7 @@ class ApiAuthAction extends ApiAction
"$nickname, proxy = $proxy, ip = $ip."
);
$this->showBasicAuthError();
- return false;
+ exit;
}
}
return true;