verzth/tcx-client
Composer 安装命令:
composer require verzth/tcx-client
包简介
TCX Client - Add-on for Authentication Module for Client-Server Transaction (One Way - Two Way)
README 文档
README
TCX is authentication module to secure API Server.
It's adapt OAuth2 scheme, but it use more simplify scheme which provide authentication for client-server without need to define scopes.
-
Authentication Type, TCX support three ways authentication type:
- One Way Transaction Code (OWTC): Client only need to use app_id and app_public to access Server APIs.
- Two Way Transaction Code (TWTC): Client has to use app_id and app_public to get access token, then it can be used to access APIs.
- Free Transaction Code (FTC): Client use master token to access APIs, without need to request token for every requests. You need to generate Master token manually.
Client need to specify type by sending X-TCX-TYPE header in every APIs request.
-
How to generate credentials:
- app_pass or X-TCX-APP-PASS, it can be generate by hashing plain of joined token (param, time, or none), application public key,
and client dynamic token with SHA1. Client need to append the given dynamic token to hash result by splitting with colon (:)
symbol, then encrypt it with base64.
-
Param base
Sample Parameter:
abc=123 _xyz=789 foo=bar def=456 bar=ghiExpected Token:
_xyz=789&abc=123&bar=ghi&def=456&foo=bar -
Time base
tcx_datetime=YYYYMMDDHHmmssSample
tcx_datetime=20181230235959 // For 23:59:59, 30 December 2018 -
None, just using application password and client dynamic token.
-
- token or X-TCX-TOKEN, it's provided when Client authorizing to server, but you need to encrypt it with base64.
- app_pass or X-TCX-APP-PASS, it can be generate by hashing plain of joined token (param, time, or none), application public key,
and client dynamic token with SHA1. Client need to append the given dynamic token to hash result by splitting with colon (:)
symbol, then encrypt it with base64.
-
Authentication Headers.
- Type OWTC:
- 'X-TCX-TYPE': 'OWTC'.
- 'X-TCX-APP-ID': Client ID.
- 'X-TCX-APP-PASS': Client Password.
- Type TWTC:
- 'X-TCX-TYPE': 'TWTC'.
- 'X-TCX-APP-ID': Client ID.
- 'X-TCX-APP-PASS': Client Password.
- 'X-TCX-TOKEN': Access Token, obtained by doing authorization.
- Type FTC:
- 'X-TCX-TYPE': 'FTC'.
- 'X-TCX-APP-ID': Client ID.
- 'X-TCX-APP-PASS': Client Password.
- 'X-TCX-TOKEN': Master Access Token.
- Type OWTC:
-
Available Function.
- getID() - Get Application ID.
- getSecret() - Get Application Secret Key.
- getPublic() - Get Application Public Key.
- getTokenType() - Get Token authorization type mode.
- isDebug() - Check debugging status.
- getTCXPass(&$params) - Get Application Password.
- getTCXMasterKey($encrypt=false) - Get Master Token key.
- getTCXAccess($pass, $datetime=false, $encrypt=false) - Get Access Token key.
-
Response Status.
Status Number Code Message Note 0 705000 TCXREQ TCX Authentication Required Provide Authentication Header 0 205001 TCXRJC TCX Authentication Rejected X-TCX-Type not supported or disabled 0 405002 TCXAFX TCX Authentication Failed X-TCX-App-ID not found, invalid, or inactive 0 505003 TCXPFX TCX Pass did not match X-TCX-App-Pass not passed, crosscheck point 2 0 505004 TCXMKF TCX Master Key did not valid Check the master access key (Only FTC) 0 505005 TCXTFX TCX Token did not valid Check the access key (Only TWTC) Sample Response:
{ "status": 0, "status_code": "TCXREQ", "status_number": "705000", "status_message": "TCX Authentication Required" }
verzth/tcx-client 适用场景与选型建议
verzth/tcx-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 01 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Authentication」 「laravel」 「tcx」 「owtc」 「twtc」 「ftc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 verzth/tcx-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 verzth/tcx-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 verzth/tcx-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Automatically logs-in users if they are already authenticated by a remote source. (e.g. environment variable REMOTE_USER)
GraphQL authentication for your headless Craft CMS applications.
It parses .tcx file to JSON
It parses .tcx file to JSON
PHP Library for parsing running GPS activities and calculating metrics
Laravel middleware to restrict a site or specific routes using HTTP basic authentication
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-31