cpsit / api-token
生成并验证用于API请求的令牌认证。
0.9.6
2023-09-21 13:29 UTC
Requires
- dwenzel/t3extension-tools: ^1.7 || ^2.0
- ramsey/uuid: ^4.0
- typo3/cms-core: ^10.4||^11.5
Requires (Dev)
- nimut/testing-framework: ^5.2 || ^6.0
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-09-05 06:02:49 UTC
README
生成API凭据
通过CLI命令生成
./vendor/bin/typo3cms apitoken:generate
- 询问令牌名称,用于识别记录的描述性帮助,不用于技术用途。
- 询问令牌描述,用于识别记录的描述性帮助,不用于技术用途。
输出
Your token was successfully generated.
Identifier: 4a6*******d
Secret: 7a5-*****c82
(Please keep information safely and secure. Token is shown only once.)
持久化名称、描述、标识符、到期日期(1年)和用于通过API调用验证令牌的哈希值。请注意,密钥(令牌)安全存储,不会再次显示。
在Typo3后端生成
待定
在你的扩展中使用
- 需要扩展:
composer req cpsit/api-token
- 在API处理器中实现令牌检查
if(\CPSIT\ApiToken\Request\Validation\ApiTokenAuthenticator::isNotAuthenticated($request)){
return \CPSIT\ApiToken\Request\Validation\ApiTokenAuthenticator::returnErrorResponse();
}
- 放入API请求头中
x-api-identifier = {上述生成的 x-api-identifier}
和application-authorization = {上述生成的密钥令牌}
许可证
版权声明
(c) 2021 Team Bravo info@familie-redlich.de 版权所有
GNU通用公共许可证可在https://gnu.ac.cn/copyleft/gpl.html找到。副本位于文本文件GPL.txt中,作者关于许可证的重要通知位于与这些脚本一起分发的LICENSE.txt中。此脚本分发时希望它是有用的,但没有任何保证;甚至没有对适销性或特定用途适用性的暗示性保证。有关更多详细信息,请参阅GNU通用公共许可证。此版权声明必须在脚本的所有副本中显示!