Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions classes/Rest/Controllers/BaseControllerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ public function setupAssertions(Application $app, ControllerCollection $controll
* @param Application $app that will be used to facilitate returning a
* json response if information is found to be
* missing.
* @return \Symfony\Component\HttpFoundation\JsonResponse if and only if
* the user is missing a token or an ip.
*
* @throws Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
*/
Expand Down Expand Up @@ -744,7 +742,6 @@ protected function getTimestamp($date, $paramName = 'date', $format = 'Y-m-d')

/**
* @param Request $request
* @return \XDUser
* @throws BadRequestHttpException if the provided token is empty, or there is not a provided token.
* @throws \Exception if the user's token from the db does not validate against the provided token.
*/
Expand Down Expand Up @@ -778,6 +775,7 @@ protected function authenticateToken($request)
$userId = substr($rawToken, 0, $delimPosition);
$token = substr($rawToken, $delimPosition + 1);

return Tokens::authenticate($userId, $token);
$user = Tokens::authenticate($userId, $token);
$request->attributes->set(BaseControllerProvider::_USER, $user);
}
}
3 changes: 2 additions & 1 deletion classes/Rest/Controllers/WarehouseControllerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,8 @@ private function getUserStore(\XDUser $user, $realm)
*/
public function getRawData(Request $request, Application $app)
{
$user = parent::authenticateToken($request);
parent::authenticateToken($request);
$user = parent::getUserFromRequest($request);
$params = $this->validateRawDataParams($request, $user);
$query = $this->getRawDataQuery($params);
$logger = $this->getRawDataLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ public function getRealms(Request $request, Application $app)
// NOOP
}

if ($user === null) {
$user = $this->authorize($request);
}

$user = $this->authorize($request);

$config = RawStatisticsConfiguration::factory();

Expand Down