Download the PHP package bigcommerce/hawk without Composer

On this page you can find all versions of the php package bigcommerce/hawk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hawk

Hawk — A PHP Implementation

Hawk is an HTTP authentication scheme using a message authentication code (MAC) algorithm to provide partial HTTP request cryptographic verification. — hawk README

Installation

Through Composer as dflydev/hawk.

Client

Building a Client

The Client has a few required dependencies. It is generally easier to construct a Client by using the ClientBuilder. A Client can be built without setting anything to get sane defaults.

Simple ClientBuilder Example

Complete ClientBuilderExample

Creating a Request

In order for a client to be able to sign a request, it needs to know the credentials for the user making the request, the URL, method, and optionally payload and content type of the request.

All available options include:

Create Request Example

The Client Request Object

The Request represents everything the client needs to know about a request including a header and the artifacts that were used to create the request.

The header is required to be able to get the properly formatted Hawk authorization header to send to the server. The artifacts are useful in the case that authentication will be done on the server response.

Authenticate Server Response

Hawk provides the ability for the client to authenticate a server response to ensure that the response sent back is from the intended target.

All available options include:

Authenticate Response Example

Complete Client Example

Bewit

Hawk supports a method for granting third-parties temporary access to individual resources using a query parameter called bewit.

The return value is a string that represents the bewit. This string should be added to a requested URI by appending it to the end of the URI. If the URI has query parameters already, the bewit should have &bewit= appended to the front of it. If the URI does not have query parameters already, the bewit should have ?bewit= appended to the front of it.

Client Bewit Example

Server

Building a Server

The Server has a few required dependencies. It is generally easier to construct a Server by using the ServerBuilder. A Server can be built without setting anything but the credentials provider to get sane defaults.

Simple ServerBuilder Example

Complete ServerBuilderExample

Authenticating a Request

In order for a server to be able to authenticate a request, it needs to be able to build the same MAC that the client did. It does this by getting the same information about the request that the client knew about when it signed the request.

In particular, the authorization header should include the ID. This ID is used to retrieve the credentials (notably the key) in order to calculate the MAC based on the rest of the request information.

Authenticate Example

The Server Response Object

The Response represents everything the server needs to know about a request including the credentials and artifacts that are associated with the request.

Creating a Response Header

Hawk provides the ability for the server to sign the response to provide the client with a way to authenticate a server response.

All available options include:

Create Response Header Example

Complete Server Example

Bewit

Hawk supports a method for granting third-parties temporary access to individual resources using a query parameter called bewit.

Bewit authentication should only occur for GET and HEAD requests. The return value of an authenticated bewit is a Server Response object.

Server Bewit Example

Crypto

Dflydev\Hawk\Crypto\Crypto

Tools for calculation of and comparison of MAC values.

Dflydev\Hawk\Crypto\Artifacts

A container for all of the pieces of data that may go into the creation of a MAC.

Credentials

Dflydev\Hawk\Credentials\CredentialsInterface

Represents a valid set of credentials.

In some contexts only the key may be known.

Dflydev\Hawk\Credentials\Credentials

A simple implementation of CredentialsInterface.

Header

Dflydev\Hawk\Header\Header

Dflydev\Hawk\Header\HeaderFactory

Dflydev\Hawk\Header\HeaderParser

Dflydev\Hawk\Header\FieldValueParserException

Indicates that a string claims to be a Hawk string but it cannot be completely parsed. This is mostly a sign of a corrupted or malformed header value.

Dflydev\Hawk\Header\NotHawkAuthorizationException

Indicates that the string has nothing to do with Hawk. Currently means that the string does not start with 'Hawk'.

License

MIT, see LICENSE.

Community

If you have questions or want to help out, join us in #dflydev on irc.freenode.net.


All versions of hawk with dependencies

PHP Build Version
Package Version
Requires paragonie/random-lib Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bigcommerce/hawk contains the following files

Loading the files please wait ....