New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

acquia/hmac-request

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acquia/hmac-request

Signs HTTP requests using a HMAC digest

Source
Packagist
This package is abandoned and is no longer maintained.
The author recommends using true instead.
This version has been yanked by its maintainers and should not be used.
Version
0.6.0
Version published
Total downloads
1K
Maintainers
1
Created
Source

HMAC Request Signer

Build Status Code Coverage HHVM Status Scrutinizer Code Quality Latest Stable Version License

HMAC Request Signer is a PHP library that implements the HTTP HMAC Spec to sign and verify RESTful Web API requests. It integrates with popular libraries such as Symfony and Guzzle and can be used on both the server and client.

Installation

HMAC Request Signer can be installed with Composer by adding it as a dependency to your project's composer.json file.

{
    "require": {
        "acquia/hmac-request": "*"
    }
}

Please refer to Composer's documentation for more detailed installation and usage instructions.

Usage

Sign an API request sent via Guzzle.


use Acquia\Hmac\Guzzle3\HmacAuthPlugin;
use Acquia\Hmac\RequestSigner;
use Guzzle\Http\Client;

$requestSigner = new RequestSigner();
$plugin = new HmacAuthPlugin($requestSigner, 'apiKeyId', 'secretKey');

$client = new Client('http://example.com');
$client->addSubscriber($plugin);

$client->get('/resource')->send();

Authenticate the request in a Symfony-powered app e.g. Silex.


use Acquia\Hmac\RequestAuthenticator;
use Acquia\Hmac\RequestSigner;
use Acquia\Hmac\Request\Symfony as RequestWrapper;

// $request is a \Symfony\Component\HttpFoundation\Request object.
$requestWrapper = new RequestWrapper($request);

// $keyLoader implements \Acquia\Hmac\KeyLoaderInterface

$authenticator = new RequestAuthenticator(new RequestSigner(), '+15 minutes');
$key = $authenticator->authenticate($requestWrapper, $keyLoader);

Contributing and Development

Submit changes using GitHub's standard pull request workflow.

All code should adhere to the following standards:

  • PSR-1
  • PSR-2
  • PSR-4

It is recommend to use the PHP Coding Standards Fixer tool to ensure that code adheres to the coding standards mentioned above.

Refer to PHP Project Starter's documentation for the Apache Ant targets supported by this project.

FAQs

Package last updated on 11 Feb 2015

Related posts