dev-master
9999999-dev https://bitbucket.org/jwriteclub/cdn-auth/Authorize URLs for Token auth on various CDNs
MIT
The Requires
- php >=5.3.0
The Development Requires
cdn sendfaster-cdn token-auth
Wallogit.com
2017 © Pedro Peláez
Authorize URLs for Token auth on various CDNs
This library provides methods for generating authorization tokens for CDN links on a number of CDNs. Contributions are gratefully accepted for additional CDNs which are not natively supported by this library., (*2)
Developed and maintained by SendFaster., (*3)
*: Via the NginX module., (*4)
In general somewhere early in your initialization code, you should call CDN::setProvider(new Provider) on each of the CDN types you will be using, passing in an appropriate provider for the specified CDN type
For example, \CDNFaster\Level3CDN::setProvider(new \CDNFaster\StaticLevel3CDNAuthProvider(time()+60, "super_secret")); to setup the Level 3 CDN provider., (*5)
Once you've initialized all of the providers you plan to use, signing URLs is is easy as typing CDN::signUrl("URL"). For example, \CDNFaster\SendFasterCDN::signUrl("http://domain.com/file.mp4"), using the
SendFaster CDN as an example., (*6)
In general, you should be able to use the NginxBasedCDN implementation with any CDN using NginX on the edge. You should explore the setSignatureParamName() and setExpirationParamName in order to customize
the URL generated to the particular settings of your CDN., (*7)
Provided as part of this project are very simple "Static" auth providers which take string literals and provide them to the CDN implementations. In the event that you need to provide CDN authorization parameters
from a configuration system or any other external source, simply implement ICDNAuthProvider (or the appropriate extended version, for instance ILevel3CDNAuthProvider for the Level3CDN). These interfaces
provide a few lightweight getters, such as getExpiration() and getSecret(). Simply implement these functions to wrap to your existing configuration management scheme., (*8)
PHP: 5.3+, (*9)
This project does not require any external dependencies for normal use. PHPUnit 4+ is required to run the unit tests. Automated tests are run on PHP 5.3, 5.4, 5.5 and 5.6. This project may work on older versions of PHP, but compatibility is not tested., (*10)
composer.json file in your project, which contains the following snippet:{
...
"require": {
"jwriteclub/cdn-auth": "dev-master"
}
...
}
composer.json file run php composer.phar install or composer install.require_once("PATH_TO_PROJECT/examples/autoload.php");
Tests are powered by PHPUnit. There is a phpunit.xml file correctly configured in the project root, so simply running phpunit from the project root will execute the tests., (*11)
Contributions of additional CDNs or bug fixes are welcomed. Please make sure that all contributions contain relevant tests and open a pull request. By contributing you accept the MIT license for your code and agree to contribute your code irrevocably to SendFaster, Inc. Furthermore, you agree to hold SendFaster, Inc and it's employees harmless from any patent or copyright infringement contained in the code you contribute., (*12)
The CDN Auth library is licensed under the MIT License., (*13)
Authorize URLs for Token auth on various CDNs
MIT
cdn sendfaster-cdn token-auth