PHPackages                             dflydev/stack-hawk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dflydev/stack-hawk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dflydev/stack-hawk
==================

Hawk Stack middleware

1047[1 issues](https://github.com/dflydev/dflydev-stack-hawk/issues)1PHP

Since Aug 2Pushed 12y ago1 watchersCompare

[ Source](https://github.com/dflydev/dflydev-stack-hawk)[ Packagist](https://packagist.org/packages/dflydev/stack-hawk)[ RSS](/packages/dflydev-stack-hawk/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (1)

Hawk Stack Middleware
=====================

[](#hawk-stack-middleware)

A [Stack](http://stackphp.com/) middleware to enable [Hawk](https://github.com/hueniverse/hawk) authentication following the [STACK-2 Authentication](http://stackphp.com/specs/STACK-2/) conventions.

Installation
------------

[](#installation)

Through [Composer](http://getcomposer.org) as [dflydev/stack-hawk](https://packagist.org/packages/dflydev/stack-hawk).

Usage
-----

[](#usage)

The Hawk middleware accepts the following options:

- **credentials\_provider**: *(required)* Either an instance of `Dflydev\Hawk\Credentials\CredentialsProviderInterface` or a callable that receives an ID as its only argument and is expected to return a `Dflydev\Hawk\Credentials\CredentialsInterface` or null.
- **sign\_response**: Should responses be signed? Boolean. Default **true**.
- **validate\_payload\_response**: Should payload responses be validated? Boolean. Default **true**.
- **validate\_payload\_request**: Should payload requests be validated? Boolean. Default **true**.
- **crypto**: An instance of `Dflydev\Hawk\Crypto\Crypto` or a callable that will return an instance of `Dflydev\Hawk\Crypto\Crypto`.
- **server**: An instance of `Dflydev\Hawk\Server\ServerInterface` or a callable that will return an instance of `Dflydev\Hawk\Server\ServerInterface`.
- **time\_provider**: An instance of `Dflydev\Hawk\Time\TimeProviderInterface`or a callable that will return an instance of `Dflydev\Hawk\Time\TimeProviderInterface`.
- **token\_translator**: A callable that receives a `Dflydev\Hawk\Credentials\CredentialsInterface` as its only argument and is expected to return a token. Default implementation returns `$credentials->id()` as the token.
- **firewall**: A firewall configuration compatible with [dflydev/stack-firewall](https://packagist.org/packages/dflydev/stack-firewall).

```
