Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Commit

Permalink
Merge branch 'ntr/merge-upstream' into 'master'
Browse files Browse the repository at this point in the history
Ntr/merge upstream

See merge request shopware-cloud/appsystem/shopwareappexample!5
  • Loading branch information
SebastianFranze committed Sep 9, 2020
2 parents 286cf71 + a0d375e commit c7da260
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/SwagAppsystem/Authenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function authenticateRegisterRequest(Request $request): bool
$signature = $request->headers->get('shopware-app-signature');
$queryString = $request->getQueryString();

$hmac = \hash_hmac('sha256', $queryString, getenv('APP_SECRET'));
$hmac = \hash_hmac('sha256', $queryString, $_SERVER['APP_SECRET']);

return hash_equals($hmac, $signature);
}
Expand Down
4 changes: 2 additions & 2 deletions src/SwagAppsystem/Controller/Registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public function register(Request $request, ShopRepository $shopRepository)

$shopUrl = $this->getShopUrl($request);
$shopId = $this->getShopId($request);
$name = getenv('APP_NAME');
$name = $_SERVER['APP_NAME'];
$secret = bin2hex(random_bytes(64));

$shopRepository->createShop($this->getShopId($request), $this->getShopUrl($request), $secret);

$proof = \hash_hmac('sha256', $shopId . $shopUrl . $name, getenv('APP_SECRET'));
$proof = \hash_hmac('sha256', $shopId . $shopUrl . $name, $_SERVER['APP_SECRET']);
$body = ['proof' => $proof, 'secret' => $secret, 'confirmation_url' => $this->generateUrl('confirm', [], UrlGeneratorInterface::ABSOLUTE_URL)];

return new JsonResponse($body);
Expand Down

0 comments on commit c7da260

Please sign in to comment.