2017 © Pedro Peláez
 

library buzz-wsse-plugin

Buzz plugin to manage WSSE authentication

image

devster/buzz-wsse-plugin

Buzz plugin to manage WSSE authentication

  • Monday, January 13, 2014
  • by devster
  • Repository
  • 2 Watchers
  • 3 Stars
  • 6,500 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 5 % Grown

The README.md

buzz-wsse-plugin

Latest Stable Version Build Status, (*1)

Buzz plugin to manage WSSE authentication, (*2)

Buzz is a lightweight PHP 5.3 library for issuing HTTP requests., (*3)

More informations on WSSE authentication http://www.xml.com/pub/a/2003/12/17/dive.html, (*4)

Installation

Install via composer

# Install Composer
curl -sS https://getcomposer.org/installer | php

# Add the plugin as a dependency
php composer.phar require devster/buzz-wsse-plugin:~1.0

After installing, you need to require Composer's autoloader:, (*5)

require 'vendor/autoload.php';

Basic usage

require 'vendor/autoload.php'

use Buzz\Browser;
use Devster\Buzz\Listener\WsseAuthListener;

// Create a Buzz client
$browser = new Browser();
// and add the Wsse listener
$browser->addListener(new WsseAuthListener('username', '*******'));

// finally use Buzz as usual
$response = $browser->get('http://www.google.com');

echo $browser->getLastRequest()."\n";
echo $response;

Customization

All the plugin is configurable: the way to generate the nonce, the timestamp and also the password digest., (*6)

use Buzz\Browser;
use Buzz\Message\RequestInterface;
use Devster\Buzz\Listener\WsseAuthListener;

$browser = new Buzz\Browser();
$wsse = new WsseAuthListener('bob', '*********');
$wsse
    // Customize the nonce generator
    // A callable that must return a string
    ->setNonceCallback(function(RequestInterface $request) {
        return uniqid('myapp_', true);
    })
    // Customize the timestamp generator
    // A callable that must return a string
    ->setTimestampCallback(function(RequestInterface $request) {
        $date = new \DateTime("now");
        return $date->format('c');
    })
    // Customize the digest generator
    // A callable that must return a string
    ->setDigestCallback(function($nonce, $timestamp, $password, RequestInterface $request) {
        return hash('sha512', $nonce.$timestamp.$password, true);
    })
;

// add the listener to the browser
$browser->addListener($wsse);

Tests

Unit tests are made with atoum., (*7)

composer install --dev
./vendor/bin/atoum

License

This plugin is licensed under the MIT License, (*8)

The Versions

13/01 2014

dev-master

9999999-dev https://github.com/devster/buzz-wsse-plugin

Buzz plugin to manage WSSE authentication

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

plugin api authentication rest wsse buzz

12/01 2014

1.0.0

1.0.0.0 https://github.com/devster/buzz-wsse-plugin

Buzz plugin to manage WSSE authentication

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

plugin api authentication rest wsse buzz