danger2k7 / cakephp-soap-auth
CakePHP plugin for authenticating for stateless connexions
Installs: 3 363
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Type:cakephp-plugin
pkg:composer/danger2k7/cakephp-soap-auth
Requires
- cakephp/cakephp: ^3.4
- zendframework/zend-diactoros: ~1.0
This package is not auto-updated.
Last update: 2025-10-26 09:23:37 UTC
README
Plugin containing AuthComponent's authenticate class for authenticating using headers.
Requirements
- CakePHP 3.5+
Installation
composer require dynweb-org/cakephp-soap-auth
Usage
In your app's config/bootstrap.php add:
// In config/bootstrap.php Plugin::load('Dynweb/SoapAuth');
or using cake's console:
./bin/cake plugin load Dynweb/SoapAuth
Configuration:
Setup AuthComponent:
// In your controller, for e.g. src/Api/AppController.php
Working
The authentication class checks for the token in two locations:
-
HTTP_AUTHORIZATIONenvironment variable:It first checks if token is passed using
Authorizationrequest header. The value should be of formBearer <token>. TheAuthorizationheader name and token prefixBearercan be customzied using optionsheaderandprefixrespectively.Note: Some servers don't populate
$_SERVER['HTTP_AUTHORIZATION']whenAuthorizationheader is set. So it's upto you to ensure that either$_SERVER['HTTP_AUTHORIZATION']or$_ENV['HTTP_AUTHORIZATION']is set.For e.g. for apache you could use the following:
RewriteEngine On RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] -
The query string variable specified using
parameterconfig:Next it checks if the token is present in query string. The default variable name is
tokenand can be customzied by using theparameterconfig shown above.