barrycoleman/akamai-edgeauth-php
Composer 安装命令:
composer create-project barrycoleman/akamai-edgeauth-php
包简介
Akamai Edge Auth Token Creation for PHP.
README 文档
README
akamai-edgeauth-php is a token generator for use with Akamai Edge AuthorizationToken in
an HTTP cookie, query string or HTTP header. You can configure it in the Property Manager
at https://control.akamai.com. It is used by the behaviors Auth Token 2.0 Verification and
Segmented Media Protection.
akamai-edgeauth-php supports PHP 8.1+ and depends on hash_hmac() in PHP only.
Installation
To install akamai-edgeauth-php with composer:
$ composer require barrycoleman/akamai-edgeauth-php
Example
<?php require 'vendor/autoload.php'; $generator = new barrycoleman\AkamaiEdgeAuth\TokenGenerator( [ 'key' => 'abc123', 'windowSeconds' => 3600 ]); echo $generator->generateACLToken('/foo/*'); echo $generator->generateURLToken('/foo/index.html');
Usage
TokenGenerator class
The constructor takes an array of parameters as key/value pairs
| Parameter | Description |
|---|---|
| key | (required) The encryption key to use. This should be the same value as you enter in the Akamai behavior Auth Token 2.0 Verification. Must be an even length hexadecimal digit string. |
| startTime | (optional) The unix time the token is valid from. This will default to the current time. Valid values are any integer greater than zero, and the string 'now'. |
| endTime | (optional) The unix time the token is valid until. This can be any time after the start time. This must be provided if 'windowSeconds' is not provided. |
| windowSeconds | (optional) The number of seconds the token should be valid for from the start time. This must be provided if 'endTime' is not provided. 'endTime' has priority over 'windowSeconds' if both are provided. |
| algorithm | (optional) The algorithm to use to create the token. Must be one of 'sha256', 'sha1', or 'md5'. Default is 'sha256'. |
| escapeEarly | (optional) Whether to escape strings before generation of the token. Default is false. |
| fieldDelimiter | (optional) The character to place between fields in the token. Default is '~'. If you intend the token to work in Akamai Auth Token 2.0 Verification behavior you should not change this. |
| aclDelimiter | (optional) The character to place between entries in an ACL array. Default is '!'. If you intend the token to work in Akamai Auth Token 2.0 Verification behavior you should not change this. |
| verbose | (optional) Will print out (using echo) the configuration of the component during token generation. Default is false. |
| ip | (optional) Used for specifying IP address. Uses escapeEarly if set true. |
| sessionId | (optional) Used for specifying a session id. Uses escapeEarly if set true. |
| payload | (optional) Used for specifying a payload. Uses escapeEarly if set true. |
| salt | (optional) Salt added to the token hash. This is deprecated in Akamai and should not be used for new implementations. |
| tokenName | (optional) This is unused in the current implementation. This would be the name of the cookie, query parameter or header to use. Default is 'token'. |
TokenGenerator methods
generateACLToken(acl) generateURLToken(url)
| Parameter | Description |
|---|---|
| url | Single URL path (string) |
| acl | Access Control List can use the wildcards (*, ?). It can be a single string or an array of strings. |
barrycoleman/akamai-edgeauth-php 适用场景与选型建议
barrycoleman/akamai-edgeauth-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21.36k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「auth」 「edge」 「akamai」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 barrycoleman/akamai-edgeauth-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 barrycoleman/akamai-edgeauth-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 barrycoleman/akamai-edgeauth-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Multiauth package
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
Utility for downloading Microsoft Edge Driver binary with browser version detection
Akamai Netstorage filesystem adapter for Flysystem.
A general purpose graph library in PHP
This package provides a flexible way to add Role-based Permissions to Laravel 6.x
统计信息
- 总下载量: 21.36k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-23
