Skip to content

Commit

Permalink
updated http-middleware interface to 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Nov 23, 2016
1 parent 8baf62e commit 67fa5c2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 0.2.0 - 2016-11-22

### Changed

* Updated to `http-interop/http-middleware#0.3`

## 0.1.0 - 2016-10-02

First version
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# middlewares/http-authentication

[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Software License][ico-license]](LICENSE)
[![Build Status][ico-travis]][link-travis]
[![Quality Score][ico-scrutinizer]][link-scrutinizer]
[![Total Downloads][ico-downloads]][link-downloads]
Expand All @@ -12,8 +12,6 @@ Middleware to implement [RFC 2617 Http Authentication](https://tools.ietf.org/ht
* [BasicAuthentication](#basicauthentication)
* [DigestAuthentication](#digestauthentication)

**Note:** This middleware is intended for server side only

## Requirements

* PHP >= 5.6
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
},
"require": {
"php": "^5.6 || ^7.0",
"http-interop/http-middleware": "^0.2",
"middlewares/utils": "0.*"
"http-interop/http-middleware": "^0.3",
"middlewares/utils": "~0.5"
},
"require-dev": {
"phpunit/phpunit": "^5.5",
"zendframework/zend-diactoros": "^1.3",
"friendsofphp/php-cs-fixer": "^1.12",
"squizlabs/php_codesniffer": "^2.7",
"mindplay/middleman": "^2.0"
"squizlabs/php_codesniffer": "^2.7"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/DigestAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private function parseHeader($header)
'qop' => 1,
'username' => 1,
'uri' => 1,
'response' => 1
'response' => 1,
];

$data = [];
Expand Down
7 changes: 4 additions & 3 deletions tests/BasicAuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
namespace Middlewares\Tests;

use Middlewares\BasicAuthentication;
use Middlewares\Utils\Dispatcher;
use Middlewares\Utils\CallableMiddleware;
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\Response;
use mindplay\middleman\Dispatcher;

class BasicAuthenticationTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -29,12 +30,12 @@ public function testSuccess()
->realm('My realm')
->attribute('auth-username'),

function ($request) {
new CallableMiddleware(function ($request) {
$response = new Response();
$response->getBody()->write($request->getAttribute('auth-username'));

return $response;
},
}),
]))->dispatch($request);

$this->assertInstanceOf('Psr\\Http\\Message\\ResponseInterface', $response);
Expand Down
7 changes: 4 additions & 3 deletions tests/DigestAuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
namespace Middlewares\Tests;

use Middlewares\DigestAuthentication;
use Middlewares\Utils\Dispatcher;
use Middlewares\Utils\CallableMiddleware;
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\Response;
use mindplay\middleman\Dispatcher;

class DigestAuthenticationTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -35,12 +36,12 @@ public function testSuccess()
->realm('My realm')
->attribute('auth-username'),

function ($request) {
new CallableMiddleware(function ($request) {
$response = new Response();
$response->getBody()->write($request->getAttribute('auth-username'));

return $response;
},
}),
]))->dispatch($request);

$this->assertInstanceOf('Psr\\Http\\Message\\ResponseInterface', $response);
Expand Down

0 comments on commit 67fa5c2

Please sign in to comment.