/** * Tests SigningFetcher->fetchRequest */ public function testFetchRequestWithEmptyPath() { $request = new RemoteContentRequest('http://example.org'); $request->setAuthType(RemoteContentRequest::$AUTH_SIGNED); $request->setToken(BasicSecurityToken::createFromValues('owner', 'viewer', 'app', 'domain', 'appUrl', '1', 'default')); $request->setPostBody('key=value&anotherkey=value'); $this->signingFetcher->fetchRequest($request); $this->verifySignedRequest($request); }
/** * Produces a signing fetcher that will sign requests and delegate actual * network retrieval to the {@code networkFetcher} * * @param RemoteContentFetcher $networkFetcher The fetcher that will be doing actual work. * @return SigningFetcher * @throws GadgetException */ public function getSigningFetcher(RemoteContentFetcher $networkFetcher) { return SigningFetcher::makeFromB64PrivateKey($networkFetcher, $this->keyName, $this->privateKey); }
/** * Produces a signing fetcher that will sign requests and delegate actual * network retrieval to the {@code networkFetcher} * * @param networkFetcher The fetcher that will be doing actual work. * @param token The gadget token used for extracting signing parameters. * @return The signing fetcher. * @throws GadgetException */ public function getSigningFetcher($networkFetcher, $token) { return SigningFetcher::makeFromB64PrivateKey($networkFetcher, $token, $this->keyName, $this->privateKey); }