Download the PHP package wassa/apikey-authenticator-bundle without Composer

On this page you can find all versions of the php package wassa/apikey-authenticator-bundle. 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 apikey-authenticator-bundle

Wassa API Key Authenticor Bundle

The Symfony website has a great tutorial on how to create an API token authentication system. It's crystal clear and very easy to reproduce. From our point of view though, it has 2 main issues:

1) If you have a lot of projects (which is our case at Wassa), it can be quite time consuming to reproduce it for every single project 2) The tutorial is more targeted toward what we call "multi-users" environment, in which a single API is linked to a single user.

This bundle aims to address these 2 issues.

Requirements

Installation

First run:

Then update AppKernel.php:

The API key must be stored in var/private/api.key. You can create the file yourself or use the built-in command to create a key:

If you don't provide an API key, the command will use the default generator (see "Creating your own generator") to create a random key. The default size for the random key is 32 chars but can be configured (see "Configuration") or manually set it with the -s switch.

Remember to set correct permissions on the key file so that it is readable only by the webserver.

Configuration

The bundle works without any special configuration. Add and edit the following block to config.yml if necessary:

The name parameter specify the name of the "field" in the request containing the API key.

The location parameter specifies which "field" to look for the API key in the request:

location can be a combination of different values, for example 'headers&query' to look in headers and query but not in the body.

Then edit security.yml:

Be sure that access_control is configured with the same role as in config.yml.

Creating your own API key generator

If you need your API key to be a bit more complex than a series of X chars, you can create your own generator.

In order to do that, just create a service that implements ApiKeyGeneratorInterface and write your own logic in the generate() method.

Then configure the bundle in config.yml:

Composer post-install script

You can automate the creation of the API key by including the built-in post-install script in your composer.json:

apikey-size is optional, if you don't specify it, the key will be created with the configured key size.

Also, if an API key already exists, it will not be overriden.

Managing multiple API keys

For now our bundle handles only one API key, that's what it was made for in the first place so it's OK. If you want to handle multiple keys, then you can just follow these easy steps:

This part of the tutorial can help you to do that.


All versions of apikey-authenticator-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^5.5|^7.0
symfony/framework-bundle Version ~2.8|~3.0|~4.0
symfony/security Version ~4.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 wassa/apikey-authenticator-bundle contains the following files

Loading the files please wait ....