public function getObject(Request $request, $tokenInfo)
{
$path = new Path($request->getUrl()->getPathInfo());
// allow requests to public files (GET|HEAD) without authentication
if ($path->getIsPublic() && $path->getIsDocument()) {
return $this->getDocument($path, $request, $tokenInfo);
}
// past this point we MUST be authenticated
if (null === $tokenInfo) {
$e = new UnauthorizedException('unauthorized', 'must authenticate to view folder listing');
$e->addScheme('Bearer', array('realm' => 'remoteStorage API'));
throw $e;
}
if ($path->getIsFolder()) {
return $this->getFolder($path, $request, $tokenInfo);
}
return $this->getDocument($path, $request, $tokenInfo);
}