anandpilania/f3-token-middleware
Composer 安装命令:
composer require anandpilania/f3-token-middleware
包简介
Token Auth Middleware for FatFreeFramework.
README 文档
README
Just pass your token secure routes [/ OR '/secure/*'] & handler to f3-token-middleware & relax... it will check requests pattern + token & execute your handler if token not found.
NOTE: This package built/ported from ikkez/f3-middleware.
CHECK example.file for sample
Install
`composer require anandpilania/f3-token-middleware`
## Usage
-
1: Configure
f3:`$f3->mset(array( 'TOKEN' => array( 'TYPE' => 'HEADER', // HEADER|QUERY 'KEY' => 'Authorization', // TOKEN KEY 'STARTS_WITH' => 'X-Auth-Token', // TOKEN KEY STARTS WITH (supports only HEADER type) -> "Authorization: X-Auth-Token xxxxxxxx" 'TABLE' => 'Models\Token', // FQCN 'TABLE_KEY' => 'token' // KEY, which you used to store the token value in table ) ));` -
2: Initialize in your main
bootstrapfile:`$tokenMiddleware = new TokenMiddleware();` -
3:
Protectroutes/pattern:`$tokenMiddleware->protect(array('GET|POST|PUT|DELETE /home/*', 'POST /profile'), function($f3, $params, $alias) { // YOUR FUNCTION, IF 'TOKEN' NOT SUPPLIED });` -
4: RUN:
`$tokenMiddleware->run();`
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 2
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-12