diff --git a/src/RestfulServer.php b/src/RestfulServer.php index ffccf0f..3016acc 100644 --- a/src/RestfulServer.php +++ b/src/RestfulServer.php @@ -59,9 +59,11 @@ class RestfulServer extends Controller /** * @config - * @var string Class name for an authenticator to use on API access + * @var array Class names for an authenticators to use on API access */ - private static $authenticator = BasicRestfulAuthenticator::class; + private static $authenticators = [ + BasicRestfulAuthenticator::class + ]; /** * If no extension is given in the request, resolve to this extension @@ -854,8 +856,13 @@ class RestfulServer extends Controller */ protected function authenticate() { - $authClass = $this->config()->authenticator; - $member = $authClass::authenticate(); + $authClasses = $this->config()->authenticators; + $member = null; + foreach ($authClasses as $authClass) { + if ($member = $authClass::authenticate()) { + break; + } + } Security::setCurrentUser($member); return $member; }