harunnryd / gateid
使用PHP7和Lumen编写的API网关。
dev-master
2018-07-28 09:18 UTC
Requires
- php: >=7.1.3
- appzcoder/lumen-routes-list: ^1.0
- dusterio/lumen-passport: ^0.2.7
- guzzlehttp/guzzle: ~6.0
- laravel/lumen-framework: 5.6.*
- league/flysystem: ~1.0
- vlucas/phpdotenv: ~2.2
- vluzrmos/tinker: ^1.4
Requires (Dev)
- codeception/specify: ^1.1
- fzaninotto/faker: ~1.4
- mockery/mockery: ~1.0
- phpunit/phpunit: ~7.0
This package is not auto-updated.
Last update: 2024-09-29 05:49:21 UTC
README
什么是API网关?
API网关位于您的应用程序和服务之前,并管理授权、访问控制和吞吐量限制。理想情况下,这意味着您可以专注于创建服务,而不是实现管理基础设施。例如,如果您已经编写了一个非常出色的提供纽约市所有猫咪地理位置数据的Web服务,并且希望将其公开,那么集成API网关比编写自己的授权中间件更快、更安全。
需求和依赖
- PHP >= 7.0
- Lumen 5.6
- Guzzle 6
- Laravel Passport(带Lumen Passport)
- Spatie Permission(带[Spatie Permission] (https://github.com/spatie/laravel-permission)
它如何工作!
$ composer install
$ php artisan passport:install
$ vim storage/app/routes.json
如果您需要使用Oauth2(Passport),请在中间件上标记oauth:api
# example routes.json { "global": { "domain": "54.169.181.142:7002" }, "routes": [ { "description": "get specific role", "method": "get", "middleware": ["auth:api"], "path": "/api/v2/roles/{id}", "actions": [ { "method": "get", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/roles/{id}", "outputKey": "role" } ] }, { "description": "get all roles", "method": "get", "middleware": ["auth:api"], "path": "/api/v2/roles", "actions": [ { "method": "get", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/roles", "outputKey": "roles" } ] }, { "description": "create role", "method": "post", "middleware": ["auth:api"], "path": "/api/v2/roles", "actions": [ { "method": "post", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/roles", "outputKey": "role" } ] }, { "description": "update role", "method": "patch", "middleware": ["auth:api"], "path": "/api/v2/roles/{id}", "actions": [ { "method": "patch", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/roles/{id}", "outputKey": "role" } ] }, { "description": "delete role", "method": "delete", "middleware": ["auth:api"], "path": "/api/v2/roles/{id}", "actions": [ { "method": "delete", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/roles/{id}", "outputKey": "role" } ] }, { "description": "get specific permission", "method": "get", "middleware": ["auth:api"], "path": "/api/v2/permissions/{id}", "actions": [ { "method": "get", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/permissions/{id}", "outputKey": "permission" } ] }, { "description": "get all permission", "method": "get", "middleware": ["auth:api"], "path": "/api/v2/permissions", "actions": [ { "method": "get", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/permissions", "outputKey": "permissions" } ] }, { "description": "create permission", "method": "post", "middleware": ["auth:api"], "path": "/api/v2/permissions", "actions": [ { "method": "post", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/permissions", "outputKey": "permission" } ] }, { "description": "update permission", "method": "patch", "middleware": ["auth:api"], "path": "/api/v2/permissions/{id}", "actions": [ { "method": "patch", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/permissions/{id}", "outputKey": "permission" } ] }, { "description": "delete permission", "method": "delete", "middleware": ["auth:api"], "path": "/api/v2/permissions/{id}", "actions": [ { "method": "delete", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/permissions/{id}", "outputKey": "permission" } ] }, { "description": "attach role to user", "method": "patch", "middleware": ["auth:api"], "path": "/api/v2/users/{id}/roles", "actions": [ { "method": "patch", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/users/{id}/roles", "outputKey": "user" } ] }, { "description": "detach role to user", "method": "delete", "middleware": ["auth:api"], "path": "/api/v2/users/{id}/roles", "actions": [ { "method": "delete", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/users/{id}/roles", "outputKey": "user" } ] }, { "description": "attach permission to user", "method": "patch", "middleware": ["auth:api"], "path": "/api/v2/users/{id}/permissions", "actions": [ { "method": "patch", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/users/{id}/permissions", "outputKey": "user" } ] }, { "description": "detach permission to user", "method": "delete", "middleware": ["auth:api"], "path": "/api/v2/users/{id}/permissions", "actions": [ { "method": "delete", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/users/{id}/permissions", "outputKey": "user" } ] }, { "description": "get all role by user", "method": "get", "middleware": ["auth:api"], "path": "/api/v2/users/{id}/roles", "actions": [ { "sequence": 0, "method": "get", "hostname": "54.169.181.142:7004", "service": "", "path": "/account/v2/users/{id}", "outputKey": "user" }, { "sequence": 0, "method": "get", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/users/{id}/roles", "outputKey": "user.roles" } ] }, { "description": "get all permission by role", "method": "get", "middleware": ["auth:api"], "path": "/api/v2/roles/{id}/permissions", "actions": [ { "sequence": 0, "method": "get", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/api/v2/roles/{id}", "outputKey": "role" }, { "sequence": 0, "method": "get", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/roles/{id}/permissions", "outputKey": "role.permissions" } ] }, { "description": "get all user by role", "method": "get", "middleware": ["auth:api"], "path": "/api/v2/roles/{id}/users", "actions": [ { "sequence": 0, "method": "get", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/api/v2/roles/{id}", "outputKey": "role" }, { "sequence": 1, "method": "get", "hostname": "54.169.181.142:7003", "service": "", "path": "/rbac/v2/roles/{id}/users", "outputKey": "role.users" } ] }, { "description": "register user", "method": "post", "middleware": [], "path": "/api/v2/users", "actions": [ { "method": "post", "hostname": "54.169.181.142:7004", "service": "", "path": "/account/v2/users", "outputKey": "user" } ] }, { "description": "delete user", "method": "delete", "middleware": [], "path": "/api/v2/users/{id}", "actions": [ { "method": "delete", "hostname": "54.169.181.142:7004", "service": "", "path": "/account/v2/users/{id}", "outputKey": "user" } ] }, { "description": "update user", "method": "patch", "middleware": ["auth:api"], "path": "/api/v2/users/{id}", "actions": [ { "method": "patch", "hostname": "54.169.181.142:7004", "service": "", "path": "/account/v2/users/{id}", "outputKey": "user" } ] }, { "description": "get user", "method": "get", "middleware": ["auth:api"], "path": "/api/v2/users/{id}", "actions": [ { "sequence": 0, "method": "get", "hostname": "54.169.181.142:7004", "service": "", "path": "/account/v2/users/{id}", "outputKey": "user" } ] }, { "description": "get user self", "method": "get", "middleware": ["auth:api"], "path": "/api/v2/self-users", "actions": [ { "sequence": 0, "method": "get", "hostname": "54.169.181.142:7004", "service": "", "path": "/account/v2/self-users", "outputKey": "user" } ] }, { "description": "get user", "method": "get", "middleware": ["auth:api"], "path": "/api/v2/users", "actions": [ { "sequence": 0, "method": "get", "hostname": "54.169.181.142:7004", "service": "", "path": "/account/v2/users", "outputKey": "users" } ] }, { "description": "get location point", "method": "post", "middleware": ["auth:api"], "path": "/api/v2/location-points", "actions": [ { "sequence": 0, "method": "post", "hostname": "54.169.181.142:7006", "service": "", "path": "/reservation/v2/location-points", "outputKey": "location_points" } ] } ] }
安全漏洞
如果您在Gateid中发现安全漏洞,请发送电子邮件至harun nur rasyid的邮箱harunwols@gmail.com。所有安全漏洞都将得到及时处理。
许可证
Gateid是开源软件,许可协议为MIT许可证