Download the PHP package phpro/zf-mvc-auth-token without Composer
On this page you can find all versions of the php package phpro/zf-mvc-auth-token. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package zf-mvc-auth-token
Repository abandoned 2020-11-27
This repository has been archived since we are not using it anymore internally. Feel free to use it AS-IS, we won't be providing any support anymore.
Mvc-Auth-Token implementation for zend framework 2
This module will take care of HTTP Token authentication as described in the draft-hammer-http-token-auth-01. It should be used with zf-mvc-auth.
The purpose of this module is to provide an extendable interface for validating Tokens. The validation of the Token should be done in a custom adapter.
Query params
In some situations, it is not possible to add the Authentication header to the request. Therefor the token parameters can also be added as query parameters:
Note: This part of the authentication is not in the official draft, but could be useful in some situations.
Installation
Module Installation
Add to composer.json
Add module to application.config.php
Add a new listener and adapter in your module 'module.config.php'
Note: The listener is not an actual class. The AbstractAuthenticationListener will create an AuthenticationListener for you, which is configured with your custom adapter.
Add a TokenAdapter class to your Module.
e.g. YourModule\Authentication\Adapter\TokenAdapter
This custom class will implement the AdapterInterface and should be used to validate your token:
Add a new listener in your Module::onBootstrap
Now the last step is to add your configured AuthenticationListener to the MvcAuthEvent. When the Authentication event is triggered, your listener will handle Token Authorization.
Note: Make sure that the priority is above the current zf-mvc-auth authentication priority.
How to retrieve the authenticated user?
All versions of zf-mvc-auth-token with dependencies
zendframework/zend-http Version 2.*
zendframework/zend-modulemanager Version 2.*
zendframework/zend-mvc Version 2.*
zendframework/zend-servicemanager Version 2.*
zendframework/zend-stdlib Version 2.*
zfcampus/zf-mvc-auth Version ~1.0-dev